Make bunch of private fields final
This commit is contained in:
parent
590578b3e4
commit
e98da5f288
|
@ -53,16 +53,16 @@ public class JDBCSequentialFile implements SequentialFile {
|
||||||
|
|
||||||
private long writePosition = 0;
|
private long writePosition = 0;
|
||||||
|
|
||||||
private Executor executor;
|
private final Executor executor;
|
||||||
|
|
||||||
private JDBCSequentialFileFactory fileFactory;
|
private final JDBCSequentialFileFactory fileFactory;
|
||||||
|
|
||||||
private final Object writeLock;
|
private final Object writeLock;
|
||||||
|
|
||||||
private final JDBCSequentialFileFactoryDriver dbDriver;
|
private final JDBCSequentialFileFactoryDriver dbDriver;
|
||||||
|
|
||||||
// Allows DB Drivers to cache meta data.
|
// 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,
|
public JDBCSequentialFile(final JDBCSequentialFileFactory fileFactory,
|
||||||
final String filename,
|
final String filename,
|
||||||
|
|
|
@ -39,11 +39,11 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
|
||||||
|
|
||||||
private boolean started;
|
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;
|
private final JDBCSequentialFileFactoryDriver dbDriver;
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
|
||||||
final String tableName,
|
final String tableName,
|
||||||
Executor executor) throws Exception {
|
Executor executor) throws Exception {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
files = new ArrayList<>();
|
|
||||||
dbDriver = JDBCUtils.getDBFileDriver(dataSource, tableName, sqlProvider);
|
dbDriver = JDBCUtils.getDBFileDriver(dataSource, tableName, sqlProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +60,6 @@ public class JDBCSequentialFileFactory implements SequentialFileFactory, ActiveM
|
||||||
final SQLProvider sqlProvider,
|
final SQLProvider sqlProvider,
|
||||||
Executor executor) throws Exception {
|
Executor executor) throws Exception {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
files = new ArrayList<>();
|
|
||||||
dbDriver = JDBCUtils.getDBFileDriver(className, connectionUrl, sqlProvider);
|
dbDriver = JDBCUtils.getDBFileDriver(className, connectionUrl, sqlProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class JDBCJournalImpl extends AbstractJDBCDriver implements Journal {
|
||||||
private Map<Long, TransactionHolder> transactions = new ConcurrentHashMap<>();
|
private Map<Long, TransactionHolder> transactions = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// Sequence ID for journal records
|
// 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) {
|
public JDBCJournalImpl(DataSource dataSource, SQLProvider provider, String tableName, ScheduledExecutorService scheduledExecutorService, Executor completeExecutor) {
|
||||||
super(dataSource, provider);
|
super(dataSource, provider);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ThreadAwareContext {
|
||||||
* Use a set because JMSContext can create more than one JMSConsumer
|
* Use a set because JMSContext can create more than one JMSConsumer
|
||||||
* to receive asynchronously from different destinations.
|
* 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
|
* Sets current thread to the context
|
||||||
|
|
|
@ -144,13 +144,13 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
||||||
private final AtomicBoolean asyncException = new AtomicBoolean(false);
|
private final AtomicBoolean asyncException = new AtomicBoolean(false);
|
||||||
|
|
||||||
// Clebert: Artemis session has meta-data support, perhaps we could reuse it here
|
// 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<ConsumerId, AMQConsumerBrokerExchange> consumerExchanges = new ConcurrentHashMap<>();
|
||||||
private final Map<ProducerId, AMQProducerBrokerExchange> producerExchanges = 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
|
// 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;
|
private ConnectionState state;
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
|
||||||
* But always without any association with Sessions.
|
* But always without any association with Sessions.
|
||||||
* This collection will hold nonXA transactions. Hopefully while they are in transit only.
|
* 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;
|
private volatile AMQSession advisorySession;
|
||||||
|
|
||||||
|
|
|
@ -115,9 +115,9 @@ public class ActiveMQActivation {
|
||||||
|
|
||||||
private ActiveMQConnectionFactory factory;
|
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;
|
private boolean lastReceived = false;
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ import org.w3c.dom.Document;
|
||||||
@Path(Constants.PATH_FOR_QUEUES)
|
@Path(Constants.PATH_FOR_QUEUES)
|
||||||
public class QueueDestinationsResource {
|
public class QueueDestinationsResource {
|
||||||
|
|
||||||
private Map<String, QueueResource> queues = new ConcurrentHashMap<>();
|
private final Map<String, QueueResource> queues = new ConcurrentHashMap<>();
|
||||||
private QueueServiceManager manager;
|
private final QueueServiceManager manager;
|
||||||
|
|
||||||
public QueueDestinationsResource(QueueServiceManager manager) {
|
public QueueDestinationsResource(QueueServiceManager manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
|
|
@ -46,8 +46,8 @@ import org.w3c.dom.Document;
|
||||||
@Path("/topics")
|
@Path("/topics")
|
||||||
public class TopicDestinationsResource {
|
public class TopicDestinationsResource {
|
||||||
|
|
||||||
private Map<String, TopicResource> topics = new ConcurrentHashMap<>();
|
private final Map<String, TopicResource> topics = new ConcurrentHashMap<>();
|
||||||
private TopicServiceManager manager;
|
private final TopicServiceManager manager;
|
||||||
|
|
||||||
public TopicDestinationsResource(TopicServiceManager manager) {
|
public TopicDestinationsResource(TopicServiceManager manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ClusterController implements ActiveMQComponent {
|
||||||
|
|
||||||
private final ActiveMQServer server;
|
private final ActiveMQServer server;
|
||||||
|
|
||||||
private Map<SimpleString, ServerLocatorInternal> locators = new HashMap<>();
|
private final Map<SimpleString, ServerLocatorInternal> locators = new HashMap<>();
|
||||||
|
|
||||||
private SimpleString defaultClusterConnectionName;
|
private SimpleString defaultClusterConnectionName;
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ public class ClusterController implements ActiveMQComponent {
|
||||||
*/
|
*/
|
||||||
private final class ConnectRunnable implements Runnable {
|
private final class ConnectRunnable implements Runnable {
|
||||||
|
|
||||||
private ServerLocatorInternal serverLocator;
|
private final ServerLocatorInternal serverLocator;
|
||||||
|
|
||||||
private ConnectRunnable(ServerLocatorInternal serverLocator) {
|
private ConnectRunnable(ServerLocatorInternal serverLocator) {
|
||||||
this.serverLocator = serverLocator;
|
this.serverLocator = serverLocator;
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ColocatedHAManager implements HAManager {
|
||||||
|
|
||||||
private final ActiveMQServer server;
|
private final ActiveMQServer server;
|
||||||
|
|
||||||
private Map<String, ActiveMQServer> backupServers = new HashMap<>();
|
private final Map<String, ActiveMQServer> backupServers = new HashMap<>();
|
||||||
|
|
||||||
private boolean started;
|
private boolean started;
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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.
|
* any currently running runnables.
|
||||||
|
@ -253,7 +253,7 @@ public final class QuorumManager implements ClusterTopologyListener, ActiveMQCom
|
||||||
|
|
||||||
private final class VoteRunnableHolder {
|
private final class VoteRunnableHolder {
|
||||||
|
|
||||||
private QuorumVote quorumVote;
|
private final QuorumVote quorumVote;
|
||||||
private final List<VoteRunnable> runnables;
|
private final List<VoteRunnable> runnables;
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract {
|
||||||
|
|
||||||
private ScheduledFuture reaperFuture;
|
private ScheduledFuture reaperFuture;
|
||||||
|
|
||||||
private long reaperPeriod;
|
private final long reaperPeriod;
|
||||||
|
|
||||||
public LocalGroupingHandler(final ExecutorFactory executorFactory,
|
public LocalGroupingHandler(final ExecutorFactory executorFactory,
|
||||||
final ScheduledExecutorService scheduledExecutor,
|
final ScheduledExecutorService scheduledExecutor,
|
||||||
|
|
|
@ -293,7 +293,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
||||||
|
|
||||||
private Activation activation;
|
private Activation activation;
|
||||||
|
|
||||||
private Map<String, Object> activationParams = new HashMap<>();
|
private final Map<String, Object> activationParams = new HashMap<>();
|
||||||
|
|
||||||
private final ShutdownOnCriticalErrorListener shutdownOnCriticalIO = new ShutdownOnCriticalErrorListener();
|
private final ShutdownOnCriticalErrorListener shutdownOnCriticalIO = new ShutdownOnCriticalErrorListener();
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
|
||||||
|
|
||||||
private boolean scheduledPoolSupplied = false;
|
private boolean scheduledPoolSupplied = false;
|
||||||
|
|
||||||
private ServiceRegistry serviceRegistry;
|
private final ServiceRegistry serviceRegistry;
|
||||||
|
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
|
|
|
@ -227,9 +227,9 @@ public class QueueImpl implements Queue {
|
||||||
|
|
||||||
private final ReusableLatch deliveriesInTransit = new ReusableLatch(0);
|
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;
|
private ScheduledFuture slowConsumerReaperFuture;
|
||||||
|
|
||||||
|
@ -3005,9 +3005,9 @@ public class QueueImpl implements Queue {
|
||||||
|
|
||||||
private final class SlowConsumerReaperRunnable implements Runnable {
|
private final class SlowConsumerReaperRunnable implements Runnable {
|
||||||
|
|
||||||
private SlowConsumerPolicy policy;
|
private final SlowConsumerPolicy policy;
|
||||||
private float threshold;
|
private final float threshold;
|
||||||
private long checkPeriod;
|
private final long checkPeriod;
|
||||||
|
|
||||||
private SlowConsumerReaperRunnable(long checkPeriod, float threshold, SlowConsumerPolicy policy) {
|
private SlowConsumerReaperRunnable(long checkPeriod, float threshold, SlowConsumerPolicy policy) {
|
||||||
this.checkPeriod = checkPeriod;
|
this.checkPeriod = checkPeriod;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class ReloadManagerImpl extends ActiveMQScheduledComponent implements Rel
|
||||||
|
|
||||||
private volatile Runnable tick;
|
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) {
|
public ReloadManagerImpl(ScheduledExecutorService scheduledExecutorService, Executor executor, long checkPeriod) {
|
||||||
super(scheduledExecutorService, executor, checkPeriod, TimeUnit.MILLISECONDS, false);
|
super(scheduledExecutorService, executor, checkPeriod, TimeUnit.MILLISECONDS, false);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements
|
||||||
|
|
||||||
private X509Certificate[] certificates;
|
private X509Certificate[] certificates;
|
||||||
private String username;
|
private String username;
|
||||||
private Set<Principal> principals = new HashSet<>();
|
private final Set<Principal> principals = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overriding to allow for proper initialization. Standard JAAS.
|
* Overriding to allow for proper initialization. Standard JAAS.
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class GuestLoginModule implements LoginModule {
|
||||||
private Subject subject;
|
private Subject subject;
|
||||||
private boolean debug;
|
private boolean debug;
|
||||||
private boolean credentialsInvalidate;
|
private boolean credentialsInvalidate;
|
||||||
private Set<Principal> principals = new HashSet<>();
|
private final Set<Principal> principals = new HashSet<>();
|
||||||
private CallbackHandler callbackHandler;
|
private CallbackHandler callbackHandler;
|
||||||
private boolean loginSucceeded;
|
private boolean loginSucceeded;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class InVMLoginModule implements LoginModule {
|
||||||
private SecurityConfiguration configuration;
|
private SecurityConfiguration configuration;
|
||||||
private Subject subject;
|
private Subject subject;
|
||||||
private String user;
|
private String user;
|
||||||
private Set<Principal> principals = new HashSet<>();
|
private final Set<Principal> principals = new HashSet<>();
|
||||||
private CallbackHandler callbackHandler;
|
private CallbackHandler callbackHandler;
|
||||||
private boolean loginSucceeded;
|
private boolean loginSucceeded;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class LDAPLoginModule implements LoginModule {
|
||||||
private CallbackHandler handler;
|
private CallbackHandler handler;
|
||||||
private LDAPLoginProperty[] config;
|
private LDAPLoginProperty[] config;
|
||||||
private String username;
|
private String username;
|
||||||
private Set<RolePrincipal> groups = new HashSet<>();
|
private final Set<RolePrincipal> groups = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
|
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
|
||||||
|
|
|
@ -48,9 +48,9 @@ public class FailoverPriorityTest extends OpenwireArtemisBaseTest {
|
||||||
private final HashMap<Integer, String> urls = new HashMap<>();
|
private final HashMap<Integer, String> urls = new HashMap<>();
|
||||||
|
|
||||||
private final List<ActiveMQConnection> connections = new ArrayList<>();
|
private final List<ActiveMQConnection> connections = new ArrayList<>();
|
||||||
private EmbeddedJMS[] servers = new EmbeddedJMS[3];
|
private final EmbeddedJMS[] servers = new EmbeddedJMS[3];
|
||||||
private String clientUrl;
|
private String clientUrl;
|
||||||
private Map<String, String> params = new HashMap<>();
|
private final Map<String, String> params = new HashMap<>();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class QueueDuplicatesTest extends TestCase {
|
||||||
|
|
||||||
private class SendingThread extends Thread {
|
private class SendingThread extends Thread {
|
||||||
|
|
||||||
private String subject;
|
private final String subject;
|
||||||
|
|
||||||
SendingThread(String brokerUrl, String subject) {
|
SendingThread(String brokerUrl, String subject) {
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
|
@ -149,7 +149,7 @@ public class QueueDuplicatesTest extends TestCase {
|
||||||
|
|
||||||
private static class SimpleConsumer implements MessageListener {
|
private static class SimpleConsumer implements MessageListener {
|
||||||
|
|
||||||
private Map<String, Message> msgs = new HashMap<>();
|
private final Map<String, Message> msgs = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Message message) {
|
public void onMessage(Message message) {
|
||||||
|
|
Loading…
Reference in New Issue