This is an automated email from the ASF dual-hosted git repository. udo pushed a commit to branch feature/GEODE-3604 in repository https://gitbox.apache.org/repos/asf/geode.git
commit f165d34013a0dccd8311ea26f5291647dacb7be6 Author: kohlmu-pivotal <[email protected]> AuthorDate: Mon Sep 11 10:53:05 2017 -0700 spotlessApply --- .../distributed/internal/tcpserver/TcpServer.java | 36 +++++++++++++--------- .../sockets/GenericProtocolServerConnection.java | 14 +++------ .../tier/sockets/MessageExecutionContext.java | 2 +- .../ProtocolMessageHandlerLookupService.java | 2 +- .../tier/sockets/ServerConnectionFactory.java | 20 +++++++----- .../server/AuthenticatorLookupService.java | 3 +- .../protocol/protobuf/EncodingTypeTranslator.java | 3 +- .../protocol/protobuf/ProtobufOpsProcessor.java | 13 ++++---- .../operations/GetAllRequestOperationHandler.java | 5 ++- .../GetAvailableServersOperationHandler.java | 6 ++-- .../operations/PutAllRequestOperationHandler.java | 3 +- .../server/ProtobufSimpleAuthenticator.java | 5 ++- 12 files changed, 60 insertions(+), 52 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java index 6ec265a..cc8a8bb 100755 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java @@ -68,20 +68,27 @@ import org.apache.geode.internal.security.SecurableCommunicationChannel; /** * TCP server which listens on a port and delegates requests to a request handler. The server uses - * expects messages containing a global version number, followed by a DataSerializable object <p> + * expects messages containing a global version number, followed by a DataSerializable object + * <p> * This code was factored out of GossipServer.java to allow multiple handlers to share the same * gossip server port. + * * @since GemFire 5.7 */ public class TcpServer { /** - * The version of the tcp server protocol <p> This should be incremented if the gossip message - * structures change <p> 0 - special indicator of a non-gossip message from a client<br> 1000 - - * gemfire 5.5 - using java serialization<br> 1001 - 5.7 - using DataSerializable and supporting - * server locator messages.<br> 1002 - 7.1 - sending GemFire version along with GOSSIP_VERSION in - * each request. <p> with the addition of support for all old versions of clients you can no - * longer change this version number + * The version of the tcp server protocol + * <p> + * This should be incremented if the gossip message structures change + * <p> + * 0 - special indicator of a non-gossip message from a client<br> + * 1000 - gemfire 5.5 - using java serialization<br> + * 1001 - 5.7 - using DataSerializable and supporting server locator messages.<br> + * 1002 - 7.1 - sending GemFire version along with GOSSIP_VERSION in each request. + * <p> + * with the addition of support for all old versions of clients you can no longer change this + * version number */ public final static int GOSSIPVERSION = 1002; public final static int NON_GOSSIP_REQUEST_VERSION = 0; @@ -144,9 +151,9 @@ public class TcpServer { } public TcpServer(int port, InetAddress bind_address, Properties sslConfig, - DistributionConfigImpl cfg, TcpHandler handler, PoolStatHelper poolHelper, - ThreadGroup threadGroup, String threadName, InternalLocator internalLocator, - ClientProtocolMessageHandler messageHandler) { + DistributionConfigImpl cfg, TcpHandler handler, PoolStatHelper poolHelper, + ThreadGroup threadGroup, String threadName, InternalLocator internalLocator, + ClientProtocolMessageHandler messageHandler) { this.port = port; this.bind_address = bind_address; this.handler = handler; @@ -179,7 +186,7 @@ public class TcpServer { } private static PooledExecutorWithDMStats createExecutor(PoolStatHelper poolHelper, - final ThreadGroup threadGroup) { + final ThreadGroup threadGroup) { ThreadFactory factory = new ThreadFactory() { private final AtomicInteger threadNum = new AtomicInteger(); @@ -196,7 +203,7 @@ public class TcpServer { } public void restarting(InternalDistributedSystem ds, InternalCache cache, - ClusterConfigurationService sharedConfig) throws IOException { + ClusterConfigurationService sharedConfig) throws IOException { this.shuttingDown = false; this.handler.restarting(ds, cache, sharedConfig); startServerThread(); @@ -266,6 +273,7 @@ public class TcpServer { /** * Returns the value of the bound port. If the server was initialized with a port of 0 indicating * that any ephemeral port should be used, this method will return the actual bound port. + * * @return the locator's tcp/ip port. This will be zero if the locator hasn't been started. */ public int getPort() { @@ -360,8 +368,7 @@ public class TcpServer { short versionOrdinal; if (gossipVersion == NON_GOSSIP_REQUEST_VERSION) { if (input.readUnsignedByte() == CommunicationMode.ProtobufClientServerProtocol - .getModeNumber() - && Boolean.getBoolean("geode.feature-protobuf-protocol")) { + .getModeNumber() && Boolean.getBoolean("geode.feature-protobuf-protocol")) { messageHandler.receiveMessage(input, socket.getOutputStream(), new MessageExecutionContext(internalLocator)); } else { @@ -526,6 +533,7 @@ public class TcpServer { /** * Returns GossipVersion for older Gemfire versions. + * * @return gossip version */ public static int getGossipVersionForOrdinal(short ordinal) { diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java index 78861e3..01d5acc 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/GenericProtocolServerConnection.java @@ -43,16 +43,12 @@ public class GenericProtocolServerConnection extends ServerConnection { * from an edge client over a given <code>Socket</code>. */ GenericProtocolServerConnection(Socket socket, InternalCache cache, - CachedRegionHelper cachedRegionHelper, - CacheServerStats cacheServerStats, int hsTimeout, - int socketBufferSize, String communicationModeStr, - byte communicationMode, Acceptor acceptor, - SecurityService securityService, - ClientProtocolMessageHandler clientProtocolMessageHandler, - AuthenticatorLookupService authenticatorLookupService) { + CachedRegionHelper cachedRegionHelper, CacheServerStats cacheServerStats, int hsTimeout, + int socketBufferSize, String communicationModeStr, byte communicationMode, Acceptor acceptor, + SecurityService securityService, ClientProtocolMessageHandler clientProtocolMessageHandler, + AuthenticatorLookupService authenticatorLookupService) { super(socket, cache, cachedRegionHelper, cacheServerStats, hsTimeout, socketBufferSize, - communicationModeStr, communicationMode, - acceptor, securityService); + communicationModeStr, communicationMode, acceptor, securityService); securityManager = securityService.getSecurityManager(); this.messageHandler = clientProtocolMessageHandler; this.authenticator = authenticatorLookupService.getAuthenticator(); diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/MessageExecutionContext.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/MessageExecutionContext.java index f45d518..416cb28 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/MessageExecutionContext.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/MessageExecutionContext.java @@ -38,7 +38,7 @@ public class MessageExecutionContext { } /** - + * * Returns the cache associated with this execution * <p> * diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ProtocolMessageHandlerLookupService.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ProtocolMessageHandlerLookupService.java index 36f2624..ca1cecd 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ProtocolMessageHandlerLookupService.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ProtocolMessageHandlerLookupService.java @@ -24,7 +24,7 @@ public class ProtocolMessageHandlerLookupService { } public ClientProtocolMessageHandler lookupProtocolHandler(String protocolType) { - //TODO Do we need to make provision for different protocols here right now? + // TODO Do we need to make provision for different protocols here right now? return protocolHandler; } } diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java index bfde7c0..7b13fd0 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnectionFactory.java @@ -38,20 +38,24 @@ public class ServerConnectionFactory { authenticatorLookupService = new AuthenticatorLookupService(); } - public ServerConnection makeServerConnection(Socket socket, InternalCache cache, CachedRegionHelper cachedRegionHelper, - CacheServerStats cacheServerStats, int hsTimeout, int socketBufferSize, String communicationModeStr, - byte communicationMode, Acceptor acceptor, SecurityService securityService) - throws IOException { + public ServerConnection makeServerConnection(Socket socket, InternalCache cache, + CachedRegionHelper cachedRegionHelper, CacheServerStats cacheServerStats, int hsTimeout, + int socketBufferSize, String communicationModeStr, byte communicationMode, Acceptor acceptor, + SecurityService securityService) throws IOException { if (ProtobufClientServerProtocol.getModeNumber() == communicationMode) { if (!Boolean.getBoolean("geode.feature-protobuf-protocol")) { throw new IOException("Server received unknown communication mode: " + communicationMode); } else { - return new GenericProtocolServerConnection(socket, cache, cachedRegionHelper, cacheServerStats, hsTimeout, socketBufferSize, - communicationModeStr, communicationMode, acceptor, securityService, protocolMessageHandlerLookupService.lookupProtocolHandler("protobuf"),authenticatorLookupService); + return new GenericProtocolServerConnection(socket, cache, cachedRegionHelper, + cacheServerStats, hsTimeout, socketBufferSize, communicationModeStr, communicationMode, + acceptor, securityService, + protocolMessageHandlerLookupService.lookupProtocolHandler("protobuf"), + authenticatorLookupService); } } else { - return new LegacyServerConnection(socket, cache, cachedRegionHelper, cacheServerStats, hsTimeout, socketBufferSize, - communicationModeStr, communicationMode, acceptor, securityService); + return new LegacyServerConnection(socket, cache, cachedRegionHelper, cacheServerStats, + hsTimeout, socketBufferSize, communicationModeStr, communicationMode, acceptor, + securityService); } } } diff --git a/geode-core/src/main/java/org/apache/geode/internal/security/server/AuthenticatorLookupService.java b/geode-core/src/main/java/org/apache/geode/internal/security/server/AuthenticatorLookupService.java index b7af501..3ce811a 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/security/server/AuthenticatorLookupService.java +++ b/geode-core/src/main/java/org/apache/geode/internal/security/server/AuthenticatorLookupService.java @@ -30,7 +30,8 @@ public class AuthenticatorLookupService { public Authenticator getAuthenticator() { String authenticationMode = System.getProperty("geode.protocol-authentication-mode", "NOOP"); - Class<? extends Authenticator> streamAuthenticatorClass = authenticators.get(authenticationMode); + Class<? extends Authenticator> streamAuthenticatorClass = + authenticators.get(authenticationMode); if (streamAuthenticatorClass == null) { throw new GemFireConfigException( "Could not find implementation for Authenticator with implementation ID " diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/EncodingTypeTranslator.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/EncodingTypeTranslator.java index 9ae761d..afbb066 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/EncodingTypeTranslator.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/EncodingTypeTranslator.java @@ -28,7 +28,8 @@ import org.apache.geode.serialization.exception.UnsupportedEncodingTypeException */ @Experimental public abstract class EncodingTypeTranslator { - private static final HashMap<Class, BasicTypes.EncodingType> typeToEncodingMap = intializeTypeMap(); + private static final HashMap<Class, BasicTypes.EncodingType> typeToEncodingMap = + intializeTypeMap(); private static HashMap<Class, BasicTypes.EncodingType> intializeTypeMap() { HashMap<Class, BasicTypes.EncodingType> result = new HashMap<>(); diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufOpsProcessor.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufOpsProcessor.java index 04db646..a06c655 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufOpsProcessor.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/ProtobufOpsProcessor.java @@ -37,13 +37,13 @@ public class ProtobufOpsProcessor { private final SerializationService serializationService; public ProtobufOpsProcessor(SerializationService serializationService, - OperationContextRegistry operationContextRegistry) { + OperationContextRegistry operationContextRegistry) { this.serializationService = serializationService; this.operationContextRegistry = operationContextRegistry; } public ClientProtocol.Response process(ClientProtocol.Request request, - MessageExecutionContext context) { + MessageExecutionContext context) { ClientProtocol.Request.RequestAPICase requestType = request.getRequestAPICase(); OperationContext operationContext = operationContextRegistry.getOperationContext(requestType); ClientProtocol.Response.Builder builder; @@ -53,7 +53,7 @@ public class ProtobufOpsProcessor { if (authorizer.authorize(operationContext.getAccessPermissionRequired())) { result = operationContext.getOperationHandler().process(serializationService, operationContext.getFromRequest().apply(request), context); - } else{ + } else { result = Failure.of(ProtobufResponseUtilities.makeErrorResponse( ProtocolErrorCode.AUTHORIZATION_FAILED.codeValue, "User isn't authorized for this operation.")); @@ -71,11 +71,10 @@ public class ProtobufOpsProcessor { private Authorizer findAuthorizer(MessageExecutionContext context) { Authorizer authorizer = context.getAuthorizer(); - if(authorizer != null) - { + if (authorizer != null) { return authorizer; - }else{ - //TODO Horrible HACK because we need to look this up correctly. + } else { + // TODO Horrible HACK because we need to look this up correctly. return new NoOpAuthorizer(); } } diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java index 2d50fe1..85a3f81 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAllRequestOperationHandler.java @@ -51,12 +51,11 @@ public class GetAllRequestOperationHandler RegionAPI.GetAllResponse.Builder responseBuilder = RegionAPI.GetAllResponse.newBuilder(); - request.getKeyList().stream() - .map((key) -> processOneMessage(serializationService, region, key)) + request.getKeyList().stream().map((key) -> processOneMessage(serializationService, region, key)) .forEach(entry -> { if (entry instanceof BasicTypes.Entry) { responseBuilder.addEntries((BasicTypes.Entry) entry); - }else if (entry instanceof BasicTypes.KeyedError) { + } else if (entry instanceof BasicTypes.KeyedError) { responseBuilder.addFailures((BasicTypes.KeyedError) entry); } }); diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java index 2ad8c10..eefd9f0 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java @@ -48,9 +48,9 @@ public class GetAvailableServersOperationHandler implements ServerAPI.GetAvailableServersResponse.Builder serverResponseBuilder = ServerAPI.GetAvailableServersResponse.newBuilder(); - serversFromSnapshot - .stream().map(serverLocation -> getServerProtobufMessage((ServerLocation) serverLocation)) - .forEach( serverMessage -> serverResponseBuilder.addServers((BasicTypes.Server) serverMessage)); + serversFromSnapshot.stream() + .map(serverLocation -> getServerProtobufMessage((ServerLocation) serverLocation)).forEach( + serverMessage -> serverResponseBuilder.addServers((BasicTypes.Server) serverMessage)); return Success.of(serverResponseBuilder.build()); } diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java index 1194b21..845f6cf 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/PutAllRequestOperationHandler.java @@ -55,7 +55,8 @@ public class PutAllRequestOperationHandler RegionAPI.PutAllResponse.Builder builder = RegionAPI.PutAllResponse.newBuilder(); putAllRequest.getEntryList().stream() - .map((entry) -> singlePut(serializationService, region, entry)).filter(Objects::nonNull).forEach(failedKey -> builder.addFailedKeys(failedKey)); + .map((entry) -> singlePut(serializationService, region, entry)).filter(Objects::nonNull) + .forEach(failedKey -> builder.addFailedKeys(failedKey)); return Success.of(builder.build()); } diff --git a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/security/server/ProtobufSimpleAuthenticator.java b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/security/server/ProtobufSimpleAuthenticator.java index 9892bef..3d6bf58 100644 --- a/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/security/server/ProtobufSimpleAuthenticator.java +++ b/geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/security/server/ProtobufSimpleAuthenticator.java @@ -34,7 +34,7 @@ public class ProtobufSimpleAuthenticator implements Authenticator { @Override public void authenticate(InputStream inputStream, OutputStream outputStream, - SecurityManager securityManager) throws IOException { + SecurityManager securityManager) throws IOException { if (!authenticationSuccessfull) { AuthenticationAPI.SimpleAuthenticationRequest authenticationRequest = AuthenticationAPI.SimpleAuthenticationRequest.parseDelimitedFrom(inputStream); @@ -57,8 +57,7 @@ public class ProtobufSimpleAuthenticator implements Authenticator { } AuthenticationAPI.SimpleAuthenticationResponse.newBuilder() - .setAuthenticated(isAuthenticated()) - .build().writeDelimitedTo(outputStream); + .setAuthenticated(isAuthenticated()).build().writeDelimitedTo(outputStream); } } -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
