This closes #790

This commit is contained in:
Clebert Suconic 2016-09-23 09:06:09 -04:00
commit d64903fcc5
21 changed files with 39 additions and 41 deletions

View File

@ -53,16 +53,16 @@ public class JDBCSequentialFile implements SequentialFile {
private long writePosition = 0;
private Executor executor;
private final Executor executor;
private JDBCSequentialFileFactory fileFactory;
private final JDBCSequentialFileFactory fileFactory;
private final Object writeLock;
private final JDBCSequentialFileFactoryDriver dbDriver;
// Allows DB Drivers to cache meta data.
private Map<Object, Object> metaData = new ConcurrentHashMap<>();
private final Map<Object, Object> metaData = new ConcurrentHashMap<>();
public JDBCSequentialFile(final JDBCSequentialFileFactory fileFactory,
final String filename,

View File

@ -39,11 +39,11 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
private boolean started;
private List<JDBCSequentialFile> files;
private final List<JDBCSequentialFile> files = new ArrayList<>();
private Executor executor;
private final Executor executor;
private Map<String, Object> fileLocks = new HashMap<>();
private final Map<String, Object> fileLocks = new HashMap<>();
private final JDBCSequentialFileFactoryDriver dbDriver;
@ -52,7 +52,6 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
final String tableName,
Executor executor) throws Exception {
this.executor = executor;
files = new ArrayList<>();
dbDriver = JDBCUtils.getDBFileDriver(dataSource, tableName, sqlProvider);
}
@ -61,7 +60,6 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
final SQLProvider sqlProvider,
Executor executor) throws Exception {
this.executor = executor;
files = new ArrayList<>();
dbDriver = JDBCUtils.getDBFileDriver(className, connectionUrl, sqlProvider);
}

View File

@ -83,7 +83,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal {
private Map<Long, TransactionHolder> transactions = new ConcurrentHashMap<>();
// Sequence ID for journal records
private AtomicLong seq = new AtomicLong(0);
private final AtomicLong seq = new AtomicLong(0);
public JDBCJournalImpl(DataSource dataSource, SQLProvider provider, String tableName, ScheduledExecutorService scheduledExecutorService, Executor completeExecutor) {
super(dataSource, provider);

View File

@ -39,7 +39,7 @@ public class ThreadAwareContext {
* Use a set because JMSContext can create more than one JMSConsumer
* to receive asynchronously from different destinations.
*/
private Set<Long> messageListenerThreads = new ConcurrentHashSet<>();
private final Set<Long> messageListenerThreads = new ConcurrentHashSet<>();
/**
* Sets current thread to the context

View File

@ -144,13 +144,13 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
private final AtomicBoolean asyncException = new AtomicBoolean(false);
// Clebert: Artemis session has meta-data support, perhaps we could reuse it here
private Map<String, SessionId> sessionIdMap = new ConcurrentHashMap<>();
private final Map<String, SessionId> sessionIdMap = new ConcurrentHashMap<>();
private final Map<ConsumerId, AMQConsumerBrokerExchange> consumerExchanges = new ConcurrentHashMap<>();
private final Map<ProducerId, AMQProducerBrokerExchange> producerExchanges = new ConcurrentHashMap<>();
// Clebert TODO: Artemis already stores the Session. Why do we need a different one here
private Map<SessionId, AMQSession> sessions = new ConcurrentHashMap<>();
private final Map<SessionId, AMQSession> sessions = new ConcurrentHashMap<>();
private ConnectionState state;
@ -160,7 +160,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
* But always without any association with Sessions.
* This collection will hold nonXA transactions. Hopefully while they are in transit only.
*/
private Map<TransactionId, Transaction> txMap = new ConcurrentHashMap<>();
private final Map<TransactionId, Transaction> txMap = new ConcurrentHashMap<>();
private volatile AMQSession advisorySession;

View File

@ -115,9 +115,9 @@ public class ActiveMQActivation {
private ActiveMQConnectionFactory factory;
private List<String> nodes = Collections.synchronizedList(new ArrayList<String>());
private final List<String> nodes = Collections.synchronizedList(new ArrayList<String>());
private Map<String, Long> removedNodes = new ConcurrentHashMap<>();
private final Map<String, Long> removedNodes = new ConcurrentHashMap<>();
private boolean lastReceived = false;

View File

@ -45,8 +45,8 @@ import org.w3c.dom.Document;
@Path(Constants.PATH_FOR_QUEUES)
public class QueueDestinationsResource {
private Map<String, QueueResource> queues = new ConcurrentHashMap<>();
private QueueServiceManager manager;
private final Map<String, QueueResource> queues = new ConcurrentHashMap<>();
private final QueueServiceManager manager;
public QueueDestinationsResource(QueueServiceManager manager) {
this.manager = manager;

View File

@ -46,8 +46,8 @@ import org.w3c.dom.Document;
@Path("/topics")
public class TopicDestinationsResource {
private Map<String, TopicResource> topics = new ConcurrentHashMap<>();
private TopicServiceManager manager;
private final Map<String, TopicResource> topics = new ConcurrentHashMap<>();
private final TopicServiceManager manager;
public TopicDestinationsResource(TopicServiceManager manager) {
this.manager = manager;

View File

@ -69,7 +69,7 @@ public class ClusterController implements ActiveMQComponent {
private final ActiveMQServer server;
private Map<SimpleString, ServerLocatorInternal> locators = new HashMap<>();
private final Map<SimpleString, ServerLocatorInternal> locators = new HashMap<>();
private SimpleString defaultClusterConnectionName;
@ -394,7 +394,7 @@ public class ClusterController implements ActiveMQComponent {
*/
private final class ConnectRunnable implements Runnable {
private ServerLocatorInternal serverLocator;
private final ServerLocatorInternal serverLocator;
private ConnectRunnable(ServerLocatorInternal serverLocator) {
this.serverLocator = serverLocator;

View File

@ -38,7 +38,7 @@ public class ColocatedHAManager implements HAManager {
private final ActiveMQServer server;
private Map<String, ActiveMQServer> backupServers = new HashMap<>();
private final Map<String, ActiveMQServer> backupServers = new HashMap<>();
private boolean started;

View File

@ -46,7 +46,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
/**
* all the current registered {@link org.apache.activemq.artemis.core.server.cluster.qourum.Quorum}'s
*/
private Map<String, Quorum> quorums = new HashMap<>();
private final Map<String, Quorum> quorums = new HashMap<>();
/**
* any currently running runnables.
@ -253,7 +253,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
private final class VoteRunnableHolder {
private QuorumVote quorumVote;
private final QuorumVote quorumVote;
private final List<VoteRunnable> runnables;
private int size;

View File

@ -80,7 +80,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
private ScheduledFuture reaperFuture;
private long reaperPeriod;
private final long reaperPeriod;
public LocalGroupingHandler(final ExecutorFactory executorFactory,
final ScheduledExecutorService scheduledExecutor,

View File

@ -293,7 +293,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
private Activation activation;
private Map<String, Object> activationParams = new HashMap<>();
private final Map<String, Object> activationParams = new HashMap<>();
private final ShutdownOnCriticalErrorListener shutdownOnCriticalIO = new ShutdownOnCriticalErrorListener();
@ -306,7 +306,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
private boolean scheduledPoolSupplied = false;
private ServiceRegistry serviceRegistry;
private final ServiceRegistry serviceRegistry;
private Date startDate;

View File

@ -227,9 +227,9 @@ public class QueueImpl implements Queue {
private final ReusableLatch deliveriesInTransit = new ReusableLatch(0);
private AtomicLong queueRateCheckTime = new AtomicLong(System.currentTimeMillis());
private final AtomicLong queueRateCheckTime = new AtomicLong(System.currentTimeMillis());
private AtomicLong messagesAddedSnapshot = new AtomicLong(0);
private final AtomicLong messagesAddedSnapshot = new AtomicLong(0);
private ScheduledFuture slowConsumerReaperFuture;
@ -3005,9 +3005,9 @@ public class QueueImpl implements Queue {
private final class SlowConsumerReaperRunnable implements Runnable {
private SlowConsumerPolicy policy;
private float threshold;
private long checkPeriod;
private final SlowConsumerPolicy policy;
private final float threshold;
private final long checkPeriod;
private SlowConsumerReaperRunnable(long checkPeriod, float threshold, SlowConsumerPolicy policy) {
this.checkPeriod = checkPeriod;

View File

@ -36,7 +36,7 @@ public class ReloadManagerImpl extends ActiveMQScheduledComponent implements Rel
private volatile Runnable tick;
private Map<URL, ReloadRegistry> registry = new HashMap<>();
private final Map<URL, ReloadRegistry> registry = new HashMap<>();
public ReloadManagerImpl(ScheduledExecutorService scheduledExecutorService, Executor executor, long checkPeriod) {
super(scheduledExecutorService, executor, checkPeriod, TimeUnit.MILLISECONDS, false);

View File

@ -46,7 +46,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
private X509Certificate[] certificates;
private String username;
private Set<Principal> principals = new HashSet<>();
private final Set<Principal> principals = new HashSet<>();
/**
* Overriding to allow for proper initialization. Standard JAAS.

View File

@ -50,7 +50,7 @@ public class GuestLoginModule implements LoginModule {
private Subject subject;
private boolean debug;
private boolean credentialsInvalidate;
private Set<Principal> principals = new HashSet<>();
private final Set<Principal> principals = new HashSet<>();
private CallbackHandler callbackHandler;
private boolean loginSucceeded;

View File

@ -44,7 +44,7 @@ public class InVMLoginModule implements LoginModule {
private SecurityConfiguration configuration;
private Subject subject;
private String user;
private Set<Principal> principals = new HashSet<>();
private final Set<Principal> principals = new HashSet<>();
private CallbackHandler callbackHandler;
private boolean loginSucceeded;

View File

@ -82,7 +82,7 @@ public class LDAPLoginModule implements LoginModule {
private CallbackHandler handler;
private LDAPLoginProperty[] config;
private String username;
private Set<RolePrincipal> groups = new HashSet<>();
private final Set<RolePrincipal> groups = new HashSet<>();
@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {

View File

@ -48,9 +48,9 @@ public class FailoverPriorityTest extends OpenwireArtemisBaseTest {
private final HashMap<Integer, String> urls = new HashMap<>();
private final List<ActiveMQConnection> connections = new ArrayList<>();
private EmbeddedJMS[] servers = new EmbeddedJMS[3];
private final EmbeddedJMS[] servers = new EmbeddedJMS[3];
private String clientUrl;
private Map<String, String> params = new HashMap<>();
private final Map<String, String> params = new HashMap<>();
@Before
public void setUp() throws Exception {

View File

@ -118,7 +118,7 @@ public class QueueDuplicatesTest extends TestCase {
private class SendingThread extends Thread {
private String subject;
private final String subject;
SendingThread(String brokerUrl, String subject) {
this.subject = subject;
@ -149,7 +149,7 @@ public class QueueDuplicatesTest extends TestCase {
private static class SimpleConsumer implements MessageListener {
private Map<String, Message> msgs = new HashMap<>();
private final Map<String, Message> msgs = new HashMap<>();
@Override
public void onMessage(Message message) {