http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index c8a6966..cc06603 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -156,8 +156,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (enableWildCardRouting) { addressManager = new WildcardAddressManager(this); - } - else { + } else { addressManager = new SimpleAddressManager(this); } @@ -480,8 +479,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (binding.getType() == BindingType.LOCAL_QUEUE) { managementService.unregisterQueue(uniqueName, binding.getAddress()); - } - else if (binding.getType() == BindingType.DIVERT) { + } else if (binding.getType() == BindingType.DIVERT) { managementService.unregisterDivert(uniqueName); } @@ -500,8 +498,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (binding.getFilter() == null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, null); - } - else { + } else { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, binding.getFilter().getFilterString()); } @@ -565,32 +562,34 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } @Override - public RoutingStatus route(final ServerMessage message, QueueCreator queueCreator, final boolean direct) throws Exception { + public RoutingStatus route(final ServerMessage message, + QueueCreator queueCreator, + final boolean direct) throws Exception { return route(message, queueCreator, (Transaction) null, direct); } @Override public RoutingStatus route(final ServerMessage message, - QueueCreator queueCreator, - final Transaction tx, - final boolean direct) throws Exception { + QueueCreator queueCreator, + final Transaction tx, + final boolean direct) throws Exception { return route(message, queueCreator, new RoutingContextImpl(tx), direct); } @Override public RoutingStatus route(final ServerMessage message, - final QueueCreator queueCreator, - final Transaction tx, - final boolean direct, - final boolean rejectDuplicates) throws Exception { + final QueueCreator queueCreator, + final Transaction tx, + final boolean direct, + final boolean rejectDuplicates) throws Exception { return route(message, queueCreator, new RoutingContextImpl(tx), direct, rejectDuplicates); } @Override public RoutingStatus route(final ServerMessage message, - final QueueCreator queueCreator, - final RoutingContext context, - final boolean direct) throws Exception { + final QueueCreator queueCreator, + final RoutingContext context, + final boolean direct) throws Exception { return route(message, queueCreator, context, direct, true); } @@ -638,8 +637,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (bindings != null) { bindings.route(message, context); - } - else { + } else { // this is a debug and not warn because this could be a regular scenario on publish-subscribe queues (or topic subscriptions on JMS) if (logger.isDebugEnabled()) { logger.debug("Couldn't find any bindings for address=" + address + " on message=" + message); @@ -669,8 +667,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (dlaAddress == null) { result = RoutingStatus.NO_BINDINGS; ActiveMQServerLogger.LOGGER.noDLA(address); - } - else { + } else { message.setOriginalHeaders(message, null, false); message.setAddress(dlaAddress); @@ -678,8 +675,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding route(message, null, context.getTransaction(), false); result = RoutingStatus.NO_BINDINGS_DLA; } - } - else { + } else { result = RoutingStatus.NO_BINDINGS; if (logger.isDebugEnabled()) { @@ -690,16 +686,13 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding ((LargeServerMessage) message).deleteFile(); } } - } - else { + } else { try { processRoute(message, context, direct); - } - catch (ActiveMQAddressFullException e) { + } catch (ActiveMQAddressFullException e) { if (startedTX.get()) { context.getTransaction().rollback(); - } - else if (context.getTransaction() != null) { + } else if (context.getTransaction() != null) { context.getTransaction().markAsRollbackOnly(e); } throw e; @@ -744,8 +737,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (tx == null) { queue.reload(reference); - } - else { + } else { List<MessageReference> refs = new ArrayList<>(1); refs.add(reference); @@ -1033,8 +1025,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (durableRefCount == 1) { if (tx != null) { storageManager.storeMessageTransactional(tx.getID(), message); - } - else { + } else { storageManager.storeMessage(message); } @@ -1047,16 +1038,14 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding storageManager.storeReferenceTransactional(tx.getID(), queue.getID(), message.getMessageID()); tx.setContainsPersistent(); - } - else { + } else { storageManager.storeReference(queue.getID(), message.getMessageID(), !iter.hasNext()); } if (message.containsProperty(Message.HDR_SCHEDULED_DELIVERY_TIME)) { if (tx != null) { storageManager.updateScheduledDeliveryTimeTransactional(tx.getID(), reference); - } - else { + } else { storageManager.updateScheduledDeliveryTime(reference); } } @@ -1068,8 +1057,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (tx != null) { tx.addOperation(new AddOperation(refs)); - } - else { + } else { // This will use the same thread if there are no pending operations // avoiding a context switch on this case storageManager.afterCompleteOperations(new IOCallback() { @@ -1096,8 +1084,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding if (largeServerMessage.getPendingRecordID() >= 0) { if (tx == null) { storageManager.confirmPendingLargeMessage(largeServerMessage.getPendingRecordID()); - } - else { + } else { storageManager.confirmPendingLargeMessageTX(tx, largeServerMessage.getMessageID(), largeServerMessage.getPendingRecordID()); } largeServerMessage.setPendingRecordID(-1); @@ -1121,8 +1108,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding delivery.addQueues(entry.getValue().getDurableQueues()); delivery.addQueues(entry.getValue().getNonDurableQueues()); - } - else { + } else { List<Queue> durableQueues = entry.getValue().getDurableQueues(); List<Queue> nonDurableQueues = entry.getValue().getNonDurableQueues(); @@ -1175,8 +1161,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding } message.removeProperty(MessageImpl.HDR_BRIDGE_DUPLICATE_ID); - } - else { + } else { // if used BridgeDuplicate, it's not going to use the regular duplicate // since this will would break redistribution (re-setting the duplicateId) byte[] duplicateIDBytes = message.getDuplicateIDBytes(); @@ -1261,10 +1246,10 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private final class Reaper extends ActiveMQScheduledComponent { Reaper(ScheduledExecutorService scheduledExecutorService, - Executor executor, - long checkPeriod, - TimeUnit timeUnit, - boolean onDemand) { + Executor executor, + long checkPeriod, + TimeUnit timeUnit, + boolean onDemand) { super(scheduledExecutorService, executor, checkPeriod, timeUnit, onDemand); } @@ -1287,8 +1272,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding for (Queue queue : queues) { try { queue.expireReferences(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorExpiringMessages(e); } }
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java index bbfdcc1..9f26b0b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java @@ -37,6 +37,7 @@ import org.jboss.logging.Logger; * A simple address manager that maintains the addresses and bindings. */ public class SimpleAddressManager implements AddressManager { + private static final Logger logger = Logger.getLogger(Page.class); /** http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java index 7609355..7838e93 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java @@ -94,8 +94,7 @@ public class WildcardAddressManager extends SimpleAddressManager { for (Address destAdd : add.getLinkedAddresses()) { super.addMappingInternal(destAdd.getAddress(), binding); } - } - else { + } else { for (Address destAdd : add.getLinkedAddresses()) { Bindings bindings = super.getBindingsForRoutingAddress(destAdd.getAddress()); for (Binding b : bindings.getBindings()) { @@ -141,8 +140,7 @@ public class WildcardAddressManager extends SimpleAddressManager { Address actualAddress; if (add.containsWildCard()) { actualAddress = wildCardAddresses.get(address); - } - else { + } else { actualAddress = addresses.get(address); } return actualAddress != null ? actualAddress : add; @@ -153,8 +151,7 @@ public class WildcardAddressManager extends SimpleAddressManager { Address actualAddress; if (add.containsWildCard()) { actualAddress = wildCardAddresses.get(address); - } - else { + } else { actualAddress = addresses.get(address); } if (actualAddress == null) { @@ -168,8 +165,7 @@ public class WildcardAddressManager extends SimpleAddressManager { actualAddress.addLinkedAddress(destAdd); } } - } - else { + } else { for (Address destAdd : wildCardAddresses.values()) { if (actualAddress.matches(destAdd)) { destAdd.addLinkedAddress(actualAddress); @@ -184,8 +180,7 @@ public class WildcardAddressManager extends SimpleAddressManager { private void addAddress(final SimpleString address, final Address actualAddress) { if (actualAddress.containsWildCard()) { wildCardAddresses.put(address, actualAddress); - } - else { + } else { addresses.put(address, actualAddress); } } @@ -209,8 +204,7 @@ public class WildcardAddressManager extends SimpleAddressManager { private void removeAddress(final Address add) { if (add.containsWildCard()) { wildCardAddresses.remove(add.getAddress()); - } - else { + } else { addresses.remove(add.getAddress()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java index b4d8de5..340861b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java @@ -121,14 +121,11 @@ public class ProtocolHandler { ctx.pipeline().remove(this); ctx.pipeline().remove("http-handler"); ctx.fireChannelRead(msg); - } - // HORNETQ-1391 - else if (upgrade != null && upgrade.equalsIgnoreCase(NettyConnector.ACTIVEMQ_REMOTING)) { + } else if (upgrade != null && upgrade.equalsIgnoreCase(NettyConnector.ACTIVEMQ_REMOTING)) { // HORNETQ-1391 // Send the response and close the connection if necessary. ctx.writeAndFlush(new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN)).addListener(ChannelFutureListener.CLOSE); } - } - else { + } else { super.channelRead(ctx, msg); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java index 4457808..2869e38 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java @@ -16,43 +16,18 @@ */ package org.apache.activemq.artemis.core.protocol; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CLUSTER_CONNECT; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CLUSTER_CONNECT_REPLY; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.NODE_ANNOUNCE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.BACKUP_REQUEST; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.BACKUP_REQUEST_RESPONSE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.QUORUM_VOTE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.QUORUM_VOTE_REPLY; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE_V2; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_SEND; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE; -import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SCALEDOWN_ANNOUNCEMENT; - import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.core.protocol.core.Packet; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupReplicationStartFailedMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRequestMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupResponseMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectReplyMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NodeAnnounceMessage; -import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRequestMessage; -import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupResponseMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteReplyMessage; -import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddTXMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationCommitMessage; @@ -61,6 +36,7 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.Replicatio import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage; @@ -73,6 +49,30 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSen import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage; import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.BACKUP_REQUEST; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.BACKUP_REQUEST_RESPONSE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CLUSTER_CONNECT; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.CLUSTER_CONNECT_REPLY; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.NODE_ANNOUNCE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.QUORUM_VOTE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.QUORUM_VOTE_REPLY; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_APPEND_TX; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_COMMIT_ROLLBACK; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_DELETE_TX; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_END; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_EVENT; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PAGE_WRITE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_PREPARE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.REPLICATION_RESPONSE_V2; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SCALEDOWN_ANNOUNCEMENT; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_SEND; +import static org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl.SESS_SEND_LARGE; + public class ServerPacketDecoder extends ClientPacketDecoder { private static final long serialVersionUID = 3348673114388400766L; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java index f12fd0b..b52534c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/ServerSessionPacketHandler.java @@ -145,8 +145,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { if (conn instanceof NettyConnection) { direct = ((NettyConnection) conn).isDirectDeliver(); - } - else { + } else { direct = false; } } @@ -164,8 +163,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { try { session.close(true); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorClosingSession(e); } @@ -177,8 +175,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { try { session.close(false); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorClosingSession(e); } } @@ -215,8 +212,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { QueueQueryResult queueQueryResult = session.executeQueueQuery(request.getQueueName()); if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) { response = new SessionQueueQueryResponseMessage_V2(queueQueryResult); - } - else { + } else { response = new SessionQueueQueryResponseMessage(queueQueryResult); } } @@ -254,8 +250,7 @@ public class ServerSessionPacketHandler implements ChannelHandler { QueueQueryResult result = session.executeQueueQuery(request.getQueueName()); if (channel.supports(PacketImpl.SESS_QUEUEQUERY_RESP_V2)) { response = new SessionQueueQueryResponseMessage_V2(result); - } - else { + } else { response = new SessionQueueQueryResponseMessage(result); } break; @@ -266,11 +261,9 @@ public class ServerSessionPacketHandler implements ChannelHandler { BindingQueryResult result = session.executeBindingQuery(request.getAddress()); if (channel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V3)) { response = new SessionBindingQueryResponseMessage_V3(result.isExists(), result.getQueueNames(), result.isAutoCreateJmsQueues(), result.isAutoCreateJmsTopics()); - } - else if (channel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V2)) { + } else if (channel.supports(PacketImpl.SESS_BINDINGQUERY_RESP_V2)) { response = new SessionBindingQueryResponseMessage_V2(result.isExists(), result.getQueueNames(), result.isAutoCreateJmsQueues()); - } - else { + } else { response = new SessionBindingQueryResponseMessage(result.isExists(), result.getQueueNames()); } break; @@ -480,63 +473,52 @@ public class ServerSessionPacketHandler implements ChannelHandler { SessionUniqueAddMetaDataMessage message = (SessionUniqueAddMetaDataMessage) packet; if (session.addUniqueMetaData(message.getKey(), message.getData())) { response = new NullResponseMessage(); - } - else { + } else { response = new ActiveMQExceptionMessage(ActiveMQMessageBundle.BUNDLE.duplicateMetadata(message.getKey(), message.getData())); } break; } } - } - catch (ActiveMQIOErrorException e) { + } catch (ActiveMQIOErrorException e) { getSession().markTXFailed(e); if (requiresResponse) { logger.debug("Sending exception to client", e); response = new ActiveMQExceptionMessage(e); - } - else { + } else { ActiveMQServerLogger.LOGGER.caughtException(e); } - } - catch (ActiveMQXAException e) { + } catch (ActiveMQXAException e) { if (requiresResponse) { logger.debug("Sending exception to client", e); response = new SessionXAResponseMessage(true, e.errorCode, e.getMessage()); - } - else { + } else { ActiveMQServerLogger.LOGGER.caughtXaException(e); } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { if (requiresResponse) { logger.debug("Sending exception to client", e); response = new ActiveMQExceptionMessage(e); - } - else { + } else { if (e.getType() == ActiveMQExceptionType.QUEUE_EXISTS) { logger.debug("Caught exception", e); - } - else { + } else { ActiveMQServerLogger.LOGGER.caughtException(e); } } - } - catch (Throwable t) { + } catch (Throwable t) { getSession().markTXFailed(t); if (requiresResponse) { ActiveMQServerLogger.LOGGER.warn("Sending unexpected exception to the client", t); ActiveMQException activeMQInternalErrorException = new ActiveMQInternalErrorException(); activeMQInternalErrorException.initCause(t); response = new ActiveMQExceptionMessage(activeMQInternalErrorException); - } - else { + } else { ActiveMQServerLogger.LOGGER.caughtException(t); } } sendResponse(packet, response, flush, closeChannel); - } - finally { + } finally { storageManager.clearContext(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java index 59120d3..149c011 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQPacketHandler.java @@ -138,8 +138,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { if (connection.getClientVersion() == 0) { connection.setClientVersion(request.getVersion()); - } - else if (connection.getClientVersion() != request.getVersion()) { + } else if (connection.getClientVersion() != request.getVersion()) { ActiveMQServerLogger.LOGGER.incompatibleVersionAfterConnect(request.getVersion(), connection.getClientVersion()); } @@ -151,8 +150,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { activeMQPrincipal = connection.getDefaultActiveMQPrincipal(); } - ServerSession session = server.createSession(request.getName(), activeMQPrincipal == null ? request.getUsername() : activeMQPrincipal.getUserName(), activeMQPrincipal == null ? request.getPassword() : activeMQPrincipal.getPassword(), request.getMinLargeMessageSize(), connection, request.isAutoCommitSends(), request.isAutoCommitAcks(), request.isPreAcknowledge(), request.isXA(), request.getDefaultAddress(), - new CoreSessionCallback(request.getName(), protocolManager, channel, connection), true); + ServerSession session = server.createSession(request.getName(), activeMQPrincipal == null ? request.getUsername() : activeMQPrincipal.getUserName(), activeMQPrincipal == null ? request.getPassword() : activeMQPrincipal.getPassword(), request.getMinLargeMessageSize(), connection, request.isAutoCommitSends(), request.isAutoCommitAcks(), request.isPreAcknowledge(), request.isXA(), request.getDefaultAddress(), new CoreSessionCallback(request.getName(), protocolManager, channel, connection), true); ServerSessionPacketHandler handler = new ServerSessionPacketHandler(session, server.getStorageManager(), channel); channel.setHandler(handler); @@ -161,19 +159,16 @@ public class ActiveMQPacketHandler implements ChannelHandler { protocolManager.addSessionHandler(request.getName(), handler); response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion()); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { if (e.getType() == ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS) { incompatibleVersion = true; logger.debug("Sending ActiveMQException after Incompatible client", e); - } - else { + } else { ActiveMQServerLogger.LOGGER.failedToCreateSession(e); } response = new ActiveMQExceptionMessage(e); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToCreateSession(e); response = new ActiveMQExceptionMessage(new ActiveMQInternalErrorException()); @@ -184,8 +179,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { // are not compatible if (incompatibleVersion) { channel1.sendAndFlush(response); - } - else { + } else { channel1.send(response); } } @@ -206,8 +200,7 @@ public class ActiveMQPacketHandler implements ChannelHandler { // HORNETQ-720 XXX ataylor? if (/*!server.checkActivate() || */ sessionHandler == null) { response = new ReattachSessionResponseMessage(-1, false); - } - else { + } else { if (sessionHandler.getChannel().getConfirmationWindowSize() == -1) { // Even though session exists, we can't reattach since confi window size == -1, // i.e. we don't have a resend cache for commands, so we just close the old session @@ -219,16 +212,14 @@ public class ActiveMQPacketHandler implements ChannelHandler { sessionHandler.close(); response = new ReattachSessionResponseMessage(-1, false); - } - else { + } else { // Reconnect the channel to the new connection int serverLastConfirmedCommandID = sessionHandler.transferConnection(connection, request.getLastConfirmedCommandID()); response = new ReattachSessionResponseMessage(serverLastConfirmedCommandID, true); } } - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToReattachSession(e); response = new ActiveMQExceptionMessage(new ActiveMQInternalErrorException()); @@ -240,9 +231,8 @@ public class ActiveMQPacketHandler implements ChannelHandler { private void handleCreateQueue(final CreateQueueMessage request) { try { server.createQueue(request.getAddress(), request.getQueueName(), request.getFilterString(), request.isDurable(), request.isTemporary()); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToHandleCreateQueue(e); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java index 69db679..3fb642a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java @@ -236,8 +236,7 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> { // Just send a ping back channel0.send(packet); - } - else if (packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY || packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY_V2) { + } else if (packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY || packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY_V2) { SubscribeClusterTopologyUpdatesMessage msg = (SubscribeClusterTopologyUpdatesMessage) packet; if (packet.getType() == PacketImpl.SUBSCRIBE_TOPOLOGY_V2) { @@ -259,17 +258,14 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> { public void run() { if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V3)) { channel0.send(new ClusterTopologyChangeMessage_V3(topologyMember.getUniqueEventID(), nodeID, topologyMember.getBackupGroupName(), topologyMember.getScaleDownGroupName(), connectorPair, last)); - } - else if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { + } else if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { channel0.send(new ClusterTopologyChangeMessage_V2(topologyMember.getUniqueEventID(), nodeID, topologyMember.getBackupGroupName(), connectorPair, last)); - } - else { + } else { channel0.send(new ClusterTopologyChangeMessage(nodeID, connectorPair, last)); } } }); - } - catch (RejectedExecutionException ignored) { + } catch (RejectedExecutionException ignored) { // this could happen during a shutdown and we don't care, if we lost a nodeDown during a shutdown // what can we do anyways? } @@ -287,14 +283,12 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> { public void run() { if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { channel0.send(new ClusterTopologyChangeMessage_V2(uniqueEventID, nodeID)); - } - else { + } else { channel0.send(new ClusterTopologyChangeMessage(nodeID)); } } }); - } - catch (RejectedExecutionException ignored) { + } catch (RejectedExecutionException ignored) { // this could happen during a shutdown and we don't care, if we lost a nodeDown during a shutdown // what can we do anyways? } @@ -315,8 +309,7 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> { acceptorUsed.getClusterConnection().removeClusterTopologyListener(listener); } }); - } - else { + } else { // if not clustered, we send a single notification to the client containing the node-id where the server is connected to // This is done this way so Recovery discovery could also use the node-id for non-clustered setups entry.connectionExecutor.execute(new Runnable() { @@ -326,8 +319,7 @@ public class CoreProtocolManager implements ProtocolManager<Interceptor> { Pair<TransportConfiguration, TransportConfiguration> emptyConfig = new Pair<>(null, null); if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { channel0.send(new ClusterTopologyChangeMessage_V2(System.currentTimeMillis(), nodeId, null, emptyConfig, true)); - } - else { + } else { channel0.send(new ClusterTopologyChangeMessage(nodeId, emptyConfig, true)); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreSessionCallback.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreSessionCallback.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreSessionCallback.java index f4d69d1..e35771e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreSessionCallback.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreSessionCallback.java @@ -44,7 +44,10 @@ public final class CoreSessionCallback implements SessionCallback { private String name; - public CoreSessionCallback(String name, ProtocolManager protocolManager, Channel channel, RemotingConnection connection) { + public CoreSessionCallback(String name, + ProtocolManager protocolManager, + Channel channel, + RemotingConnection connection) { this.name = name; this.protocolManager = protocolManager; this.channel = channel; @@ -62,7 +65,11 @@ public final class CoreSessionCallback implements SessionCallback { } @Override - public int sendLargeMessage(MessageReference ref, ServerMessage message, ServerConsumer consumer, long bodySize, int deliveryCount) { + public int sendLargeMessage(MessageReference ref, + ServerMessage message, + ServerConsumer consumer, + long bodySize, + int deliveryCount) { Packet packet = new SessionReceiveLargeMessage(consumer.getID(), message, bodySize, deliveryCount); channel.send(packet); @@ -130,8 +137,7 @@ public final class CoreSessionCallback implements SessionCallback { public void disconnect(ServerConsumer consumerId, String queueName) { if (channel.supports(PacketImpl.DISCONNECT_CONSUMER)) { channel.send(new DisconnectConsumerMessage(consumerId.getID())); - } - else { + } else { ActiveMQServerLogger.LOGGER.warnDisconnectOldClient(queueName); } } @@ -142,4 +148,4 @@ public final class CoreSessionCallback implements SessionCallback { // as the flow control is done by activemq return true; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java index f444f68..8b61fcc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java @@ -110,20 +110,17 @@ public final class BackupRegistrationMessage extends PacketImpl { if (clusterPassword == null) { if (other.clusterPassword != null) return false; - } - else if (!clusterPassword.equals(other.clusterPassword)) + } else if (!clusterPassword.equals(other.clusterPassword)) return false; if (clusterUser == null) { if (other.clusterUser != null) return false; - } - else if (!clusterUser.equals(other.clusterUser)) + } else if (!clusterUser.equals(other.clusterUser)) return false; if (connector == null) { if (other.connector != null) return false; - } - else if (!connector.equals(other.connector)) + } else if (!connector.equals(other.connector)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java index 714c21f..074e7b4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/NodeAnnounceMessage.java @@ -114,15 +114,13 @@ public class NodeAnnounceMessage extends PacketImpl { if (connector != null) { buffer.writeBoolean(true); connector.encode(buffer); - } - else { + } else { buffer.writeBoolean(false); } if (backupConnector != null) { buffer.writeBoolean(true); backupConnector.encode(buffer); - } - else { + } else { buffer.writeBoolean(false); } buffer.writeNullableString(scaleDownGroupName); @@ -189,16 +187,14 @@ public class NodeAnnounceMessage extends PacketImpl { if (other.backupConnector != null) { return false; } - } - else if (!backupConnector.equals(other.backupConnector)) { + } else if (!backupConnector.equals(other.backupConnector)) { return false; } if (connector == null) { if (other.connector != null) { return false; } - } - else if (!connector.equals(other.connector)) { + } else if (!connector.equals(other.connector)) { return false; } if (currentEventID != other.currentEventID) { @@ -208,11 +204,9 @@ public class NodeAnnounceMessage extends PacketImpl { if (other.nodeID != null) { return false; } - } - else if (!nodeID.equals(other.nodeID)) { + } else if (!nodeID.equals(other.nodeID)) { return false; - } - else if (!scaleDownGroupName.equals(other.scaleDownGroupName)) { + } else if (!scaleDownGroupName.equals(other.scaleDownGroupName)) { return false; } return true; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddMessage.java index eebc29a..89d2863 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddMessage.java @@ -138,8 +138,7 @@ public final class ReplicationAddMessage extends PacketImpl { if (encodingData == null) { if (other.encodingData != null) return false; - } - else if (!encodingData.equals(other.encodingData)) + } else if (!encodingData.equals(other.encodingData)) return false; if (id != other.id) return false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java index c4d7e79..59475e0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationAddTXMessage.java @@ -148,8 +148,7 @@ public class ReplicationAddTXMessage extends PacketImpl { if (encodingData == null) { if (other.encodingData != null) return false; - } - else if (!encodingData.equals(other.encodingData)) + } else if (!encodingData.equals(other.encodingData)) return false; if (id != other.id) return false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java index 82f6525..0d75523 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationDeleteTXMessage.java @@ -120,8 +120,7 @@ public class ReplicationDeleteTXMessage extends PacketImpl { if (encodingData == null) { if (other.encodingData != null) return false; - } - else if (!encodingData.equals(other.encodingData)) + } else if (!encodingData.equals(other.encodingData)) return false; if (id != other.id) return false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java index 78555db..31680da 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java @@ -109,8 +109,7 @@ public class ReplicationPageEventMessage extends PacketImpl { if (storeName == null) { if (other.storeName != null) return false; - } - else if (!storeName.equals(other.storeName)) + } else if (!storeName.equals(other.storeName)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java index 4199cb0..7307151 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java @@ -89,8 +89,7 @@ public class ReplicationPageWriteMessage extends PacketImpl { if (pagedMessage == null) { if (other.pagedMessage != null) return false; - } - else if (!pagedMessage.equals(other.pagedMessage)) + } else if (!pagedMessage.equals(other.pagedMessage)) return false; return true; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java index cf8c413..ebdc1c4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPrepareMessage.java @@ -110,8 +110,7 @@ public final class ReplicationPrepareMessage extends PacketImpl { if (other.encodingData != null) { return false; } - } - else if (!encodingData.equals(other.encodingData)) { + } else if (!encodingData.equals(other.encodingData)) { return false; } if (journalID != other.journalID) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationResponseMessageV2.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationResponseMessageV2.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationResponseMessageV2.java index 146a3de..f9001c6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationResponseMessageV2.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationResponseMessageV2.java @@ -20,6 +20,7 @@ import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.core.protocol.core.impl.PacketImpl; public final class ReplicationResponseMessageV2 extends ReplicationResponseMessage { + boolean synchronizationIsFinishedAcknowledgement = false; public ReplicationResponseMessageV2(final boolean synchronizationIsFinishedAcknowledgement) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java index 157e02b..a44707f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationStartSyncMessage.java @@ -196,8 +196,7 @@ public class ReplicationStartSyncMessage extends PacketImpl { if (nodeID == null) { if (other.nodeID != null) return false; - } - else if (!nodeID.equals(other.nodeID)) + } else if (!nodeID.equals(other.nodeID)) return false; if (synchronizationIsFinished != other.synchronizationIsFinished) return false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java index 208e86b..de7f73e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java @@ -91,11 +91,9 @@ public final class ReplicationSyncFileMessage extends PacketImpl { private void determineType() { if (journalType != null) { fileType = FileType.JOURNAL; - } - else if (pageStoreName != null) { + } else if (pageStoreName != null) { fileType = FileType.PAGE; - } - else { + } else { fileType = FileType.LARGE_MESSAGE; } } @@ -209,8 +207,7 @@ public final class ReplicationSyncFileMessage extends PacketImpl { if (other.byteBuffer != null) { return false; } - } - else if (!byteBuffer.equals(other.byteBuffer)) { + } else if (!byteBuffer.equals(other.byteBuffer)) { return false; } if (dataSize != other.dataSize) { @@ -229,8 +226,7 @@ public final class ReplicationSyncFileMessage extends PacketImpl { if (other.pageStoreName != null) { return false; } - } - else if (!pageStoreName.equals(other.pageStoreName)) { + } else if (!pageStoreName.equals(other.pageStoreName)) { return false; } return true; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/JndiBindingRegistry.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/JndiBindingRegistry.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/JndiBindingRegistry.java index d22fda8..be4661c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/JndiBindingRegistry.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/JndiBindingRegistry.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.registry; -import org.apache.activemq.artemis.spi.core.naming.BindingRegistry; -import org.apache.activemq.artemis.utils.JNDIUtil; - import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import org.apache.activemq.artemis.spi.core.naming.BindingRegistry; +import org.apache.activemq.artemis.utils.JNDIUtil; + public class JndiBindingRegistry implements BindingRegistry { private Context context; @@ -40,12 +40,10 @@ public class JndiBindingRegistry implements BindingRegistry { try { if (context == null) { return null; - } - else { + } else { return context.lookup(name); } - } - catch (NamingException e) { + } catch (NamingException e) { return null; } } @@ -54,8 +52,7 @@ public class JndiBindingRegistry implements BindingRegistry { public boolean bind(String name, Object obj) { try { return bindToJndi(name, obj); - } - catch (NamingException e) { + } catch (NamingException e) { throw new RuntimeException(e); } } @@ -66,8 +63,7 @@ public class JndiBindingRegistry implements BindingRegistry { if (context != null) { context.unbind(name); } - } - catch (NamingException e) { + } catch (NamingException e) { } } @@ -77,8 +73,7 @@ public class JndiBindingRegistry implements BindingRegistry { if (context != null) { context.close(); } - } - catch (NamingException e) { + } catch (NamingException e) { } } @@ -89,8 +84,7 @@ public class JndiBindingRegistry implements BindingRegistry { int sepIndex = jndiName.lastIndexOf('/'); if (sepIndex == -1) { parentContext = ""; - } - else { + } else { parentContext = jndiName.substring(0, sepIndex); } jndiNameInContext = jndiName.substring(sepIndex + 1); @@ -99,8 +93,7 @@ public class JndiBindingRegistry implements BindingRegistry { //JMSServerManagerImpl.log.warn("Binding for " + jndiName + " already exists"); return false; - } - catch (Throwable e) { + } catch (Throwable e) { // OK } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/AbstractAcceptor.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/AbstractAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/AbstractAcceptor.java index 4004df6..a2f30f3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/AbstractAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/AbstractAcceptor.java @@ -28,15 +28,16 @@ public abstract class AbstractAcceptor implements Acceptor { protected final Map<String, ProtocolManager> protocolMap; - public AbstractAcceptor(Map<String, ProtocolManager> protocolMap) { this.protocolMap = protocolMap; } + /** * This will update the list of interceptors for each ProtocolManager inside the acceptor. - * */ + */ @Override - public void updateInterceptors(List<BaseInterceptor> incomingInterceptors, List<BaseInterceptor> outgoingInterceptors) { + public void updateInterceptors(List<BaseInterceptor> incomingInterceptors, + List<BaseInterceptor> outgoingInterceptors) { for (ProtocolManager manager : protocolMap.values()) { manager.updateInterceptors(incomingInterceptors, outgoingInterceptors); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java index d30b564..9c26b47 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java @@ -72,7 +72,6 @@ public final class InVMAcceptor extends AbstractAcceptor { private static final Logger logger = Logger.getLogger(InVMAcceptor.class); - public InVMAcceptor(final String name, final ClusterConnection clusterConnection, final Map<String, Object> configuration, @@ -166,9 +165,8 @@ public final class InVMAcceptor extends AbstractAcceptor { Notification notification = new Notification(null, CoreNotificationType.ACCEPTOR_STOPPED, props); try { notificationService.sendNotification(notification); - } - catch (Exception e) { - logger.warn("failed to send notification",e.getMessage(),e); + } catch (Exception e) { + logger.warn("failed to send notification", e.getMessage(), e); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java index 169ea3c..27fc544 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java @@ -193,13 +193,11 @@ public class InVMConnection implements Connection { futureListener.operationComplete(null); } } - } - catch (Exception e) { + } catch (Exception e) { final String msg = "Failed to write to handler on connector " + this; ActiveMQServerLogger.LOGGER.errorWritingToInvmConnector(e, this); throw new IllegalStateException(msg, e); - } - finally { + } finally { if (logger.isTraceEnabled()) { logger.trace(InVMConnection.this + "::packet sent done"); } @@ -220,13 +218,11 @@ public class InVMConnection implements Connection { if (!latch.await(10, TimeUnit.SECONDS)) { ActiveMQServerLogger.LOGGER.timedOutFlushingInvmChannel(); } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } - } - catch (RejectedExecutionException e) { + } catch (RejectedExecutionException e) { // Ignore - this can happen if server/client is shutdown and another request comes in } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java index e239466..907fb40 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java @@ -39,8 +39,8 @@ import org.apache.activemq.artemis.spi.core.remoting.ClientConnectionLifeCycleLi import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManager; import org.apache.activemq.artemis.spi.core.remoting.Connection; import org.apache.activemq.artemis.spi.core.remoting.ConnectionLifeCycleListener; -import org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor; import org.apache.activemq.artemis.utils.ActiveMQThreadFactory; +import org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor; import org.apache.activemq.artemis.utils.ConfigurationHelper; import org.apache.activemq.artemis.utils.OrderedExecutorFactory; import org.jboss.logging.Logger; @@ -108,8 +108,7 @@ public class InVMConnector extends AbstractConnector { if (threadPoolExecutor == null) { if (ActiveMQClient.getGlobalThreadPoolSize() <= -1) { threadPoolExecutor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), ActiveMQThreadFactory.defaultThreadFactory()); - } - else { + } else { threadPoolExecutor = new ActiveMQThreadPoolExecutor(0, ActiveMQClient.getGlobalThreadPoolSize(), 60L, TimeUnit.SECONDS, ActiveMQThreadFactory.defaultThreadFactory()); } } @@ -181,8 +180,7 @@ public class InVMConnector extends AbstractConnector { acceptor.connect((String) conn.getID(), handler, this, executorFactory.getExecutor()); return conn; - } - else { + } else { if (logger.isDebugEnabled()) { logger.debug(new StringBuilder().append("Connection limit of ").append(acceptor.getConnectionsAllowed()).append(" reached. Refusing connection.")); } @@ -239,8 +237,7 @@ public class InVMConnector extends AbstractConnector { if (listener instanceof ConnectionLifeCycleListener) { listener.connectionCreated(component, connection, protocol.getName()); - } - else { + } else { listener.connectionCreated(component, connection, protocol); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java index f166a50..fe74a91 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.core.remoting.impl.invm; -import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; - import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; + public final class InVMRegistry { public static final InVMRegistry instance = new InVMRegistry(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java index f92a303..a910941 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java @@ -90,8 +90,7 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { // we are either a channel buffer, which gets delayed until a response is available, or we are the actual response if (msg instanceof ByteBuf) { executor.execute(new ResponseRunner((ByteBuf) msg, promise)); - } - else { + } else { ctx.write(msg, promise); } } @@ -102,8 +101,7 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { for (ResponseHolder response : responses) { if (response.timeReceived < time) { lateResponses++; - } - else { + } else { break; } } @@ -141,8 +139,7 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { do { try { responseHolder = responses.take(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { if (executor.isShutdown()) return; // otherwise ignore, we'll just try again @@ -152,8 +149,7 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { piggyBackResponses(responseHolder.response.content()); responseHolder.response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(responseHolder.response.content().readableBytes())); channel.writeAndFlush(responseHolder.response, promise); - } - else { + } else { responseHolder.response.content().writeBytes(buffer); responseHolder.response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(responseHolder.response.content().readableBytes())); channel.writeAndFlush(responseHolder.response, promise); @@ -176,8 +172,7 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { } buf.writeBytes(responseRunner.buffer); responseRunner.buffer.release(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { break; } } while (responses.isEmpty()); @@ -192,11 +187,9 @@ public class HttpAcceptorHandler extends ChannelDuplexHandler { executor.shutdown(); try { executor.awaitTermination(10, TimeUnit.SECONDS); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { // no-op - } - finally { + } finally { executor.shutdownNow(); } responses.clear(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 8cff70b..3fda5ce 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -178,7 +178,6 @@ public class NettyAcceptor extends AbstractAcceptor { private static final Logger logger = Logger.getLogger(NettyAcceptor.class); - public NettyAcceptor(final String name, final ClusterConnection clusterConnection, final Map<String, Object> configuration, @@ -230,8 +229,7 @@ public class NettyAcceptor extends AbstractAcceptor { needClientAuth = ConfigurationHelper.getBooleanProperty(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, TransportConstants.DEFAULT_NEED_CLIENT_AUTH, 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; @@ -269,16 +267,14 @@ public class NettyAcceptor extends AbstractAcceptor { if (useInvm) { channelClazz = LocalServerChannel.class; eventLoopGroup = new LocalEventLoopGroup(); - } - else { + } else { int threadsToUse; if (nioRemotingThreads == -1) { // Default to number of cores * 3 threadsToUse = Runtime.getRuntime().availableProcessors() * 3; - } - else { + } else { threadsToUse = this.nioRemotingThreads; } channelClazz = NioServerSocketChannel.class; @@ -329,8 +325,7 @@ public class NettyAcceptor extends AbstractAcceptor { if (httpUpgradeEnabled) { // the channel will be bound by the Web container and hand over after the HTTP Upgrade // handshake is successful - } - else { + } else { startServerChannels(); paused = false; @@ -389,11 +384,10 @@ public class NettyAcceptor extends AbstractAcceptor { try { if (keyStorePath == null && TransportConstants.DEFAULT_TRUSTSTORE_PROVIDER.equals(keyStoreProvider)) throw new IllegalArgumentException("If \"" + TransportConstants.SSL_ENABLED_PROP_NAME + - "\" is true then \"" + TransportConstants.KEYSTORE_PATH_PROP_NAME + "\" must be non-null " + - "unless an alternative \"" + TransportConstants.KEYSTORE_PROVIDER_PROP_NAME + "\" has been specified."); + "\" is true then \"" + TransportConstants.KEYSTORE_PATH_PROP_NAME + "\" must be non-null " + + "unless an alternative \"" + TransportConstants.KEYSTORE_PROVIDER_PROP_NAME + "\" has been specified."); context = SSLSupport.createContext(keyStoreProvider, keyStorePath, keyStorePassword, trustStoreProvider, trustStorePath, trustStorePassword); - } - catch (Exception e) { + } catch (Exception e) { IllegalStateException ise = new IllegalStateException("Unable to create NettyAcceptor for " + host + ":" + port); ise.initCause(e); throw ise; @@ -401,8 +395,7 @@ public class NettyAcceptor extends AbstractAcceptor { SSLEngine engine; if (verifyHost) { engine = context.createSSLEngine(host, port); - } - else { + } else { engine = context.createSSLEngine(); } @@ -419,8 +412,7 @@ public class NettyAcceptor extends AbstractAcceptor { if (enabledCipherSuites != null) { try { engine.setEnabledCipherSuites(SSLSupport.parseCommaSeparatedListIntoArray(enabledCipherSuites)); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { ActiveMQServerLogger.LOGGER.invalidCipherSuite(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedCipherSuites())); throw e; } @@ -429,13 +421,11 @@ public class NettyAcceptor extends AbstractAcceptor { if (enabledProtocols != null) { try { engine.setEnabledProtocols(SSLSupport.parseCommaSeparatedListIntoArray(enabledProtocols)); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { ActiveMQServerLogger.LOGGER.invalidProtocol(SSLSupport.parseArrayIntoCommandSeparatedList(engine.getSupportedProtocols())); throw e; } - } - else { + } else { engine.setEnabledProtocols(originalProtocols); } @@ -468,8 +458,7 @@ public class NettyAcceptor extends AbstractAcceptor { SocketAddress address; if (useInvm) { address = new LocalAddress(h); - } - else { + } else { address = new InetSocketAddress(h, port); } Channel serverChannel = bootstrap.bind(address).syncUninterruptibly().channel(); @@ -541,9 +530,8 @@ public class NettyAcceptor extends AbstractAcceptor { Notification notification = new Notification(null, CoreNotificationType.ACCEPTOR_STOPPED, props); try { notificationService.sendNotification(notification); - } - catch (Exception e) { - logger.warn("failed to send notification",e.getMessage(),e); + } catch (Exception e) { + logger.warn("failed to send notification", e.getMessage(), e); } } @@ -657,19 +645,16 @@ public class NettyAcceptor extends AbstractAcceptor { public void operationComplete(final io.netty.util.concurrent.Future<Channel> future) throws Exception { if (future.isSuccess()) { active = true; - } - else { + } else { future.getNow().close(); } } }); - } - else { + } else { active = true; } return nc; - } - else { + } else { ActiveMQServerLogger.LOGGER.connectionLimitReached(connectionsAllowed, ctx.channel().remoteAddress().toString()); ctx.channel().close(); return null;
