http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java index bbd110e..df9bf96 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAForgetMessage.java @@ -78,8 +78,7 @@ public class SessionXAForgetMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java index 08cd4a8..09a8d89 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java @@ -16,11 +16,10 @@ */ package org.apache.activemq.artemis.core.protocol.core.impl.wireformat; +import javax.transaction.xa.Xid; import java.util.ArrayList; import java.util.List; -import javax.transaction.xa.Xid; - import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.utils.XidCodecSupport; @@ -96,8 +95,7 @@ public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl { if (xids == null) { if (other.xids != null) return false; - } - else if (!xids.equals(other.xids)) + } else if (!xids.equals(other.xids)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java index 99ddf18..d31adcd 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAJoinMessage.java @@ -78,8 +78,7 @@ public class SessionXAJoinMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java index 24ef2ea..d55747e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAPrepareMessage.java @@ -78,8 +78,7 @@ public class SessionXAPrepareMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java index fa6c296..086b851 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResponseMessage.java @@ -108,8 +108,7 @@ public class SessionXAResponseMessage extends PacketImpl { if (message == null) { if (other.message != null) return false; - } - else if (!message.equals(other.message)) + } else if (!message.equals(other.message)) return false; if (responseCode != other.responseCode) return false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java index fd801d4..d88e8e3 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAResumeMessage.java @@ -80,8 +80,7 @@ public class SessionXAResumeMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java index c42b7ae..abfea74 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXARollbackMessage.java @@ -80,8 +80,7 @@ public class SessionXARollbackMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAStartMessage.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAStartMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAStartMessage.java index d0bff0a..d6a8e84 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAStartMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAStartMessage.java @@ -87,8 +87,7 @@ public class SessionXAStartMessage extends PacketImpl { if (xid == null) { if (other.xid != null) return false; - } - else if (!xid.equals(other.xid)) + } else if (!xid.equals(other.xid)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java index cfadcfa..fe4cb3d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java @@ -50,8 +50,7 @@ public class TransportConfigurationUtil { if (object != null && object instanceof TransportConfigurationHelper) { DEFAULTS.put(className, ((TransportConfigurationHelper) object).getDefaults()); - } - else { + } else { DEFAULTS.put(className, EMPTY_HELPER); } } @@ -67,8 +66,7 @@ public class TransportConfigurationUtil { public Object run() { try { return ClassloadingUtil.newInstanceFromClassLoader(className); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { return null; } } @@ -90,8 +88,7 @@ public class TransportConfigurationUtil { String port1 = String.valueOf(tc1.getParams().get("port") != null ? tc1.getParams().get("port") : TransportConstants.DEFAULT_PORT); String port2 = String.valueOf(tc2.getParams().get("port") != null ? tc2.getParams().get("port") : TransportConstants.DEFAULT_PORT); return host1.equals(host2) && port1.equals(port2); - } - else if ("org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory".equals(tc1.getFactoryClassName())) { + } else if ("org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory".equals(tc1.getFactoryClassName())) { String serverId1 = tc1.getParams().get("serverId") != null ? tc1.getParams().get("serverId").toString() : "0"; String serverId2 = tc2.getParams().get("serverId") != null ? tc2.getParams().get("serverId").toString() : "0"; return serverId1.equals(serverId2); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java index c581a5a..93be281 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/ActiveMQChannelHandler.java @@ -97,8 +97,7 @@ public class ActiveMQChannelHandler extends ChannelDuplexHandler { try { listener.connectionException(channelId(ctx.channel()), me); active = false; - } - catch (Exception ex) { + } catch (Exception ex) { ActiveMQClientLogger.LOGGER.errorCallingLifeCycleListener(ex); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java index a8c80c6..0b307ef 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java @@ -30,7 +30,6 @@ import io.netty.channel.ChannelPromise; import io.netty.channel.EventLoop; import io.netty.handler.ssl.SslHandler; import io.netty.util.concurrent.GenericFutureListener; - import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffers; import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException; @@ -71,8 +70,10 @@ public class NettyConnection implements Connection { private boolean ready = true; - /** if {@link #isWritable(ReadyListener)} returns false, we add a callback - * here for when the connection (or Netty Channel) becomes available again. */ + /** + * if {@link #isWritable(ReadyListener)} returns false, we add a callback + * here for when the connection (or Netty Channel) becomes available again. + */ private final Deque<ReadyListener> readyListeners = new LinkedList<>(); // Static -------------------------------------------------------- @@ -131,7 +132,6 @@ public class NettyConnection implements Connection { break; } - if (readyToCall == null) { readyToCall = new LinkedList<>(); } @@ -145,8 +145,7 @@ public class NettyConnection implements Connection { for (ReadyListener readyListener : readyToCall) { try { readyListener.readyForWriting(); - } - catch (Throwable logOnly) { + } catch (Throwable logOnly) { ActiveMQClientLogger.LOGGER.warn(logOnly.getMessage(), logOnly); } } @@ -158,8 +157,7 @@ public class NettyConnection implements Connection { if (channel != null) { try { channel.close(); - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQClientLogger.LOGGER.warn(e.getMessage(), e); } } @@ -196,8 +194,7 @@ public class NettyConnection implements Connection { //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeSSLAndChannel(sslHandler, channel, false); - } - else { + } else { eventLoop.execute(new Runnable() { @Override public void run() { @@ -236,8 +233,7 @@ public class NettyConnection implements Connection { batchBuffer = createTransportBuffer(BATCHING_BUFFER_SIZE); } - } - finally { + } finally { writeLock.release(); } } @@ -276,15 +272,13 @@ public class NettyConnection implements Connection { // If the batch buffer is full or it's flush param or not batched then flush the buffer buffer = batchBuffer; - } - else { + } else { return; } if (!batched || flush) { batchBuffer = null; - } - else { + } else { // Create a new buffer batchBuffer = ActiveMQBuffers.dynamicBuffer(BATCHING_BUFFER_SIZE); @@ -297,8 +291,7 @@ public class NettyConnection implements Connection { final ChannelPromise promise; if (flush || futureListener != null) { promise = channel.newPromise(); - } - else { + } else { promise = channel.voidPromise(); } @@ -307,12 +300,10 @@ public class NettyConnection implements Connection { if (!inEventLoop) { if (futureListener != null) { channel.writeAndFlush(buf, promise).addListener(futureListener); - } - else { + } else { channel.writeAndFlush(buf, promise); } - } - else { + } else { // create a task which will be picked up by the eventloop and trigger the write. // This is mainly needed as this method is triggered by different threads for the same channel. // if we not do this we may produce out of order writes. @@ -321,8 +312,7 @@ public class NettyConnection implements Connection { public void run() { if (futureListener != null) { channel.writeAndFlush(buf, promise).addListener(futureListener); - } - else { + } else { channel.writeAndFlush(buf, promise); } } @@ -342,18 +332,15 @@ public class NettyConnection implements Connection { } break; - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } } - } - finally { + } finally { writeLock.release(); } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } @@ -390,8 +377,7 @@ public class NettyConnection implements Connection { public TransportConfiguration getConnectorConfig() { if (configuration != null) { return new TransportConfiguration(NettyConnectorFactory.class.getName(), this.configuration); - } - else { + } else { return null; } } @@ -427,12 +413,10 @@ public class NettyConnection implements Connection { if (!inEventLoop && !sslCloseFuture.awaitUninterruptibly(10000)) { ActiveMQClientLogger.LOGGER.timeoutClosingSSL(); } - } - catch (Throwable t) { + } catch (Throwable t) { // ignore } - } - else { + } else { ChannelFuture closeFuture = channel.close(); if (!inEventLoop && !closeFuture.awaitUninterruptibly(10000)) { ActiveMQClientLogger.LOGGER.timeoutClosingNettyChannel(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index 49c936b..326fe27 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -86,8 +86,8 @@ import io.netty.util.AttributeKey; import io.netty.util.ResourceLeakDetector; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GlobalEventExecutor; -import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; import org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle; import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl; @@ -107,6 +107,7 @@ import org.jboss.logging.Logger; import static org.apache.activemq.artemis.utils.Base64.encodeBytes; public class NettyConnector extends AbstractConnector { + private static final Logger logger = Logger.getLogger(NettyConnector.class); // Constants ----------------------------------------------------- @@ -274,8 +275,7 @@ public class NettyConnector extends AbstractConnector { httpMaxClientIdleTime = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME, TransportConstants.DEFAULT_HTTP_CLIENT_IDLE_TIME, configuration); httpClientIdleScanPeriod = ConfigurationHelper.getLongProperty(TransportConstants.HTTP_CLIENT_IDLE_SCAN_PERIOD, TransportConstants.DEFAULT_HTTP_CLIENT_SCAN_PERIOD, configuration); httpRequiresSessionId = ConfigurationHelper.getBooleanProperty(TransportConstants.HTTP_REQUIRES_SESSION_ID, TransportConstants.DEFAULT_HTTP_REQUIRES_SESSION_ID, configuration); - } - else { + } else { httpMaxClientIdleTime = 0; httpClientIdleScanPeriod = -1; httpRequiresSessionId = false; @@ -311,8 +311,7 @@ public class NettyConnector extends AbstractConnector { enabledProtocols = ConfigurationHelper.getStringProperty(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, TransportConstants.DEFAULT_ENABLED_PROTOCOLS, configuration); verifyHost = ConfigurationHelper.getBooleanProperty(TransportConstants.VERIFY_HOST_PROP_NAME, TransportConstants.DEFAULT_VERIFY_HOST, configuration); - } - else { + } else { keyStoreProvider = TransportConstants.DEFAULT_KEYSTORE_PROVIDER; keyStorePath = TransportConstants.DEFAULT_KEYSTORE_PATH; keyStorePassword = TransportConstants.DEFAULT_KEYSTORE_PASSWORD; @@ -367,16 +366,14 @@ public class NettyConnector extends AbstractConnector { // Default to number of cores * 3 threadsToUse = Runtime.getRuntime().availableProcessors() * 3; - } - else { + } else { threadsToUse = this.nioRemotingThreads; } if (useNioGlobalWorkerPool) { channelClazz = NioSocketChannel.class; group = SharedNioEventLoopGroup.getInstance(threadsToUse); - } - else { + } else { channelClazz = NioSocketChannel.class; group = new NioEventLoopGroup(threadsToUse); } @@ -446,15 +443,13 @@ public class NettyConnector extends AbstractConnector { realTrustStorePassword = System.getProperty(ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME); } context = SSLSupport.createContext(realKeyStoreProvider, realKeyStorePath, realKeyStorePassword, realTrustStoreProvider, realTrustStorePath, realTrustStorePassword); - } - catch (Exception e) { + } catch (Exception e) { close(); IllegalStateException ise = new IllegalStateException("Unable to create NettyConnector for " + host + ":" + port); ise.initCause(e); throw ise; } - } - else { + } else { context = null; // Unused } @@ -471,8 +466,7 @@ public class NettyConnector extends AbstractConnector { SSLEngine engine; if (verifyHost) { engine = context.createSSLEngine(host, port); - } - else { + } else { engine = context.createSSLEngine(); } @@ -488,8 +482,7 @@ public class NettyConnector extends AbstractConnector { if (enabledCipherSuites != null) { try { engine.setEnabledCipherSuites(SSLSupport.parseCommaSeparatedListIntoArray(enabledCipherSuites)); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { ActiveMQClientLogger.LOGGER.invalidCipherSuite(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedCipherSuites())); throw e; } @@ -498,13 +491,11 @@ public class NettyConnector extends AbstractConnector { if (enabledProtocols != null) { try { engine.setEnabledProtocols(SSLSupport.parseCommaSeparatedListIntoArray(enabledProtocols)); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { ActiveMQClientLogger.LOGGER.invalidProtocol(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedProtocols())); throw e; } - } - else { + } else { engine.setEnabledProtocols(originalProtocols); } @@ -602,8 +593,7 @@ public class NettyConnector extends AbstractConnector { if (inet6Address.getScopeId() != 0) { try { remoteDestination = new InetSocketAddress(InetAddress.getByAddress(inet6Address.getAddress()), ((InetSocketAddress) remoteDestination).getPort()); - } - catch (UnknownHostException e) { + } catch (UnknownHostException e) { throw new IllegalArgumentException(e.getMessage()); } } @@ -617,13 +607,11 @@ public class NettyConnector extends AbstractConnector { SocketAddress localDestination; if (localAddress != null) { localDestination = new InetSocketAddress(localAddress, localPort); - } - else { + } else { localDestination = new InetSocketAddress(localPort); } future = bootstrap.connect(remoteDestination, localDestination); - } - else { + } else { future = bootstrap.connect(remoteDestination); } @@ -639,14 +627,12 @@ public class NettyConnector extends AbstractConnector { ChannelPipeline channelPipeline = ch.pipeline(); ActiveMQChannelHandler channelHandler = channelPipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; - } - else { + } else { ch.close().awaitUninterruptibly(); ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(handshakeFuture.cause()); return null; } - } - else { + } else { //handshakeFuture.setFailure(new SSLException("Handshake was not completed in 30 seconds")); ch.close().awaitUninterruptibly(); return null; @@ -688,13 +674,11 @@ public class NettyConnector extends AbstractConnector { ch.close().awaitUninterruptibly(); return null; } - } - catch (URISyntaxException e) { + } catch (URISyntaxException e) { ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(e); return null; } - } - else { + } else { ChannelPipeline channelPipeline = ch.pipeline(); ActiveMQChannelHandler channelHandler = channelPipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; @@ -705,8 +689,7 @@ public class NettyConnector extends AbstractConnector { NettyConnection conn = new NettyConnection(configuration, ch, connectionListener, !httpEnabled && batchDelay > 0, false); connectionListener.connectionCreated(null, conn, protocolManager); return conn; - } - else { + } else { Throwable t = future.cause(); if (t != null && !(t instanceof ConnectException)) { @@ -763,13 +746,11 @@ public class NettyConnector extends AbstractConnector { handshakeComplete = true; ActiveMQChannelHandler channelHandler = pipeline.get(ActiveMQChannelHandler.class); channelHandler.active = true; - } - else { + } else { ActiveMQClientLogger.LOGGER.httpHandshakeFailed(accept, expectedResponse); ctx.close(); } - } - else if (response.getStatus().code() == HttpResponseStatus.FORBIDDEN.code()) { + } else if (response.getStatus().code() == HttpResponseStatus.FORBIDDEN.code()) { ActiveMQClientLogger.LOGGER.httpUpgradeNotSupportedByRemoteAcceptor(); ctx.close(); } @@ -788,8 +769,7 @@ public class NettyConnector extends AbstractConnector { if (!latch.await(30000, TimeUnit.MILLISECONDS)) { return false; } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { return false; } return handshakeComplete; @@ -863,8 +843,7 @@ public class NettyConnector extends AbstractConnector { if (httpRequiresSessionId && !active) { if (handshaking) { handshaking = true; - } - else { + } else { if (!handShakeFuture.await(5000)) { throw new RuntimeException("Handshake failed after timeout"); } @@ -880,8 +859,7 @@ public class NettyConnector extends AbstractConnector { httpRequest.headers().add(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buf.readableBytes())); ctx.write(httpRequest, promise); lastSendTime = System.currentTimeMillis(); - } - else { + } else { ctx.write(msg, promise); lastSendTime = System.currentTimeMillis(); } @@ -958,7 +936,7 @@ public class NettyConnector extends AbstractConnector { @Override public void connectionReadyForWrites(Object connectionID, boolean ready) { - NettyConnection connection = (NettyConnection)connections.get(connectionID); + NettyConnection connection = (NettyConnection) connections.get(connectionID); if (connection != null) { connection.fireReady(ready); } @@ -1008,8 +986,7 @@ public class NettyConnector extends AbstractConnector { logger.debug(this + " host 1: " + host + " ip address: " + ip1 + " host 2: " + this.host + " ip address: " + ip2); result = ip1.equals(ip2); - } - catch (UnknownHostException e) { + } catch (UnknownHostException e) { ActiveMQClientLogger.LOGGER.error("Cannot resolve host", e); } @@ -1077,8 +1054,7 @@ public class NettyConnector extends AbstractConnector { digest.update(concat.getBytes(StandardCharsets.UTF_8)); final byte[] bytes = digest.digest(); return encodeBytes(bytes); - } - catch (NoSuchAlgorithmException e) { + } catch (NoSuchAlgorithmException e) { throw new IOException(e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java index b9b1a31..0750105 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java @@ -16,14 +16,6 @@ */ package org.apache.activemq.artemis.core.remoting.impl.netty; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.FutureListener; -import io.netty.util.concurrent.ImmediateEventExecutor; -import io.netty.util.concurrent.Promise; -import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl; -import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; - import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.ScheduledFuture; @@ -32,6 +24,14 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.FutureListener; +import io.netty.util.concurrent.ImmediateEventExecutor; +import io.netty.util.concurrent.Promise; +import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl; +import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; + public class SharedNioEventLoopGroup extends NioEventLoopGroup { private static SharedNioEventLoopGroup instance; @@ -58,8 +58,7 @@ public class SharedNioEventLoopGroup extends NioEventLoopGroup { if (f != null) { f.cancel(false); } - } - else { + } else { instance = new SharedNioEventLoopGroup(numThreads, AccessController.doPrivileged(new PrivilegedAction<ThreadFactory>() { @Override public ThreadFactory run() { @@ -95,8 +94,7 @@ public class SharedNioEventLoopGroup extends NioEventLoopGroup { public void operationComplete(Future future) throws Exception { if (future.isSuccess()) { terminationPromise.setSuccess(null); - } - else { + } else { terminationPromise.setFailure(future.cause()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java index 40aed3d..864bce7 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java @@ -291,8 +291,7 @@ public class TransportConstants { Version v = Version.identify().get("netty-transport"); if (v == null) { version = "unknown"; - } - else { + } else { version = v.artifactVersion(); } NETTY_VERSION = version; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java index d5e0fdc..8de3982 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java @@ -16,6 +16,11 @@ */ package org.apache.activemq.artemis.core.remoting.impl.ssl; +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -26,12 +31,6 @@ import java.security.KeyStore; import java.security.PrivilegedAction; import java.security.SecureRandom; -import javax.net.ssl.KeyManager; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; - import org.apache.activemq.artemis.utils.ClassloadingUtil; /** @@ -83,8 +82,7 @@ public class SSLSupport { final String trustStorePassword) throws Exception { if (trustStorePath == null && (trustStoreProvider == null || !"PKCS11".equals(trustStoreProvider.toUpperCase()))) { return null; - } - else { + } else { TrustManagerFactory trustMgrFactory; KeyStore trustStore = SSLSupport.loadKeystore(trustStoreProvider, trustStorePath, trustStorePassword); trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); @@ -104,13 +102,11 @@ public class SSLSupport { in = keystoreURL.openStream(); } ks.load(in, keystorePassword == null ? null : keystorePassword.toCharArray()); - } - finally { + } finally { if (in != null) { try { in.close(); - } - catch (IOException ignored) { + } catch (IOException ignored) { } } } @@ -122,8 +118,7 @@ public class SSLSupport { final String keystorePassword) throws Exception { if (keystorePath == null && (keyStoreProvider == null || !"PKCS11".equals(keyStoreProvider.toUpperCase()))) { return null; - } - else { + } else { KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); KeyStore ks = SSLSupport.loadKeystore(keyStoreProvider, keystorePath, keystorePassword); kmf.init(ks, keystorePassword == null ? null : keystorePassword.toCharArray()); @@ -138,13 +133,11 @@ public class SSLSupport { // First see if this is a URL try { return new URL(storePath); - } - catch (MalformedURLException e) { + } catch (MalformedURLException e) { File file = new File(storePath); if (file.exists() == true && file.isFile()) { return file.toURI().toURL(); - } - else { + } else { URL url = findResource(storePath); if (url != null) { return url; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java index 3185571..2efddfa 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/security/Role.java @@ -47,21 +47,10 @@ public class Role implements Serializable { private final boolean browse; public JsonObject toJson() { - return JsonLoader.createObjectBuilder() - .add("name", name) - .add("send", send) - .add("consume", consume) - .add("createDurableQueue", createDurableQueue) - .add("deleteDurableQueue", deleteDurableQueue) - .add("createNonDurableQueue", createNonDurableQueue) - .add("deleteNonDurableQueue", deleteNonDurableQueue) - .add("manage", manage) - .add("browse", browse) - .build(); + return JsonLoader.createObjectBuilder().add("name", name).add("send", send).add("consume", consume).add("createDurableQueue", createDurableQueue).add("deleteDurableQueue", deleteDurableQueue).add("createNonDurableQueue", createNonDurableQueue).add("deleteNonDurableQueue", deleteNonDurableQueue).add("manage", manage).add("browse", browse).build(); } /** - * @deprecated Use {@link #Role(String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean)} * @param name * @param send * @param consume @@ -70,6 +59,7 @@ public class Role implements Serializable { * @param createNonDurableQueue * @param deleteNonDurableQueue * @param manage + * @deprecated Use {@link #Role(String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean)} */ @Deprecated public Role(final String name, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/transaction/impl/XidImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/transaction/impl/XidImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/transaction/impl/XidImpl.java index 324797a..a191cbd 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/transaction/impl/XidImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/transaction/impl/XidImpl.java @@ -16,11 +16,10 @@ */ package org.apache.activemq.artemis.core.transaction.impl; +import javax.transaction.xa.Xid; import java.io.Serializable; import java.util.Arrays; -import javax.transaction.xa.Xid; - import org.apache.activemq.artemis.utils.Base64; /** http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/version/impl/VersionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/version/impl/VersionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/version/impl/VersionImpl.java index c8437e1..4ec3ed1 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/version/impl/VersionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/version/impl/VersionImpl.java @@ -144,8 +144,7 @@ public class VersionImpl implements Version, Serializable { if (other.versionName != null) { return false; } - } - else if (!versionName.equals(other.versionName)) { + } else if (!versionName.equals(other.versionName)) { return false; } return true; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/BytesMessageUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/BytesMessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/BytesMessageUtil.java index a8dce4a..3fbd705 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/BytesMessageUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/BytesMessageUtil.java @@ -140,35 +140,25 @@ public class BytesMessageUtil extends MessageUtil { } if (value instanceof String) { bytesWriteUTF(message, (String) value); - } - else if (value instanceof Boolean) { + } else if (value instanceof Boolean) { bytesWriteBoolean(message, (Boolean) value); - } - else if (value instanceof Character) { + } else if (value instanceof Character) { bytesWriteChar(message, (Character) value); - } - else if (value instanceof Byte) { + } else if (value instanceof Byte) { bytesWriteByte(message, (Byte) value); - } - else if (value instanceof Short) { + } else if (value instanceof Short) { bytesWriteShort(message, (Short) value); - } - else if (value instanceof Integer) { + } else if (value instanceof Integer) { bytesWriteInt(message, (Integer) value); - } - else if (value instanceof Long) { + } else if (value instanceof Long) { bytesWriteLong(message, (Long) value); - } - else if (value instanceof Float) { + } else if (value instanceof Float) { bytesWriteFloat(message, (Float) value); - } - else if (value instanceof Double) { + } else if (value instanceof Double) { bytesWriteDouble(message, (Double) value); - } - else if (value instanceof byte[]) { + } else if (value instanceof byte[]) { bytesWriteBytes(message, (byte[]) value); - } - else { + } else { return false; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java index be6568c..09b1902 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java @@ -53,17 +53,16 @@ public class MessageUtil { public static final SimpleString CONNECTION_ID_PROPERTY_NAME = new SimpleString("__AMQ_CID"); -// public static ActiveMQBuffer getBodyBuffer(Message message) { -// return message.getBodyBuffer(); -// } + // public static ActiveMQBuffer getBodyBuffer(Message message) { + // return message.getBodyBuffer(); + // } public static byte[] getJMSCorrelationIDAsBytes(Message message) { Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME); if (obj instanceof byte[]) { return (byte[]) obj; - } - else { + } else { return null; } } @@ -77,8 +76,7 @@ public class MessageUtil { if (ss != null) { return ss.toString(); - } - else { + } else { return null; } } @@ -94,8 +92,7 @@ public class MessageUtil { public static void setJMSCorrelationID(Message message, final String correlationID) { if (correlationID == null) { message.removeProperty(CORRELATIONID_HEADER_NAME); - } - else { + } else { message.putStringProperty(CORRELATIONID_HEADER_NAME, new SimpleString(correlationID)); } } @@ -103,8 +100,7 @@ public class MessageUtil { public static String getJMSCorrelationID(Message message) { try { return message.getStringProperty(CORRELATIONID_HEADER_NAME); - } - catch (ActiveMQPropertyConversionException e) { + } catch (ActiveMQPropertyConversionException e) { return null; } } @@ -117,8 +113,7 @@ public class MessageUtil { if (dest == null) { message.removeProperty(REPLYTO_HEADER_NAME); - } - else { + } else { message.putStringProperty(REPLYTO_HEADER_NAME, dest); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/StreamMessageUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/StreamMessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/StreamMessageUtil.java index dbba989..27e0da7 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/StreamMessageUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/StreamMessageUtil.java @@ -57,8 +57,7 @@ public class StreamMessageUtil extends MessageUtil { default: throw new IllegalStateException("Invalid conversion"); } - } - catch (NumberFormatException e) { + } catch (NumberFormatException e) { buff.readerIndex(index); throw e; } @@ -89,8 +88,7 @@ public class StreamMessageUtil extends MessageUtil { String str = buff.readNullableString(); if (str == null) { throw new NullPointerException("Invalid conversion"); - } - else { + } else { throw new IllegalStateException("Invalid conversion"); } default: @@ -200,8 +198,7 @@ public class StreamMessageUtil extends MessageUtil { public static Pair<Integer, Integer> streamReadBytes(ActiveMQBuffer buff, int remainingBytes, byte[] value) { if (remainingBytes == -1) { return new Pair<>(0, -1); - } - else if (remainingBytes == 0) { + } else if (remainingBytes == 0) { byte type = buff.readByte(); if (type != DataConstants.BYTES) { throw new IllegalStateException("Invalid conversion"); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java index e512adf..a9e12aa 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java @@ -65,12 +65,10 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { for (final FailureListener listener : listenersClone) { try { listener.connectionFailed(me, false, scaleDownTargetNodeID); - } - catch (ActiveMQInterruptedException interrupted) { + } catch (ActiveMQInterruptedException interrupted) { // this is an expected behaviour.. no warn or error here logger.debug("thread interrupted", interrupted); - } - catch (final Throwable t) { + } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others // from // executing @@ -85,8 +83,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { for (final CloseListener listener : listenersClone) { try { listener.connectionClosed(); - } - catch (final Throwable t) { + } catch (final Throwable t) { // Failure of one listener to execute shouldn't prevent others // from // executing @@ -107,7 +104,6 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { return transportConnection.getID(); } - public String getLocalAddress() { return transportConnection.getLocalAddress(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java index 253986f..39ecdf6 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/RemotingConnection.java @@ -186,13 +186,14 @@ public interface RemotingConnection extends BufferHandler { boolean isWritable(ReadyListener callback); /** - *if slow consumer is killed,send the msessage to client. + * if slow consumer is killed,send the msessage to client. */ void killMessage(SimpleString nodeID); /** * This will check if reconnects are supported on the protocol and configuration. * In case it's not supported a connection failure could remove messages right away from pending deliveries. + * * @return */ boolean isSupportReconnect(); @@ -201,6 +202,7 @@ public interface RemotingConnection extends BufferHandler { * Return true if the protocol supports flow control. * This is because in some cases we may need to hold message producers in cases like disk full. * If the protocol doesn't support it we trash the connection and throw exceptions. + * * @return */ boolean isSupportsFlowControl(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java index 4352d49..7ab0c40 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/Connection.java @@ -46,7 +46,7 @@ public interface Connection { /** * This will disable reading from the channel. * This is basically the same as blocking the reading. - * */ + */ void setAutoRead(boolean autoRead); /** @@ -131,4 +131,4 @@ public interface Connection { * @return */ boolean isUsingProtocolHandling(); -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/ConnectionLifeCycleListener.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/ConnectionLifeCycleListener.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/ConnectionLifeCycleListener.java index f702227..0c1fe5f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/ConnectionLifeCycleListener.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/remoting/ConnectionLifeCycleListener.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.spi.core.remoting; /** * A ConnectionLifeCycleListener is called by the remoting implementation to notify of connection events. + * * @deprecated use {@link ClientConnectionLifeCycleListener} instead. */ @Deprecated http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/connector/InVMTransportConfigurationSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/connector/InVMTransportConfigurationSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/connector/InVMTransportConfigurationSchema.java index 8e8b966..8b9a3fe 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/connector/InVMTransportConfigurationSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/connector/InVMTransportConfigurationSchema.java @@ -16,15 +16,15 @@ */ package org.apache.activemq.artemis.uri.schema.connector; -import org.apache.activemq.artemis.api.core.TransportConfiguration; -import org.apache.activemq.artemis.utils.uri.SchemaConstants; - import java.net.URI; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.core.TransportConfiguration; +import org.apache.activemq.artemis.utils.uri.SchemaConstants; + public class InVMTransportConfigurationSchema extends AbstractTransportConfigurationSchema { /* This is the same as org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.CONNECTIONS_ALLOWED, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/AbstractServerLocatorSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/AbstractServerLocatorSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/AbstractServerLocatorSchema.java index d0693d4..45f6e7d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/AbstractServerLocatorSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/AbstractServerLocatorSchema.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.uri.schema.serverLocator; +import java.net.URI; +import java.util.Map; + import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.URISchema; -import java.net.URI; -import java.util.Map; - public abstract class AbstractServerLocatorSchema extends URISchema<ServerLocator, String> { protected ConnectionOptions newConnectionOptions(URI uri, Map<String, String> query) throws Exception { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/InVMServerLocatorSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/InVMServerLocatorSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/InVMServerLocatorSchema.java index 2060ea9..1831c74 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/InVMServerLocatorSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/InVMServerLocatorSchema.java @@ -16,6 +16,10 @@ */ package org.apache.activemq.artemis.uri.schema.serverLocator; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.client.ActiveMQClient; import org.apache.activemq.artemis.api.core.client.ServerLocator; @@ -23,10 +27,6 @@ import org.apache.activemq.artemis.uri.schema.connector.InVMTransportConfigurati import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.SchemaConstants; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; - public class InVMServerLocatorSchema extends AbstractServerLocatorSchema { @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/JGroupsServerLocatorSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/JGroupsServerLocatorSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/JGroupsServerLocatorSchema.java index c8ee305..fb5b408 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/JGroupsServerLocatorSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/JGroupsServerLocatorSchema.java @@ -16,6 +16,10 @@ */ package org.apache.activemq.artemis.uri.schema.serverLocator; +import java.io.NotSerializableException; +import java.net.URI; +import java.util.Map; + import org.apache.activemq.artemis.api.core.BroadcastEndpointFactory; import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration; import org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory; @@ -25,10 +29,6 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator; import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.SchemaConstants; -import java.io.NotSerializableException; -import java.net.URI; -import java.util.Map; - public class JGroupsServerLocatorSchema extends AbstractServerLocatorSchema { @Override @@ -44,8 +44,7 @@ public class JGroupsServerLocatorSchema extends AbstractServerLocatorSchema { if (options.isHa()) { return ActiveMQClient.createServerLocatorWithHA(dcConfig); - } - else { + } else { return ActiveMQClient.createServerLocatorWithoutHA(dcConfig); } } @@ -57,11 +56,9 @@ public class JGroupsServerLocatorSchema extends AbstractServerLocatorSchema { String auth; if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) { auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName(); - } - else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) { + } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) { auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName(); - } - else { + } else { throw new NotSerializableException(endpoint + "not serializable"); } String query = BeanSupport.getData(null, bean, dgc, endpoint); @@ -75,8 +72,7 @@ public class JGroupsServerLocatorSchema extends AbstractServerLocatorSchema { BroadcastEndpointFactory endpointFactory; if (query.containsKey("file")) { endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(uri.getAuthority()); - } - else { + } else { endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName(uri.getAuthority()); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java index 4a2e2aa..9468a50 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/TCPServerLocatorSchema.java @@ -31,6 +31,7 @@ import org.apache.activemq.artemis.utils.uri.BeanSupport; import org.apache.activemq.artemis.utils.uri.SchemaConstants; public class TCPServerLocatorSchema extends AbstractServerLocatorSchema { + @Override public String getSchemaName() { return SchemaConstants.TCP; @@ -45,8 +46,7 @@ public class TCPServerLocatorSchema extends AbstractServerLocatorSchema { configurations.toArray(tcs); if (options.isHa()) { return ActiveMQClient.createServerLocatorWithHA(tcs); - } - else { + } else { return ActiveMQClient.createServerLocatorWithoutHA(tcs); } } @@ -109,8 +109,7 @@ public class TCPServerLocatorSchema extends AbstractServerLocatorSchema { if (query == null) { cb = new StringBuilder(); empty = true; - } - else { + } else { cb = new StringBuilder(query); empty = false; } @@ -119,8 +118,7 @@ public class TCPServerLocatorSchema extends AbstractServerLocatorSchema { if (entry.getValue() != null) { if (!empty) { cb.append("&"); - } - else { + } else { empty = false; } cb.append(BeanSupport.encodeURI(entry.getKey())); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/UDPServerLocatorSchema.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/UDPServerLocatorSchema.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/UDPServerLocatorSchema.java index 3498804..c3bc6ba 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/UDPServerLocatorSchema.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/uri/schema/serverLocator/UDPServerLocatorSchema.java @@ -50,8 +50,7 @@ public class UDPServerLocatorSchema extends AbstractServerLocatorSchema { if (options.isHa()) { return ActiveMQClient.createServerLocatorWithHA(dgc); - } - else { + } else { return ActiveMQClient.createServerLocatorWithoutHA(dgc); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ActiveMQBufferInputStream.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ActiveMQBufferInputStream.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ActiveMQBufferInputStream.java index 3cbaac9..25c7585 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ActiveMQBufferInputStream.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ActiveMQBufferInputStream.java @@ -52,8 +52,7 @@ public class ActiveMQBufferInputStream extends InputStream { if (remainingBytes() == 0) { return -1; - } - else { + } else { return bb.readByte() & 0xFF; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java index 6659424..1baa660 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/BufferHelper.java @@ -30,8 +30,7 @@ public class BufferHelper { public static int sizeOfNullableSimpleString(String str) { if (str == null) { return DataConstants.SIZE_BOOLEAN; - } - else { + } else { return DataConstants.SIZE_BOOLEAN + sizeOfSimpleString(str); } } @@ -76,8 +75,7 @@ public class BufferHelper { if (isNotNull) { return buffer.readBoolean(); - } - else { + } else { return null; } } @@ -117,8 +115,7 @@ public class BufferHelper { if (isNotNull) { return buffer.readLong(); - } - else { + } else { return null; } } @@ -143,8 +140,7 @@ public class BufferHelper { if (isNotNull) { return buffer.readInt(); - } - else { + } else { return null; } } @@ -154,8 +150,7 @@ public class BufferHelper { if (isNotNull) { return buffer.readDouble(); - } - else { + } else { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java index 166c0a7..a205c19 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java @@ -35,12 +35,10 @@ public class ConfigurationHelper { if (prop == null) { return def; - } - else { + } else { if (prop instanceof String == false) { return prop.toString(); - } - else { + } else { return (String) prop; } } @@ -54,18 +52,15 @@ public class ConfigurationHelper { if (prop == null) { return def; - } - else { + } else { // The resource adapter will aways send Strings, hence the conversion here if (prop instanceof String) { return Integer.valueOf((String) prop); - } - else if (prop instanceof Number == false) { + } else if (prop instanceof Number == false) { ActiveMQClientLogger.LOGGER.propertyNotInteger(propName, prop.getClass().getName()); return def; - } - else { + } else { return ((Number) prop).intValue(); } } @@ -80,18 +75,15 @@ public class ConfigurationHelper { if (prop == null) { return def; - } - else { + } else { // The resource adapter will aways send Strings, hence the conversion here if (prop instanceof String) { return Long.valueOf((String) prop); - } - else if (prop instanceof Number == false) { + } else if (prop instanceof Number == false) { ActiveMQClientLogger.LOGGER.propertyNotLong(propName, prop.getClass().getName()); return def; - } - else { + } else { return ((Number) prop).longValue(); } } @@ -106,18 +98,15 @@ public class ConfigurationHelper { if (prop == null) { return def; - } - else { + } else { // The resource adapter will aways send Strings, hence the conversion here if (prop instanceof String) { return Boolean.valueOf((String) prop); - } - else if (prop instanceof Boolean == false) { + } else if (prop instanceof Boolean == false) { ActiveMQClientLogger.LOGGER.propertyNotBoolean(propName, prop.getClass().getName()); return def; - } - else { + } else { return (Boolean) prop; } } @@ -188,15 +177,13 @@ public class ConfigurationHelper { SensitiveDataCodec<String> codec = null; try { codec = PasswordMaskingUtil.getCodec(classImpl); - } - catch (ActiveMQException e1) { + } catch (ActiveMQException e1) { throw ActiveMQClientMessageBundle.BUNDLE.failedToGetDecoder(e1); } try { return codec.decode(value); - } - catch (Exception e) { + } catch (Exception e) { throw ActiveMQClientMessageBundle.BUNDLE.errordecodingPassword(e); } } @@ -208,8 +195,7 @@ public class ConfigurationHelper { Object prop = props.get(name); if (prop == null) { return def; - } - else { + } else { String value = prop.toString(); return Double.parseDouble(value); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/DeflaterReader.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/DeflaterReader.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/DeflaterReader.java index 028720f..4142d27 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/DeflaterReader.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/DeflaterReader.java @@ -81,28 +81,24 @@ public class DeflaterReader extends InputStream { deflater.end(); compressDone = true; break; - } - else if (deflater.needsInput()) { + } else if (deflater.needsInput()) { // read some data from inputstream int m = input.read(readBuffer); if (m == -1) { deflater.finish(); isFinished = true; - } - else { + } else { if (bytesRead != null) { bytesRead.addAndGet(m); } deflater.setInput(readBuffer, 0, m); } - } - else { + } else { deflater.finish(); isFinished = true; } - } - else { + } else { read += n; offset += n; len -= n; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/FutureLatch.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/FutureLatch.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/FutureLatch.java index c7284df..a5ee1ce 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/FutureLatch.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/FutureLatch.java @@ -36,8 +36,7 @@ public class FutureLatch implements Runnable { public boolean await(final long timeout) { try { return latch.await(timeout, TimeUnit.MILLISECONDS); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { return false; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterReader.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterReader.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterReader.java index db98281..ff43a56 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterReader.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterReader.java @@ -55,8 +55,7 @@ public class InflaterReader extends InputStream { return -1; } pointer = 0; - } - catch (DataFormatException e) { + } catch (DataFormatException e) { IOException e2 = new IOException(e.getMessage()); e2.initCause(e); throw e2; @@ -87,16 +86,14 @@ public class InflaterReader extends InputStream { if (n == 0) { if (inflater.finished()) { break; - } - else if (inflater.needsInput()) { + } else if (inflater.needsInput()) { //feeding int m = input.read(inputBuffer); if (m == -1) { //it shouldn't be here, throw exception throw new DataFormatException("Input is over while inflater still expecting data"); - } - else { + } else { //feed the data in inflater.setInput(inputBuffer, 0, m); n = inflater.inflate(buf, offset, len); @@ -106,13 +103,11 @@ public class InflaterReader extends InputStream { len -= n; } } - } - else { + } else { //it shouldn't be here, throw throw new DataFormatException("Inflater is neither finished nor needing input."); } - } - else { + } else { read += n; offset += n; len -= n; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterWriter.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterWriter.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterWriter.java index 767ef6c..2921276 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterWriter.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/InflaterWriter.java @@ -58,8 +58,7 @@ public class InflaterWriter extends OutputStream { writePointer = 0; try { doWrite(); - } - catch (DataFormatException e) { + } catch (DataFormatException e) { IOException ie = new IOException("Error decompressing data"); ie.initCause(e); throw ie; @@ -78,8 +77,7 @@ public class InflaterWriter extends OutputStream { n = inflater.inflate(outputBuffer); } output.close(); - } - catch (DataFormatException e) { + } catch (DataFormatException e) { IOException io = new IOException(e.getMessage()); io.initCause(e); throw io; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JNDIUtil.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JNDIUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JNDIUtil.java index bbdaaff..83a1510 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JNDIUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JNDIUtil.java @@ -16,13 +16,12 @@ */ package org.apache.activemq.artemis.utils; -import java.util.StringTokenizer; - import javax.naming.Binding; import javax.naming.Context; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; +import java.util.StringTokenizer; public class JNDIUtil { // Constants ----------------------------------------------------- @@ -44,8 +43,7 @@ public class JNDIUtil { } crtContext = (Context) o; continue; - } - catch (NameNotFoundException e) { + } catch (NameNotFoundException e) { // OK } crtContext = crtContext.createSubcontext(tok); @@ -83,8 +81,7 @@ public class JNDIUtil { boolean failed = false; try { context.rebind(name, o); - } - catch (Exception ignored) { + } catch (Exception ignored) { failed = true; } if (failed) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java index c2f9216..dea1d4f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java @@ -37,16 +37,18 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Map; -/** This is to make sure we use the proper classLoader to load JSon libraries. - * This is equivalent to using {@link javax.json.Json} */ +/** + * This is to make sure we use the proper classLoader to load JSon libraries. + * This is equivalent to using {@link javax.json.Json} + */ public class JsonLoader { private static final JsonProvider provider; + static { provider = loadProvider(); } - private static JsonProvider loadProvider() { return AccessController.doPrivileged(new PrivilegedAction<JsonProvider>() { @Override @@ -55,8 +57,7 @@ public class JsonLoader { try { Thread.currentThread().setContextClassLoader(JsonLoader.class.getClassLoader()); return JsonProvider.provider(); - } - finally { + } finally { Thread.currentThread().setContextClassLoader(originalLoader); } } @@ -64,8 +65,6 @@ public class JsonLoader { } - - public static JsonParser createParser(Reader reader) { return provider.createParser(reader); } @@ -126,5 +125,4 @@ public class JsonLoader { return provider.createBuilderFactory(config); } - } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java index 4262274..f0d2945 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java @@ -58,8 +58,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { if (size == 0) { tail = node; - } - else { + } else { // Need to set the previous element on the former head node.next.prev = node; } @@ -71,8 +70,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { public void addTail(E e) { if (size == 0) { addHead(e); - } - else { + } else { Node<E> node = new Node<>(e); node.prev = tail; @@ -93,8 +91,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { removeAfter(head); return ret.val; - } - else { + } else { return null; } } @@ -281,16 +278,14 @@ public class LinkedListImpl<E> implements LinkedList<E> { if (e != null) { return e.val; - } - else { + } else { if (canAdvance()) { advance(); e = getNode(); return e.val; - } - else { + } else { throw new NoSuchElementException(); } } @@ -301,8 +296,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { advance(); e = getNode(); - } - else { + } else { throw new NoSuchElementException(); } } @@ -338,16 +332,14 @@ public class LinkedListImpl<E> implements LinkedList<E> { if (current == node) { if (canAdvance()) { advance(); - } - else { + } else { if (current.prev != head) { current.iterCount--; current = current.prev; current.iterCount++; - } - else { + } else { current = null; } } @@ -365,8 +357,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { if (current != null) { return current; - } - else { + } else { return null; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java ---------------------------------------------------------------------- diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java index b3e47cc..ed2ceb2 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java @@ -16,10 +16,10 @@ */ package org.apache.activemq.artemis.utils; -import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; - import java.lang.ref.WeakReference; +import org.apache.activemq.artemis.core.client.ActiveMQClientLogger; + public class MemorySize { private static final int numberOfObjects = 10000; @@ -37,8 +37,7 @@ public class MemorySize { if (arch != null) { is64bit = arch.contains("64"); } - } - catch (Exception e) { + } catch (Exception e) { // Ignore } @@ -111,8 +110,7 @@ public class MemorySize { System.gc(); try { Thread.sleep(500); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { } } }
