mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Clean up Gradle stylings and fix issues IDed in Prober (#212)
This commit is contained in:
parent
b36cae52e9
commit
2a381b7071
8 changed files with 63 additions and 62 deletions
|
@ -236,9 +236,7 @@ subprojects {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.name == 'util') return
|
if (['util', 'proxy', 'core', 'prober'].contains(project.name)) return
|
||||||
if (project.name == 'proxy') return
|
|
||||||
if (project.name == 'core') return
|
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput)
|
testLogging.showStandardStreams = Boolean.parseBoolean(showAllOutput)
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
createUberJar('deployJar', 'prober', 'google.registry.monitoring.blackbox.Prober')
|
createUberJar('deployJar', 'prober', 'google.registry.monitoring.blackbox.Prober')
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -41,14 +41,16 @@ public abstract class Protocol {
|
||||||
return new AutoValue_Protocol.Builder();
|
return new AutoValue_Protocol.Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Builder for {@link Protocol}. */
|
||||||
@AutoValue.Builder
|
@AutoValue.Builder
|
||||||
public static abstract class Builder {
|
public abstract static class Builder {
|
||||||
|
|
||||||
public abstract Builder name(String value);
|
public abstract Builder name(String value);
|
||||||
|
|
||||||
public abstract Builder port(int num);
|
public abstract Builder port(int num);
|
||||||
|
|
||||||
public abstract Builder handlerProviders(ImmutableList<Provider<? extends ChannelHandler>> providers);
|
public abstract Builder handlerProviders(
|
||||||
|
ImmutableList<Provider<? extends ChannelHandler>> providers);
|
||||||
|
|
||||||
public abstract Builder persistentConnection(boolean value);
|
public abstract Builder persistentConnection(boolean value);
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,23 @@ package google.registry.monitoring.blackbox.handlers;
|
||||||
import com.google.common.flogger.FluentLogger;
|
import com.google.common.flogger.FluentLogger;
|
||||||
import google.registry.monitoring.blackbox.messages.InboundMessageType;
|
import google.registry.monitoring.blackbox.messages.InboundMessageType;
|
||||||
import google.registry.monitoring.blackbox.messages.OutboundMessageType;
|
import google.registry.monitoring.blackbox.messages.OutboundMessageType;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Superclass of all {@link ChannelHandler}s placed at end of channel pipeline
|
* Superclass of all {@link ChannelHandler}s placed at end of channel pipeline
|
||||||
*
|
*
|
||||||
* <p> {@code ActionHandler} inherits from {@link SimpleChannelInboundHandler< InboundMessageType >}, as it should only be passed in
|
* <p>{@code ActionHandler} inherits from {@link SimpleChannelInboundHandler< InboundMessageType >},
|
||||||
* messages that implement the {@link InboundMessageType} interface. </p>
|
* as it should only be passed in messages that implement the {@link InboundMessageType} interface.
|
||||||
*
|
*
|
||||||
* <p> The {@code ActionHandler} skeleton exists for a few main purposes. First, it returns a {@link ChannelPromise},
|
* <p>The {@code ActionHandler} skeleton exists for a few main purposes. First, it returns a {@link
|
||||||
* which informs the {@link ProbingAction} in charge that a response has been read. Second, it stores the {@link OutboundMessageType}
|
* ChannelPromise}, which informs the {@link ProbingAction} in charge that a response has been read.
|
||||||
* passed down the pipeline, so that subclasses can use that information for their own processes. Lastly, with any exception
|
* Second, it stores the {@link OutboundMessageType} passed down the pipeline, so that subclasses
|
||||||
* thrown, the connection is closed, and the ProbingAction governing this channel is informed of the error. Subclasses
|
* can use that information for their own processes. Lastly, with any exception thrown, the
|
||||||
* specify further work to be done for specific kinds of channel pipelines. </p>
|
* connection is closed, and the ProbingAction governing this channel is informed of the error.
|
||||||
|
* Subclasses specify further work to be done for specific kinds of channel pipelines.
|
||||||
*/
|
*/
|
||||||
public abstract class ActionHandler extends SimpleChannelInboundHandler<InboundMessageType> {
|
public abstract class ActionHandler extends SimpleChannelInboundHandler<InboundMessageType> {
|
||||||
|
|
||||||
|
@ -40,7 +41,10 @@ public abstract class ActionHandler extends SimpleChannelInboundHandler<InboundM
|
||||||
|
|
||||||
protected ChannelPromise finished;
|
protected ChannelPromise finished;
|
||||||
|
|
||||||
/** Takes in {@link OutboundMessageType} type and saves for subclasses. Then returns initialized {@link ChannelPromise}*/
|
/**
|
||||||
|
* Takes in {@link OutboundMessageType} type and saves for subclasses. Then returns initialized
|
||||||
|
* {@link ChannelPromise}
|
||||||
|
*/
|
||||||
public ChannelFuture getFuture() {
|
public ChannelFuture getFuture() {
|
||||||
return finished;
|
return finished;
|
||||||
}
|
}
|
||||||
|
@ -48,27 +52,30 @@ public abstract class ActionHandler extends SimpleChannelInboundHandler<InboundM
|
||||||
/** Initializes new {@link ChannelPromise} */
|
/** Initializes new {@link ChannelPromise} */
|
||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
//Once handler is added to channel pipeline, initialize channel and future for this handler
|
// Once handler is added to channel pipeline, initialize channel and future for this handler
|
||||||
finished = ctx.newPromise();
|
finished = ctx.newPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelRead0(ChannelHandlerContext ctx, InboundMessageType inboundMessage) throws Exception {
|
public void channelRead0(ChannelHandlerContext ctx, InboundMessageType inboundMessage)
|
||||||
//simply marks finished as success
|
throws Exception {
|
||||||
finished.setSuccess();
|
// simply marks finished as success
|
||||||
|
finished = finished.setSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Logs the channel and pipeline that caused error, closes channel, then informs {@link ProbingAction} listeners of error */
|
/**
|
||||||
|
* Logs the channel and pipeline that caused error, closes channel, then informs {@link
|
||||||
|
* ProbingAction} listeners of error
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||||
logger.atSevere().withCause(cause).log(String.format(
|
logger.atSevere().withCause(cause).log(
|
||||||
|
String.format(
|
||||||
"Attempted Action was unsuccessful with channel: %s, having pipeline: %s",
|
"Attempted Action was unsuccessful with channel: %s, having pipeline: %s",
|
||||||
ctx.channel().toString(),
|
ctx.channel().toString(), ctx.channel().pipeline().toString()));
|
||||||
ctx.channel().pipeline().toString()));
|
|
||||||
|
|
||||||
finished.setFailure(cause);
|
finished = finished.setFailure(cause);
|
||||||
ChannelFuture closedFuture = ctx.channel().close();
|
ChannelFuture closedFuture = ctx.channel().close();
|
||||||
closedFuture.addListener(f -> logger.atInfo().log("Unsuccessful channel connection closed"));
|
closedFuture.addListener(f -> logger.atInfo().log("Unsuccessful channel connection closed"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
package google.registry.monitoring.blackbox.messages;
|
package google.registry.monitoring.blackbox.messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker Interface that is implemented by all classes that serve as {@code inboundMessages} in channel pipeline
|
* Marker Interface that is implemented by all classes that serve as {@code inboundMessages} in
|
||||||
|
* channel pipeline
|
||||||
*/
|
*/
|
||||||
public interface InboundMessageType {}
|
public interface InboundMessageType {}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
package google.registry.monitoring.blackbox.messages;
|
package google.registry.monitoring.blackbox.messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker Interface that is implemented by all classes that serve as {@code outboundMessages} in channel pipeline
|
* Marker Interface that is implemented by all classes that serve as {@code outboundMessages} in
|
||||||
|
* channel pipeline
|
||||||
*/
|
*/
|
||||||
public interface OutboundMessageType {}
|
public interface OutboundMessageType {}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
createUberJar('deployJar', 'proxy_server', 'google.registry.proxy.ProxyServer')
|
createUberJar('deployJar', 'proxy_server', 'google.registry.proxy.ProxyServer')
|
||||||
|
|
||||||
task buildProxyImage(dependsOn: deployJar, type: Exec) {
|
task buildProxyImage(dependsOn: deployJar, type: Exec) {
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def deps = rootProject.dependencyMap
|
def deps = rootProject.dependencyMap
|
||||||
compile deps['com.google.api-client:google-api-client']
|
compile deps['com.google.api-client:google-api-client']
|
||||||
|
|
Loading…
Add table
Reference in a new issue