Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B2AB2200B8F for ; Fri, 30 Sep 2016 17:26:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B19B3160AE5; Fri, 30 Sep 2016 15:26:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0EEFF160B03 for ; Fri, 30 Sep 2016 17:26:05 +0200 (CEST) Received: (qmail 89634 invoked by uid 500); 30 Sep 2016 15:26:04 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 86768 invoked by uid 99); 30 Sep 2016 15:26:02 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Sep 2016 15:26:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 27224E38B1; Fri, 30 Sep 2016 15:26:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: martyntaylor@apache.org To: commits@activemq.apache.org Date: Fri, 30 Sep 2016 15:26:25 -0000 Message-Id: <0ceb05590e93408b9aee96e12a7daf23@git.apache.org> In-Reply-To: <5ac6d0226a5f467aa1c95175e44ed5d6@git.apache.org> References: <5ac6d0226a5f467aa1c95175e44ed5d6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [25/52] [partial] activemq-artemis git commit: ARTEMIS-765 Improve Checkstyle archived-at: Fri, 30 Sep 2016 15:26:09 -0000 http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index 4ff356e..50bc90d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -256,11 +256,10 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif } Map selectedProtocols = new ConcurrentHashMap<>(); - for (Entry entry: selectedProtocolFactories.entrySet()) { + for (Entry entry : selectedProtocolFactories.entrySet()) { selectedProtocols.put(entry.getKey(), entry.getValue().createProtocolManager(server, info.getExtraParams(), incomingInterceptors, outgoingInterceptors)); } - acceptor = factory.createAcceptor(info.getName(), clusterConnection, info.getParams(), new DelegatingBufferHandler(), this, threadPool, scheduledThreadPool, selectedProtocols); if (defaultInvmSecurityPrincipal != null && acceptor.isUnsecurable()) { @@ -274,8 +273,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif managementService.registerAcceptor(acceptor, info); } - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorCreatingAcceptor(e, info.getFactoryClassName()); } @@ -320,8 +318,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif for (Acceptor acceptor : acceptors.values()) { try { acceptor.pause(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName()); } } @@ -374,8 +371,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif try { acceptor.pause(); - } - catch (Throwable t) { + } catch (Throwable t) { ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName()); } @@ -402,8 +398,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif for (Acceptor acceptor : acceptors.values()) { try { acceptor.stop(); - } - catch (Throwable t) { + } catch (Throwable t) { ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName()); } } @@ -445,8 +440,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (entry != null) { return entry.connection; - } - else { + } else { ActiveMQServerLogger.LOGGER.errorRemovingConnection(); return null; @@ -458,8 +452,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (entry != null) { return entry; - } - else { + } else { return null; } } @@ -472,8 +465,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif logger.debug("RemotingServiceImpl::removing connection ID " + remotingConnectionID); connectionCountLatch.countDown(); return entry.connection; - } - else { + } else { logger.debug("The connectionID::" + remotingConnectionID + " was already removed by some other module"); return null; @@ -575,8 +567,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (incomingInterceptors.remove(interceptor)) { updateProtocols(); return true; - } - else { + } else { return false; } } @@ -597,8 +588,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (outgoingInterceptors.remove(interceptor)) { updateProtocols(); return true; - } - else { + } else { return false; } } @@ -629,8 +619,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (conn != null) { conn.connection.bufferReceived(connectionID, buffer); - } - else { + } else { if (logger.isTraceEnabled()) { logger.trace("ConnectionID = " + connectionID + " was already closed, so ignoring packet"); } @@ -659,8 +648,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (!criticalError) { try { join(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } @@ -686,8 +674,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif flush = false; } - } - else { + } else { entry.lastCheck = now; } } @@ -701,8 +688,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif // as if anything wrong happens on flush // failure detection could be affected conn.flush(); - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } @@ -729,8 +715,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (latch.await(pauseInterval, TimeUnit.MILLISECONDS)) return; - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQServerLogger.LOGGER.errorOnFailureCheck(e); } } @@ -749,7 +734,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif * @param protocolList * @param transportConfig * @param protocolMap - */ + */ private void locateProtocols(String protocolList, Object transportConfig, Map protocolMap) { @@ -760,8 +745,7 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif if (protocolManagerFactory == null) { ActiveMQServerLogger.LOGGER.noProtocolManagerFound(protocolItem, transportConfig.toString()); - } - else { + } else { protocolMap.put(protocolItem, protocolManagerFactory); } } @@ -769,8 +753,9 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif /** * Finds protocol support from a given classloader. + * * @param loader - */ + */ private void resolveProtocols(ClassLoader loader) { ServiceLoader serviceLoader = ServiceLoader.load(ProtocolManagerFactory.class, loader); loadProtocolManagerFactories(serviceLoader); @@ -778,8 +763,9 @@ public class RemotingServiceImpl implements RemotingService, ServerConnectionLif /** * Loads the protocols found into a map. + * * @param protocolManagerFactoryCollection - */ + */ private void loadProtocolManagerFactories(Iterable protocolManagerFactoryCollection) { for (ProtocolManagerFactory next : protocolManagerFactoryCollection) { String[] protocols = next.getProtocols(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicatedJournal.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicatedJournal.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicatedJournal.java index 036be12..6668c71 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicatedJournal.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicatedJournal.java @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.replication; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.core.io.SequentialFileFactory; import org.apache.activemq.artemis.core.journal.EncodingSupport; import org.apache.activemq.artemis.core.journal.IOCompletion; import org.apache.activemq.artemis.core.journal.Journal; @@ -26,7 +27,6 @@ import org.apache.activemq.artemis.core.journal.JournalLoadInformation; import org.apache.activemq.artemis.core.journal.LoaderCallback; import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo; import org.apache.activemq.artemis.core.journal.RecordInfo; -import org.apache.activemq.artemis.core.io.SequentialFileFactory; import org.apache.activemq.artemis.core.journal.TransactionFailureCallback; import org.apache.activemq.artemis.core.journal.impl.JournalFile; import org.apache.activemq.artemis.core.journal.impl.dataformat.ByteArrayEncoding; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java index 18c68d7..1a07adc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java @@ -35,10 +35,10 @@ import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.io.IOCriticalErrorListener; +import org.apache.activemq.artemis.core.io.SequentialFile; import org.apache.activemq.artemis.core.journal.Journal; import org.apache.activemq.artemis.core.journal.Journal.JournalState; import org.apache.activemq.artemis.core.journal.JournalLoadInformation; -import org.apache.activemq.artemis.core.io.SequentialFile; import org.apache.activemq.artemis.core.journal.impl.FileWrapperJournal; import org.apache.activemq.artemis.core.journal.impl.JournalFile; import org.apache.activemq.artemis.core.paging.PagedMessage; @@ -53,8 +53,8 @@ import org.apache.activemq.artemis.core.protocol.core.Channel; import org.apache.activemq.artemis.core.protocol.core.ChannelHandler; 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.BackupReplicationStartFailedMessage; import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage; +import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupReplicationStartFailedMessage; 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; @@ -90,7 +90,6 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon private static final Logger logger = Logger.getLogger(ReplicationEndpoint.class); - private final IOCriticalErrorListener criticalErrorListener; private final ActiveMQServerImpl server; private final boolean wantedFailBack; @@ -172,58 +171,41 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon if (type == PacketImpl.REPLICATION_APPEND) { handleAppendAddRecord((ReplicationAddMessage) packet); - } - else if (type == PacketImpl.REPLICATION_APPEND_TX) { + } else if (type == PacketImpl.REPLICATION_APPEND_TX) { handleAppendAddTXRecord((ReplicationAddTXMessage) packet); - } - else if (type == PacketImpl.REPLICATION_DELETE) { + } else if (type == PacketImpl.REPLICATION_DELETE) { handleAppendDelete((ReplicationDeleteMessage) packet); - } - else if (type == PacketImpl.REPLICATION_DELETE_TX) { + } else if (type == PacketImpl.REPLICATION_DELETE_TX) { handleAppendDeleteTX((ReplicationDeleteTXMessage) packet); - } - else if (type == PacketImpl.REPLICATION_PREPARE) { + } else if (type == PacketImpl.REPLICATION_PREPARE) { handlePrepare((ReplicationPrepareMessage) packet); - } - else if (type == PacketImpl.REPLICATION_COMMIT_ROLLBACK) { + } else if (type == PacketImpl.REPLICATION_COMMIT_ROLLBACK) { handleCommitRollback((ReplicationCommitMessage) packet); - } - else if (type == PacketImpl.REPLICATION_PAGE_WRITE) { + } else if (type == PacketImpl.REPLICATION_PAGE_WRITE) { handlePageWrite((ReplicationPageWriteMessage) packet); - } - else if (type == PacketImpl.REPLICATION_PAGE_EVENT) { + } else if (type == PacketImpl.REPLICATION_PAGE_EVENT) { handlePageEvent((ReplicationPageEventMessage) packet); - } - else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN) { + } else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_BEGIN) { handleLargeMessageBegin((ReplicationLargeMessageBeginMessage) packet); - } - else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE) { + } else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_WRITE) { handleLargeMessageWrite((ReplicationLargeMessageWriteMessage) packet); - } - else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_END) { + } else if (type == PacketImpl.REPLICATION_LARGE_MESSAGE_END) { handleLargeMessageEnd((ReplicationLargeMessageEndMessage) packet); - } - else if (type == PacketImpl.REPLICATION_START_FINISH_SYNC) { + } else if (type == PacketImpl.REPLICATION_START_FINISH_SYNC) { response = handleStartReplicationSynchronization((ReplicationStartSyncMessage) packet); - } - else if (type == PacketImpl.REPLICATION_SYNC_FILE) { + } else if (type == PacketImpl.REPLICATION_SYNC_FILE) { handleReplicationSynchronization((ReplicationSyncFileMessage) packet); - } - else if (type == PacketImpl.REPLICATION_SCHEDULED_FAILOVER) { + } else if (type == PacketImpl.REPLICATION_SCHEDULED_FAILOVER) { handleLiveStopping((ReplicationLiveIsStoppingMessage) packet); - } - else if (type == PacketImpl.BACKUP_REGISTRATION_FAILED) { + } else if (type == PacketImpl.BACKUP_REGISTRATION_FAILED) { handleFatalError((BackupReplicationStartFailedMessage) packet); - } - else { + } else { ActiveMQServerLogger.LOGGER.invalidPacketForReplication(packet); } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { ActiveMQServerLogger.LOGGER.errorHandlingReplicationPacket(e, packet); response = new ActiveMQExceptionMessage(e); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorHandlingReplicationPacket(e, packet); response = new ActiveMQExceptionMessage(ActiveMQMessageBundle.BUNDLE.replicationUnhandledError(e)); } @@ -274,8 +256,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon pageManager.start(); started = true; - } - catch (Exception e) { + } catch (Exception e) { if (server.isStarted()) throw e; } @@ -316,8 +297,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon try { page.sync(); page.close(false); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorClosingPageOnReplication(e); } } @@ -363,8 +343,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon journal.stop(); journal.start(); journal.loadSyncOnly(JournalState.SYNCING_UP_TO_DATE); - } - finally { + } finally { journal.synchronizationUnlock(); } } @@ -507,8 +486,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon logger.trace("Deleting LargeMessage " + packet.getMessageId() + " on the executor @ handleLargeMessageEnd"); } message.deleteFile(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDeletingLargeMessage(e, packet.getMessageId()); } } @@ -533,15 +511,13 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon if (delete) { message = largeMessages.remove(messageId); - } - else { + } else { message = largeMessages.get(messageId); if (message == null) { if (createIfNotExists) { createLargeMessage(messageId, false); message = largeMessages.get(messageId); - } - else { + } else { // No warnings if it's a delete, as duplicate deletes may be sent repeatedly. ActiveMQServerLogger.LOGGER.largeMessageNotAvailable(messageId); } @@ -567,8 +543,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon ReplicatedLargeMessage msg; if (liveToBackupSync) { msg = new LargeServerMessageInSync(storageManager); - } - else { + } else { msg = storageManager.createLargeMessage(); } @@ -584,8 +559,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon Journal journalToUse = getJournal(packet.getJournalID()); if (packet.isRollback()) { journalToUse.appendRollbackRecord(packet.getTxId(), noSync); - } - else { + } else { journalToUse.appendCommitRecord(packet.getTxId(), noSync); } } @@ -623,8 +597,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon if (packet.getOperation() == ADD_OPERATION_TYPE.UPDATE) { journalToUse.appendUpdateRecordTransactional(packet.getTxId(), packet.getId(), packet.getRecordType(), packet.getRecordData()); - } - else { + } else { journalToUse.appendAddRecordTransactional(packet.getTxId(), packet.getId(), packet.getRecordType(), packet.getRecordData()); } } @@ -640,8 +613,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon logger.trace("Endpoint appendUpdate id = " + packet.getId()); } journalToUse.appendUpdateRecord(packet.getId(), packet.getJournalRecordType(), packet.getRecordData(), noSync); - } - else { + } else { if (logger.isTraceEnabled()) { logger.trace("Endpoint append id = " + packet.getId()); } @@ -666,8 +638,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon if (deletePages) { page.delete(null); } - } - else { + } else { page.close(false); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index b254d9a..d0468d1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -82,7 +82,6 @@ import org.jboss.logging.Logger; */ public final class ReplicationManager implements ActiveMQComponent, ReadyListener { - private static final Logger logger = Logger.getLogger(ReplicationManager.class); public enum ADD_OPERATION_TYPE { @@ -135,7 +134,9 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene /** * @param remotingConnection */ - public ReplicationManager(CoreRemotingConnection remotingConnection, final long timeout, final ExecutorFactory executorFactory) { + public ReplicationManager(CoreRemotingConnection remotingConnection, + final long timeout, + final ExecutorFactory executorFactory) { this.executorFactory = executorFactory; this.replicatingChannel = remotingConnection.getChannel(CHANNEL_ID.REPLICATION.id, -1); this.remotingConnection = remotingConnection; @@ -312,8 +313,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene logger.trace("Calling ctx.replicationDone()"); try { ctx.replicationDone(); - } - catch (Throwable e) { + } catch (Throwable e) { ActiveMQServerLogger.LOGGER.errorCompletingCallbackOnReplicationManager(e); } } @@ -360,8 +360,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene return repliToken; } replicatingChannel.send(packet); - } - else { + } else { // Already replicating channel failed, so just play the action now runItNow = true; } @@ -376,8 +375,10 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene return repliToken; } - /** This was written as a refactoring of sendReplicatePacket. - * In case you refactor this in any way, this method must hold a lock on replication lock. .*/ + /** + * This was written as a refactoring of sendReplicatePacket. + * In case you refactor this in any way, this method must hold a lock on replication lock. . + */ private boolean flowControl() { // synchronized (replicationLock) { -- I'm not adding this because the caller already has it // future maintainers of this code please be aware that the intention here is hold the lock on replication lock @@ -388,7 +389,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene //don't wait for ever as this may hang tests etc, we've probably been closed anyway long now = System.currentTimeMillis(); long deadline = now + timeout; - while (!writable.get() && now < deadline) { + while (!writable.get() && now < deadline) { replicationLock.wait(deadline - now); now = System.currentTimeMillis(); } @@ -399,14 +400,12 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene logger.tracef("There was no response from replication backup after %s seconds, server being stopped now", System.currentTimeMillis() - now); try { stop(); - } - catch (Exception e) { + } catch (Exception e) { logger.warn(e.getMessage(), e); } return false; } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new ActiveMQInterruptedException(e); } } @@ -445,15 +444,13 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene if (me.getType() == ActiveMQExceptionType.DISCONNECTED) { // Backup has shut down - no need to log a stack trace ActiveMQServerLogger.LOGGER.replicationStopOnBackupShutdown(); - } - else { + } else { ActiveMQServerLogger.LOGGER.replicationStopOnBackupFail(me); } try { stop(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorStoppingReplication(e); } } @@ -517,8 +514,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene try { ActiveMQServerLogger.LOGGER.journalSynch(jf, file.size(), file); sendLargeFile(content, null, jf.getFileID(), file, Long.MAX_VALUE); - } - finally { + } finally { if (file.isOpen()) file.close(); } @@ -570,8 +566,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene if (bytesRead >= maxBytesToSend) { toSend = (int) maxBytesToSend; maxBytesToSend = 0; - } - else { + } else { maxBytesToSend = maxBytesToSend - bytesRead; } buffer.limit(toSend); @@ -584,8 +579,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene break; } } - } - finally { + } finally { if (file.isOpen()) file.close(); } @@ -628,8 +622,7 @@ public final class ReplicationManager implements ActiveMQComponent, ReadyListene logger.trace("sendSynchronizationDone wasn't finished in time"); throw ActiveMQMessageBundle.BUNDLE.replicationSynchronizationTimeout(initialReplicationSyncTimeout); } - } - catch (InterruptedException e) { + } catch (InterruptedException e) { logger.debug(e); } inSync = false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java index 208d0cc..e6c8e4e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java @@ -100,7 +100,9 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC } @Override - public String authenticate(final String user, final String password, X509Certificate[] certificates) throws Exception { + public String authenticate(final String user, + final String password, + X509Certificate[] certificates) throws Exception { if (securityEnabled) { if (managementClusterUser.equals(user)) { @@ -114,8 +116,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC */ if (!managementClusterPassword.equals(password)) { throw ActiveMQMessageBundle.BUNDLE.unableToValidateClusterUser(user); - } - else { + } else { return managementClusterUser; } } @@ -124,12 +125,10 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC boolean userIsValid = false; if (securityManager instanceof ActiveMQSecurityManager3) { - validatedUser = ((ActiveMQSecurityManager3)securityManager).validateUser(user, password, certificates); - } - else if (securityManager instanceof ActiveMQSecurityManager2) { - userIsValid = ((ActiveMQSecurityManager2)securityManager).validateUser(user, password, certificates); - } - else { + validatedUser = ((ActiveMQSecurityManager3) securityManager).validateUser(user, password, certificates); + } else if (securityManager instanceof ActiveMQSecurityManager2) { + userIsValid = ((ActiveMQSecurityManager2) securityManager).validateUser(user, password, certificates); + } else { userIsValid = securityManager.validateUser(user, password); } @@ -179,12 +178,10 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC if (securityManager instanceof ActiveMQSecurityManager3) { final ActiveMQSecurityManager3 securityManager3 = (ActiveMQSecurityManager3) securityManager; validated = securityManager3.validateUserAndRole(user, session.getPassword(), roles, checkType, saddress, session.getRemotingConnection()) != null; - } - else if (securityManager instanceof ActiveMQSecurityManager2) { + } else if (securityManager instanceof ActiveMQSecurityManager2) { final ActiveMQSecurityManager2 securityManager2 = (ActiveMQSecurityManager2) securityManager; validated = securityManager2.validateUserAndRole(user, session.getPassword(), roles, checkType, saddress, session.getRemotingConnection()); - } - else { + } else { validated = securityManager.validateUserAndRole(user, session.getPassword(), roles, checkType); } @@ -239,8 +236,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC invalidateCache(); lastCheck = now; - } - else { + } else { ConcurrentHashSet act = cache.get(user + "." + checkType.name()); if (act != null) { granted = act.contains(dest); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java index d416a97..b293406 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java @@ -311,7 +311,7 @@ public interface ActiveMQMessageBundle { @Message(id = 119083, value = "Queue {0} has a different filter than requested", format = Message.Format.MESSAGE_FORMAT) ActiveMQInvalidTransientQueueUseException queueSubscriptionBelongsToDifferentFilter(SimpleString queueName); - // this code has to match with version 2.3.x as it's used on integration tests at Wildfly and JBoss EAP + // this code has to match with version 2.3.x as it's used on integration tests at Wildfly and JBoss EAP @Message(id = 119099, value = "Unable to authenticate cluster user: {0}", format = Message.Format.MESSAGE_FORMAT) ActiveMQClusterSecurityException unableToValidateClusterUser(String user); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index a8dc14e..6e32b35 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -780,7 +780,6 @@ public interface ActiveMQServerLogger extends BasicLogger { format = Message.Format.MESSAGE_FORMAT) void broadcastGroupClosed(@Cause Exception e); - @LogMessage(level = Logger.Level.WARN) @Message(id = 222109, value = "Timed out waiting for write lock on consumer. Check the Thread dump", format = Message.Format.MESSAGE_FORMAT) void timeoutLockingConsumer(); @@ -1037,7 +1036,7 @@ public interface ActiveMQServerLogger extends BasicLogger { @SuppressWarnings("deprecation") @LogMessage(level = Logger.Level.WARN) @Message(id = 222168, value = "The ''" + TransportConstants.PROTOCOL_PROP_NAME + "'' property is deprecated. If you want this Acceptor to support multiple protocols, use the ''" + TransportConstants.PROTOCOLS_PROP_NAME + "'' property, e.g. with value ''CORE,AMQP,STOMP''", - format = Message.Format.MESSAGE_FORMAT) + format = Message.Format.MESSAGE_FORMAT) void warnDeprecatedProtocol(); @LogMessage(level = Logger.Level.WARN) @@ -1140,7 +1139,6 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 222190, value = "Deleting old data directory {0} as the max folders is set to 0", format = Message.Format.MESSAGE_FORMAT) void backupDeletingData(String oldPath); - @LogMessage(level = Logger.Level.WARN) @Message(id = 222191, value = "Could not find any configured role for user {0}.", http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConnectorServiceFactory.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConnectorServiceFactory.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConnectorServiceFactory.java index 0c37ade..23c3cc3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConnectorServiceFactory.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConnectorServiceFactory.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.server; -import org.apache.activemq.artemis.core.persistence.StorageManager; -import org.apache.activemq.artemis.core.postoffice.PostOffice; - import java.util.Map; import java.util.Set; import java.util.concurrent.ScheduledExecutorService; +import org.apache.activemq.artemis.core.persistence.StorageManager; +import org.apache.activemq.artemis.core.postoffice.PostOffice; + public interface ConnectorServiceFactory { ConnectorService createConnectorService(String connectorName, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/LiveNodeLocator.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/LiveNodeLocator.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/LiveNodeLocator.java index 88a85da..56fef7c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/LiveNodeLocator.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/LiveNodeLocator.java @@ -70,8 +70,7 @@ public abstract class LiveNodeLocator implements ClusterTopologyListener { if (backupQuorum != null) { if (alreadyReplicating) { backupQuorum.notifyAlreadyReplicating(); - } - else { + } else { backupQuorum.notifyRegistrationFailed(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MemoryManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MemoryManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MemoryManager.java index 74e527e..ecd87f8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MemoryManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MemoryManager.java @@ -61,8 +61,8 @@ public class MemoryManager implements ActiveMQComponent { @Override public synchronized void start() { logger.debug("Starting MemoryManager with MEASURE_INTERVAL: " + measureInterval + - " FREE_MEMORY_PERCENT: " + - memoryWarningThreshold); + " FREE_MEMORY_PERCENT: " + + memoryWarningThreshold); if (started) { // Already started @@ -91,8 +91,7 @@ public class MemoryManager implements ActiveMQComponent { try { thread.join(); - } - catch (InterruptedException ignore) { + } catch (InterruptedException ignore) { } } @@ -107,8 +106,7 @@ public class MemoryManager implements ActiveMQComponent { } Thread.sleep(measureInterval); - } - catch (InterruptedException ignore) { + } catch (InterruptedException ignore) { if (!started) { return; } @@ -138,8 +136,7 @@ public class MemoryManager implements ActiveMQComponent { ActiveMQServerLogger.LOGGER.memoryError(memoryWarningThreshold, info.toString()); low = true; - } - else { + } else { low = false; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MessageReference.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MessageReference.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MessageReference.java index 8c80eb0..a1e6a20 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MessageReference.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/MessageReference.java @@ -38,12 +38,16 @@ public interface MessageReference { */ int getMessageMemoryEstimate(); - /** To be used on holding protocol specific data during the delivery. - * This will be only valid while the message is on the delivering queue at the consumer */ + /** + * To be used on holding protocol specific data during the delivery. + * This will be only valid while the message is on the delivering queue at the consumer + */ Object getProtocolData(); - /** To be used on holding protocol specific data during the delivery. - * This will be only valid while the message is on the delivering queue at the consumer */ + /** + * To be used on holding protocol specific data during the delivery. + * This will be only valid while the message is on the delivering queue at the consumer + */ void setProtocolData(Object data); MessageReference copy(Queue queue); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java index 331851d..28f05b2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/NodeManager.java @@ -155,20 +155,17 @@ public abstract class NodeManager implements ActiveMQComponent { while (!serverLockFile.exists()) { try { fileCreated = serverLockFile.createNewFile(); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { ActiveMQServerLogger.LOGGER.nodeManagerCantOpenFile(e, serverLockFile); throw e; - } - catch (IOException e) { + } catch (IOException e) { /* * on some OS's this may fail weirdly even tho the parent dir exists, retrying will work, some weird timing issue i think * */ if (count < 5) { try { Thread.sleep(100); - } - catch (InterruptedException e1) { + } catch (InterruptedException e1) { } count++; continue; @@ -216,15 +213,13 @@ public abstract class NodeManager implements ActiveMQComponent { id.position(0); channel.write(id, 3); channel.force(true); - } - else if (read != 16) { + } else if (read != 16) { setUUID(UUIDGenerator.getInstance().generateUUID()); id.put(getUUID().asBytes(), 0, 16); id.position(0); channel.write(id, 3); channel.force(true); - } - else { + } else { byte[] bytes = new byte[16]; id.position(0); id.get(bytes); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java index ce338fe..f750f6c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/QueueConfig.java @@ -81,7 +81,6 @@ public final class QueueConfig { return this; } - public Builder pagingManager(final PagingManager pagingManager) { this.pagingManager = pagingManager; return this; @@ -107,7 +106,6 @@ public final class QueueConfig { return this; } - /** * Returns a new {@link QueueConfig} using the parameters configured on the {@link Builder}. *
@@ -123,12 +121,10 @@ public final class QueueConfig { if (pagingManager != null && !FilterUtils.isTopicIdentification(filter)) { try { pageSubscription = this.pagingManager.getPageStore(address).getCursorProvider().createSubscription(id, filter, durable); - } - catch (Exception e) { + } catch (Exception e) { throw new IllegalStateException(e); } - } - else { + } else { pageSubscription = null; } return new QueueConfig(id, address, name, filter, pageSubscription, user, durable, temporary, autoCreated); @@ -142,7 +138,7 @@ public final class QueueConfig { * The {@code address} is defaulted to the {@code name} value. * The reference parameters aren't defensively copied. * - * @param id the id of the queue to be created + * @param id the id of the queue to be created * @param name the name of the queue to be created * @throws IllegalStateException if {@code name} is {@code null} or empty */ @@ -155,8 +151,8 @@ public final class QueueConfig { *
* The reference parameters aren't defensively copied. * - * @param id the id of the queue to be created - * @param name the name of the queue to be created + * @param id the id of the queue to be created + * @param name the name of the queue to be created * @param address the address of the queue to be created * @throws IllegalStateException if {@code name} or {@code address} are {@code null} or empty */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ScheduledDeliveryHandler.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ScheduledDeliveryHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ScheduledDeliveryHandler.java index 8260507..460e135 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ScheduledDeliveryHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ScheduledDeliveryHandler.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.core.server; +import java.util.List; + import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.core.filter.Filter; -import java.util.List; - public interface ScheduledDeliveryHandler { boolean checkAndSchedule(MessageReference ref, final boolean tail); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SecuritySettingPlugin.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SecuritySettingPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SecuritySettingPlugin.java index 7b22b61..5d62c31 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SecuritySettingPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SecuritySettingPlugin.java @@ -24,6 +24,7 @@ import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.settings.HierarchicalRepository; public interface SecuritySettingPlugin extends Serializable { + /** * Initialize the plugin with the given configuration options. This method is called by the broker when the file-based * configuration is read (see {@code org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser#parseSecurity(org.w3c.dom.Element, org.apache.activemq.artemis.core.config.Configuration)}. http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java index d157a8c..ce9c489 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerConsumer.java @@ -31,10 +31,14 @@ public interface ServerConsumer extends Consumer { void fireSlowConsumer(); - /** this is to be used with anything specific on a protocol head. */ + /** + * this is to be used with anything specific on a protocol head. + */ Object getProtocolData(); - /** this is to be used with anything specific on a protocol head. */ + /** + * this is to be used with anything specific on a protocol head. + */ void setProtocolData(Object protocolData); /** @@ -74,11 +78,15 @@ public interface ServerConsumer extends Consumer { MessageReference removeReferenceByID(long messageID) throws Exception; - /** Some protocols may choose to send the message back to delivering instead of redeliver. - * For example openwire will redeliver through the client, so messages will go back to delivering list after rollback. */ + /** + * Some protocols may choose to send the message back to delivering instead of redeliver. + * For example openwire will redeliver through the client, so messages will go back to delivering list after rollback. + */ void backToDelivering(MessageReference reference); - List getDeliveringReferencesBasedOnProtocol(boolean remove, Object protocolDataStart, Object protocolDataEnd); + List getDeliveringReferencesBasedOnProtocol(boolean remove, + Object protocolDataStart, + Object protocolDataEnd); void acknowledge(Transaction tx, long messageID) throws Exception; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java index 3521d71..0df5060 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServerSession.java @@ -133,7 +133,10 @@ public interface ServerSession extends SecurityAuth { void sendContinuations(int packetSize, long totalBodySize, byte[] body, boolean continues) throws Exception; - RoutingStatus send(Transaction tx, ServerMessage message, boolean direct, boolean noAutoCreateQueue) throws Exception; + RoutingStatus send(Transaction tx, + ServerMessage message, + boolean direct, + boolean noAutoCreateQueue) throws Exception; RoutingStatus send(ServerMessage message, boolean direct, boolean noAutoCreateQueue) throws Exception; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java index dfa86b7..4f2ef9d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ServiceRegistry.java @@ -16,17 +16,17 @@ */ package org.apache.activemq.artemis.core.server; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; + import org.apache.activemq.artemis.api.core.BaseInterceptor; import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration; import org.apache.activemq.artemis.core.server.cluster.Transformer; import org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ScheduledExecutorService; - /** * A holder for common services leveraged by the broker. */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SlowConsumerDetectionListener.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SlowConsumerDetectionListener.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SlowConsumerDetectionListener.java index 0c60f25..6b933a9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SlowConsumerDetectionListener.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/SlowConsumerDetectionListener.java @@ -18,5 +18,6 @@ package org.apache.activemq.artemis.core.server; public interface SlowConsumerDetectionListener { + void onSlowConsumer(ServerConsumer consumer); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ActiveMQServerSideProtocolManagerFactory.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ActiveMQServerSideProtocolManagerFactory.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ActiveMQServerSideProtocolManagerFactory.java index 918dd0d..3c9791e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ActiveMQServerSideProtocolManagerFactory.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ActiveMQServerSideProtocolManagerFactory.java @@ -28,7 +28,6 @@ import org.apache.activemq.artemis.spi.core.remoting.ClientProtocolManagerFactor */ public class ActiveMQServerSideProtocolManagerFactory implements ClientProtocolManagerFactory { - ServerLocator locator; @Override @@ -64,4 +63,4 @@ public class ActiveMQServerSideProtocolManagerFactory implements ClientProtocolM return ServerPacketDecoder.INSTANCE; } } -} \ 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/server/cluster/BackupManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java index 105bea3..58a05f4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/BackupManager.java @@ -139,8 +139,7 @@ public class BackupManager implements ActiveMQComponent { DiscoveryBackupConnector backupConnector = new DiscoveryBackupConnector(dg, config.getName(), connector, config.getRetryInterval(), clusterManager); backupConnectors.add(backupConnector); - } - else { + } else { TransportConfiguration[] tcConfigs = config.getTransportConfigurations(configuration); StaticBackupConnector backupConnector = new StaticBackupConnector(tcConfigs, config.getName(), connector, config.getRetryInterval(), clusterManager); @@ -253,11 +252,9 @@ public class BackupManager implements ActiveMQComponent { ActiveMQServerLogger.LOGGER.backupAnnounced(); backupAnnounced = true; } - } - catch (RejectedExecutionException e) { + } catch (RejectedExecutionException e) { // assumption is that the whole server is being stopped. So the exception is ignored. - } - catch (Exception e) { + } catch (Exception e) { if (scheduledExecutor.isShutdown()) return; if (stopping) @@ -271,8 +268,7 @@ public class BackupManager implements ActiveMQComponent { } }, retryInterval, TimeUnit.MILLISECONDS); - } - finally { + } finally { announcingBackup = false; } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/Bridge.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/Bridge.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/Bridge.java index c6a9b73..7e8cacb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/Bridge.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/Bridge.java @@ -17,8 +17,8 @@ package org.apache.activemq.artemis.core.server.cluster; import org.apache.activemq.artemis.api.core.SimpleString; -import org.apache.activemq.artemis.core.server.Consumer; import org.apache.activemq.artemis.core.server.ActiveMQComponent; +import org.apache.activemq.artemis.core.server.Consumer; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.management.NotificationService; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterConnection.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterConnection.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterConnection.java index c47ff48..9392ed5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterConnection.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterConnection.java @@ -80,5 +80,4 @@ public interface ClusterConnection extends ActiveMQComponent, ClusterTopologyLis long getCallTimeout(); - } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterControl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterControl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterControl.java index 0956bc5..b37b9d5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterControl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterControl.java @@ -163,8 +163,7 @@ public class ClusterControl implements AutoCloseable { QuorumVoteHandler voteHandler = server.getClusterManager().getQuorumManager().getVoteHandler(replyMessage.getHandler()); replyMessage.decodeRest(voteHandler); return replyMessage.getVote(); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { return null; } } @@ -178,8 +177,7 @@ public class ClusterControl implements AutoCloseable { BackupResponseMessage packet; try { packet = (BackupResponseMessage) clusterChannel.sendBlocking(backupRequestMessage, PacketImpl.BACKUP_REQUEST_RESPONSE); - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { return false; } return packet.isBackupStarted(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java index ce8b14c..15595f8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java @@ -103,8 +103,7 @@ public class ClusterController implements ActiveMQComponent { ActiveMQServerLogger.LOGGER.noClusterConnectionForReplicationCluster(); replicationLocator = defaultLocator; } - } - else { + } else { replicationLocator = defaultLocator; } //latch so we know once we are connected @@ -331,22 +330,19 @@ public class ClusterController implements ActiveMQComponent { if (server.getConfiguration().isSecurityEnabled() && !clusterConnection.verify(msg.getClusterUser(), msg.getClusterPassword())) { clusterChannel.send(new ClusterConnectReplyMessage(false)); - } - else { + } else { authorized = true; clusterChannel.send(new ClusterConnectReplyMessage(true)); } } - } - else { + } else { if (packet.getType() == PacketImpl.NODE_ANNOUNCE) { NodeAnnounceMessage msg = (NodeAnnounceMessage) packet; Pair pair; if (msg.isBackup()) { pair = new Pair<>(null, msg.getConnector()); - } - else { + } else { pair = new Pair<>(msg.getConnector(), msg.getBackupConnector()); } if (logger.isTraceEnabled()) { @@ -358,30 +354,25 @@ public class ClusterController implements ActiveMQComponent { if (clusterConn != null) { String scaleDownGroupName = msg.getScaleDownGroupName(); clusterConn.nodeAnnounced(msg.getCurrentEventID(), msg.getNodeID(), msg.getBackupGroupName(), scaleDownGroupName, pair, msg.isBackup()); - } - else { + } else { logger.debug("Cluster connection is null on acceptor = " + acceptorUsed); } - } - else { + } else { logger.debug("there is no acceptor used configured at the CoreProtocolManager " + this); } - } - else if (packet.getType() == PacketImpl.QUORUM_VOTE) { + } else if (packet.getType() == PacketImpl.QUORUM_VOTE) { QuorumVoteMessage quorumVoteMessage = (QuorumVoteMessage) packet; QuorumVoteHandler voteHandler = quorumManager.getVoteHandler(quorumVoteMessage.getHandler()); quorumVoteMessage.decode(voteHandler); Vote vote = quorumManager.vote(quorumVoteMessage.getHandler(), quorumVoteMessage.getVote()); clusterChannel.send(new QuorumVoteReplyMessage(quorumVoteMessage.getHandler(), vote)); - } - else if (packet.getType() == PacketImpl.SCALEDOWN_ANNOUNCEMENT) { + } else if (packet.getType() == PacketImpl.SCALEDOWN_ANNOUNCEMENT) { ScaleDownAnnounceMessage message = (ScaleDownAnnounceMessage) packet; //we don't really need to check as it should always be true if (server.getNodeID().equals(message.getTargetNodeId())) { server.addScaledDownNode(message.getScaledDownNodeId()); } - } - else if (channelHandler != null) { + } else if (channelHandler != null) { channelHandler.handlePacket(packet); } } @@ -407,8 +398,7 @@ public class ClusterController implements ActiveMQComponent { if (serverLocator == replicationLocator) { replicationClusterConnectedLatch.countDown(); } - } - catch (ActiveMQException e) { + } catch (ActiveMQException e) { if (!started) { return; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 17eaae0..96fad97 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -200,11 +200,9 @@ public final class ClusterManager implements ActiveMQComponent { if (acceptorConfig == null) { // if the parameter is null, we just return whatever is defined on defaultClusterConnection return defaultClusterConnection; - } - else if (defaultClusterConnection != null && defaultClusterConnection.getConnector().isEquivalent(acceptorConfig)) { + } else if (defaultClusterConnection != null && defaultClusterConnection.getConnector().isEquivalent(acceptorConfig)) { return defaultClusterConnection; - } - else { + } else { for (ClusterConnection conn : cloneClusterConnections()) { if (conn.getConnector().isEquivalent(acceptorConfig)) { return conn; @@ -234,8 +232,7 @@ public final class ClusterManager implements ActiveMQComponent { public synchronized void deploy() throws Exception { if (state == State.STOPPED) { state = State.DEPLOYED; - } - else { + } else { throw new IllegalStateException(); } @@ -264,8 +261,7 @@ public final class ClusterManager implements ActiveMQComponent { for (BroadcastGroup group : broadcastGroups.values()) { try { group.start(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToStartBroadcastGroup(e, group.getName()); } } @@ -273,8 +269,7 @@ public final class ClusterManager implements ActiveMQComponent { for (ClusterConnection conn : clusterConnections.values()) { try { conn.start(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToStartClusterConnection(e, conn.getName()); } } @@ -284,8 +279,7 @@ public final class ClusterManager implements ActiveMQComponent { for (Bridge bridge : bridges.values()) { try { bridge.start(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.unableToStartBridge(e, bridge.getName()); } } @@ -336,8 +330,7 @@ public final class ClusterManager implements ActiveMQComponent { for (ServerLocatorInternal clusterLocator : clusterLocators) { try { clusterLocator.close(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorClosingServerLocator(e, clusterLocator); } } @@ -428,13 +421,11 @@ public final class ClusterManager implements ActiveMQComponent { if (config.isHA()) { serverLocator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(discoveryGroupConfiguration); - } - else { + } else { serverLocator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithoutHA(discoveryGroupConfiguration); } - } - else { + } else { TransportConfiguration[] tcConfigs = configuration.getTransportConfigurations(config.getStaticConnectors()); if (tcConfigs == null) { @@ -444,8 +435,7 @@ public final class ClusterManager implements ActiveMQComponent { if (config.isHA()) { serverLocator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(tcConfigs); - } - else { + } else { serverLocator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithoutHA(tcConfigs); } @@ -477,7 +467,7 @@ public final class ClusterManager implements ActiveMQComponent { if (!config.isUseDuplicateDetection()) { logger.debug("Bridge " + config.getName() + - " is configured to not use duplicate detecion, it will send messages synchronously"); + " is configured to not use duplicate detecion, it will send messages synchronously"); } clusterLocators.add(serverLocator); @@ -518,8 +508,7 @@ public final class ClusterManager implements ActiveMQComponent { public void run() { try { manager.stop(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } @@ -551,8 +540,7 @@ public final class ClusterManager implements ActiveMQComponent { for (Bridge bridge : bridges.values()) { try { bridge.stop(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } @@ -560,8 +548,7 @@ public final class ClusterManager implements ActiveMQComponent { for (ClusterConnection clusterConnection : clusterConnections.values()) { try { clusterConnection.stop(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } @@ -609,16 +596,15 @@ public final class ClusterManager implements ActiveMQComponent { if (logger.isDebugEnabled()) { logger.debug(this + " Starting a Discovery Group Cluster Connection, name=" + - config.getDiscoveryGroupName() + - ", dg=" + - dg); + config.getDiscoveryGroupName() + + ", dg=" + + dg); } clusterConnection = new ClusterConnectionImpl(this, dg, connector, new SimpleString(config.getName()), new SimpleString(config.getAddress()), config.getMinLargeMessageSize(), config.getClientFailureCheckPeriod(), config.getConnectionTTL(), config.getRetryInterval(), config.getRetryIntervalMultiplier(), config.getMaxRetryInterval(), config.getInitialConnectAttempts(), config.getReconnectAttempts(), config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), config.getProducerWindowSize(), executorFactory, server, postOffice, managementService, scheduledExecutor, config.getMaxHops(), nodeManager, server.getConfiguration().getClusterUser(), server.getConfiguration().getClusterPassword(), config.isAllowDirectConnectionsOnly(), config.getClusterNotificationInterval(), config.getClusterNotificationAttempts()); clusterController.addClusterConnection(clusterConnection.getName(), dg, config); - } - else { + } else { TransportConfiguration[] tcConfigs = config.getTransportConfigurations(configuration); if (logger.isDebugEnabled()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java index 249f60f..e730c71 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedHAManager.java @@ -68,8 +68,7 @@ public class ColocatedHAManager implements HAManager { for (ActiveMQServer activeMQServer : backupServers.values()) { try { activeMQServer.stop(); - } - catch (Exception e) { + } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } @@ -93,8 +92,7 @@ public class ColocatedHAManager implements HAManager { } if (haPolicy.getBackupPolicy().isSharedStore()) { return activateSharedStoreBackup(journalDirectory, bindingsDirectory, largeMessagesDirectory, pagingDirectory); - } - else { + } else { return activateReplicatedBackup(nodeID); } } @@ -129,8 +127,7 @@ public class ColocatedHAManager implements HAManager { clusterControl.authorize(); if (replicated) { return clusterControl.requestReplicatedBackup(backupSize, server.getNodeID()); - } - else { + } else { return clusterControl.requestSharedStoreBackup(backupSize, server.getConfiguration().getJournalLocation().getAbsolutePath(), server.getConfiguration().getBindingsLocation().getAbsolutePath(), server.getConfiguration().getLargeMessagesLocation().getAbsolutePath(), server.getConfiguration().getPagingLocation().getAbsolutePath()); } @@ -154,8 +151,7 @@ public class ColocatedHAManager implements HAManager { backupServers.put(configuration.getName(), backup); backup.start(); - } - catch (Exception e) { + } catch (Exception e) { backup.stop(); ActiveMQServerLogger.LOGGER.activateSharedStoreSlaveFailed(e); return false; @@ -188,8 +184,7 @@ public class ColocatedHAManager implements HAManager { backup.addActivationParam(ActivationParams.REPLICATION_ENDPOINT, member); backupServers.put(configuration.getName(), backup); backup.start(); - } - catch (Exception e) { + } catch (Exception e) { backup.stop(); ActiveMQServerLogger.LOGGER.activateReplicatedBackupFailed(e); return false; @@ -267,8 +262,7 @@ public class ColocatedHAManager implements HAManager { updatebackupParams(backupConfiguration.getName(), portOffset, entry.getValue().getParams()); } } - } - else { + } else { //if we are scaling down then we wont need any acceptors but clear anyway for belts and braces backupConfiguration.getAcceptorConfigurations().clear(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedPolicy.java index e507356..b1ace20 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ColocatedPolicy.java @@ -16,15 +16,15 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.artemis.core.server.impl.ColocatedActivation; -import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; -import org.apache.activemq.artemis.core.server.impl.LiveActivation; - import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; +import org.apache.activemq.artemis.core.server.impl.ColocatedActivation; +import org.apache.activemq.artemis.core.server.impl.LiveActivation; + public class ColocatedPolicy implements HAPolicy { /*live stuff*/ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/HAManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/HAManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/HAManager.java index 74107fc..d32d829 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/HAManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/HAManager.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.core.server.ActiveMQComponent; import org.apache.activemq.artemis.core.server.ActiveMQServer; -import java.util.Map; - /* * An HAManager takes care of any colocated backups in a VM. * */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/LiveOnlyPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/LiveOnlyPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/LiveOnlyPolicy.java index 9161e06..442c22d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/LiveOnlyPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/LiveOnlyPolicy.java @@ -16,12 +16,12 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation; -import java.util.Map; - public class LiveOnlyPolicy implements HAPolicy { private ScaleDownPolicy scaleDownPolicy; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java index d7f15b0..ba12677 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicaPolicy.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation; -import java.util.Map; - public class ReplicaPolicy extends BackupPolicy { private String clusterName; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java index e627eb9..9b64d81 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ReplicatedPolicy.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.LiveActivation; import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation; -import java.util.Map; - public class ReplicatedPolicy implements HAPolicy { private boolean checkForLiveServer = ActiveMQDefaultConfiguration.isDefaultCheckForLiveServer(); @@ -48,7 +48,10 @@ public class ReplicatedPolicy implements HAPolicy { replicaPolicy = new ReplicaPolicy(clusterName, -1, groupName, this); } - public ReplicatedPolicy(boolean checkForLiveServer, String groupName, String clusterName, long initialReplicationSyncTimeout) { + public ReplicatedPolicy(boolean checkForLiveServer, + String groupName, + String clusterName, + long initialReplicationSyncTimeout) { this.checkForLiveServer = checkForLiveServer; this.groupName = groupName; this.clusterName = clusterName; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ScaleDownPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ScaleDownPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ScaleDownPolicy.java index 1fcbd4d..0ef96d5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ScaleDownPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/ScaleDownPolicy.java @@ -102,16 +102,14 @@ public class ScaleDownPolicy { ActiveMQServer activeMQServer) throws ActiveMQException { if (!scaleDownPolicy.getConnectors().isEmpty()) { return (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(connectorNameListToArray(scaleDownPolicy.getConnectors(), activeMQServer)); - } - else if (scaleDownPolicy.getDiscoveryGroup() != null) { + } else if (scaleDownPolicy.getDiscoveryGroup() != null) { DiscoveryGroupConfiguration dg = activeMQServer.getConfiguration().getDiscoveryGroupConfigurations().get(scaleDownPolicy.getDiscoveryGroup()); if (dg == null) { throw ActiveMQMessageBundle.BUNDLE.noDiscoveryGroupFound(dg); } return (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(dg); - } - else { + } else { Map connectorConfigurations = activeMQServer.getConfiguration().getConnectorConfigurations(); for (TransportConfiguration transportConfiguration : connectorConfigurations.values()) { if (transportConfiguration.getFactoryClassName().equals(InVMConnectorFactory.class.getName())) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreMasterPolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreMasterPolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreMasterPolicy.java index d1fcb65..c2e669c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreMasterPolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreMasterPolicy.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.LiveActivation; import org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation; -import java.util.Map; - public class SharedStoreMasterPolicy implements HAPolicy { private boolean failoverOnServerShutdown = ActiveMQDefaultConfiguration.isDefaultFailoverOnServerShutdown(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreSlavePolicy.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreSlavePolicy.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreSlavePolicy.java index af6a955..5fa576b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreSlavePolicy.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/SharedStoreSlavePolicy.java @@ -16,13 +16,13 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; +import java.util.Map; + import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation; -import java.util.Map; - public class SharedStoreSlavePolicy extends BackupPolicy { private boolean failoverOnServerShutdown = ActiveMQDefaultConfiguration.isDefaultFailoverOnServerShutdown(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ec48f9ed/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/StandaloneHAManager.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/StandaloneHAManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/StandaloneHAManager.java index 3b0b908..3fe192e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/StandaloneHAManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ha/StandaloneHAManager.java @@ -16,11 +16,11 @@ */ package org.apache.activemq.artemis.core.server.cluster.ha; -import org.apache.activemq.artemis.core.server.ActiveMQServer; - import java.util.HashMap; import java.util.Map; +import org.apache.activemq.artemis.core.server.ActiveMQServer; + /* * this implementation doesn't really do anything at the minute but this may change so Im leaving it here, Andy... * */