Remove redundant type arguments
This commit is contained in:
parent
3b5ee6c7ea
commit
f8a1c5ba8e
|
@ -53,7 +53,7 @@ public class Artemis {
|
|||
|
||||
/** This is a good method for booting an embedded command */
|
||||
public static Object execute(File fileHome, File fileInstance, String ... args) throws Throwable {
|
||||
ArrayList<File> dirs = new ArrayList<File>();
|
||||
ArrayList<File> dirs = new ArrayList<>();
|
||||
if (fileHome != null) {
|
||||
dirs.add(new File(fileHome, "lib"));
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class Artemis {
|
|||
}
|
||||
|
||||
|
||||
ArrayList<URL> urls = new ArrayList<URL>();
|
||||
ArrayList<URL> urls = new ArrayList<>();
|
||||
|
||||
// Without the etc on the config, things like JGroups configuration wouldn't be loaded
|
||||
if (fileInstance != null) {
|
||||
|
@ -79,7 +79,7 @@ public class Artemis {
|
|||
if (bootdir.exists() && bootdir.isDirectory()) {
|
||||
|
||||
// Find the jar files in the directory..
|
||||
ArrayList<File> files = new ArrayList<File>();
|
||||
ArrayList<File> files = new ArrayList<>();
|
||||
for (File f : bootdir.listFiles()) {
|
||||
if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) {
|
||||
files.add(f);
|
||||
|
|
|
@ -460,7 +460,7 @@ public class Create extends InputAbstract {
|
|||
|
||||
context.out.println(String.format("Creating ActiveMQ Artemis instance at: %s", directory.getCanonicalPath()));
|
||||
|
||||
HashMap<String, String> filters = new HashMap<String, String>();
|
||||
HashMap<String, String> filters = new HashMap<>();
|
||||
|
||||
filters.put("${master-slave}", isSlave() ? "slave" : "master");
|
||||
|
||||
|
@ -681,7 +681,7 @@ public class Create extends InputAbstract {
|
|||
|
||||
String writesPerMillisecondStr = new DecimalFormat("###.##").format(writesPerMillisecond);
|
||||
|
||||
HashMap<String, String> syncFilter = new HashMap<String, String>();
|
||||
HashMap<String, String> syncFilter = new HashMap<>();
|
||||
syncFilter.put("${nanoseconds}", Long.toString(nanoseconds));
|
||||
syncFilter.put("${writesPerMillisecond}", writesPerMillisecondStr);
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public class DecodeJournal extends LockAbstract {
|
|||
|
||||
String line;
|
||||
|
||||
HashMap<Long, AtomicInteger> txCounters = new HashMap<Long, AtomicInteger>();
|
||||
HashMap<Long, AtomicInteger> txCounters = new HashMap<>();
|
||||
|
||||
long lineNumber = 0;
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class PrintData extends LockAbstract {
|
|||
};
|
||||
final StorageManager sm = new NullStorageManager();
|
||||
PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null);
|
||||
HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>();
|
||||
HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>();
|
||||
addressSettingsRepository.setDefault(new AddressSettings());
|
||||
PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
|
||||
|
||||
|
@ -241,7 +241,7 @@ public class PrintData extends LockAbstract {
|
|||
Set<PagePosition> set = cursorInfo.getCursorRecords().get(encoding.queueID);
|
||||
|
||||
if (set == null) {
|
||||
set = new HashSet<PagePosition>();
|
||||
set = new HashSet<>();
|
||||
cursorInfo.getCursorRecords().put(encoding.queueID, set);
|
||||
}
|
||||
|
||||
|
@ -281,11 +281,11 @@ public class PrintData extends LockAbstract {
|
|||
|
||||
private static class PageCursorsInfo {
|
||||
|
||||
private final Map<Long, Set<PagePosition>> cursorRecords = new HashMap<Long, Set<PagePosition>>();
|
||||
private final Map<Long, Set<PagePosition>> cursorRecords = new HashMap<>();
|
||||
|
||||
private final Set<Long> pgTXs = new HashSet<Long>();
|
||||
private final Set<Long> pgTXs = new HashSet<>();
|
||||
|
||||
private final Map<Long, Set<Long>> completePages = new HashMap<Long, Set<Long>>();
|
||||
private final Map<Long, Set<Long>> completePages = new HashMap<>();
|
||||
|
||||
public PageCursorsInfo() {
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ public class PrintData extends LockAbstract {
|
|||
Set<Long> completePagesSet = completePages.get(queueID);
|
||||
|
||||
if (completePagesSet == null) {
|
||||
completePagesSet = new HashSet<Long>();
|
||||
completePagesSet = new HashSet<>();
|
||||
completePages.put(queueID, completePagesSet);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class FileBroker implements Broker {
|
|||
* will need impproving if we get more.
|
||||
* */
|
||||
public ArrayList<ActiveMQComponent> getComponentsByStartOrder(Map<String, ActiveMQComponent> components) {
|
||||
ArrayList<ActiveMQComponent> activeMQComponents = new ArrayList<ActiveMQComponent>();
|
||||
ArrayList<ActiveMQComponent> activeMQComponents = new ArrayList<>();
|
||||
ActiveMQComponent jmsComponent = components.get("jms");
|
||||
if (jmsComponent != null) {
|
||||
activeMQComponents.add(jmsComponent);
|
||||
|
|
|
@ -206,7 +206,7 @@ public enum ActiveMQExceptionType {
|
|||
private static final Map<Integer, ActiveMQExceptionType> TYPE_MAP;
|
||||
|
||||
static {
|
||||
HashMap<Integer, ActiveMQExceptionType> map = new HashMap<Integer, ActiveMQExceptionType>();
|
||||
HashMap<Integer, ActiveMQExceptionType> map = new HashMap<>();
|
||||
for (ActiveMQExceptionType type : EnumSet.allOf(ActiveMQExceptionType.class)) {
|
||||
map.put(type.getCode(), type);
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl
|
|||
// For that reason I'm allocating the ArrayList with 2 already
|
||||
// I have thought about using LinkedList here but I think this will be good enough already
|
||||
// Note by Clebert
|
||||
all = new ArrayList<SimpleString>(2);
|
||||
all = new ArrayList<>(2);
|
||||
}
|
||||
all.add(new SimpleString(bytes));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSe
|
|||
private static final Object dummy = new Object();
|
||||
|
||||
public ConcurrentHashSet() {
|
||||
theMap = new ConcurrentHashMap<E, Object>();
|
||||
theMap = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FactoryFinder {
|
|||
*/
|
||||
protected static class StandaloneObjectFactory implements ObjectFactory {
|
||||
|
||||
final ConcurrentMap<String, Class> classMap = new ConcurrentHashMap<String, Class>();
|
||||
final ConcurrentMap<String, Class> classMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class FileUtil {
|
|||
|
||||
public static void makeExec(File file) throws IOException {
|
||||
try {
|
||||
Files.setPosixFilePermissions(file.toPath(), new HashSet<PosixFilePermission>(Arrays.asList(OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, OTHERS_READ, OTHERS_EXECUTE)));
|
||||
Files.setPosixFilePermissions(file.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, OTHERS_READ, OTHERS_EXECUTE)));
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
// Our best effort was not good enough :)
|
||||
|
|
|
@ -63,7 +63,7 @@ public class PasswordMaskingUtil {
|
|||
});
|
||||
|
||||
if (parts.length > 1) {
|
||||
Map<String, String> props = new HashMap<String, String>();
|
||||
Map<String, String> props = new HashMap<>();
|
||||
|
||||
for (int i = 1; i < parts.length; i++) {
|
||||
String[] keyVal = parts[i].split("=");
|
||||
|
|
|
@ -71,7 +71,7 @@ public final class TypedProperties {
|
|||
}
|
||||
|
||||
public TypedProperties(final TypedProperties other) {
|
||||
properties = other.properties == null ? null : new HashMap<SimpleString, PropertyValue>(other.properties);
|
||||
properties = other.properties == null ? null : new HashMap<>(other.properties);
|
||||
size = other.size;
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ public final class TypedProperties {
|
|||
else {
|
||||
int numHeaders = buffer.readInt();
|
||||
|
||||
properties = new HashMap<SimpleString, PropertyValue>(numHeaders);
|
||||
properties = new HashMap<>(numHeaders);
|
||||
size = 0;
|
||||
|
||||
for (int i = 0; i < numHeaders; i++) {
|
||||
|
@ -546,7 +546,7 @@ public final class TypedProperties {
|
|||
|
||||
private void checkCreateProperties() {
|
||||
if (properties == null) {
|
||||
properties = new HashMap<SimpleString, PropertyValue>();
|
||||
properties = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -935,7 +935,7 @@ public final class TypedProperties {
|
|||
}
|
||||
|
||||
public Map<String, Object> getMap() {
|
||||
Map<String, Object> m = new HashMap<String, Object>();
|
||||
Map<String, Object> m = new HashMap<>();
|
||||
for (Entry<SimpleString, PropertyValue> entry : properties.entrySet()) {
|
||||
Object val = entry.getValue().getValue();
|
||||
if (val instanceof SimpleString) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public final class UTF8Util {
|
|||
|
||||
private static final boolean isTrace = ActiveMQUtilLogger.LOGGER.isTraceEnabled();
|
||||
|
||||
private static final ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<SoftReference<StringUtilBuffer>>();
|
||||
private static final ThreadLocal<SoftReference<StringUtilBuffer>> currenBuffer = new ThreadLocal<>();
|
||||
|
||||
public static void saveUTF(final ActiveMQBuffer out, final String str) {
|
||||
StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer();
|
||||
|
@ -149,7 +149,7 @@ public final class UTF8Util {
|
|||
StringUtilBuffer value;
|
||||
if (softReference == null) {
|
||||
value = new StringUtilBuffer();
|
||||
softReference = new SoftReference<StringUtilBuffer>(value);
|
||||
softReference = new SoftReference<>(value);
|
||||
UTF8Util.currenBuffer.set(softReference);
|
||||
}
|
||||
else {
|
||||
|
@ -158,7 +158,7 @@ public final class UTF8Util {
|
|||
|
||||
if (value == null) {
|
||||
value = new StringUtilBuffer();
|
||||
softReference = new SoftReference<StringUtilBuffer>(value);
|
||||
softReference = new SoftReference<>(value);
|
||||
UTF8Util.currenBuffer.set(softReference);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ public final class UUIDGenerator {
|
|||
try {
|
||||
networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
|
||||
List<NetworkInterface> ifaces = new ArrayList<NetworkInterface>();
|
||||
List<NetworkInterface> ifaces = new ArrayList<>();
|
||||
while (networkInterfaces.hasMoreElements()) {
|
||||
ifaces.add(networkInterfaces.nextElement());
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ public final class UUIDGenerator {
|
|||
final Method isLoopbackMethod,
|
||||
final Method isVirtualMethod) {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(ifaces.size());
|
||||
Collection<Callable<byte[]>> tasks = new ArrayList<Callable<byte[]>>(ifaces.size());
|
||||
Collection<Callable<byte[]>> tasks = new ArrayList<>(ifaces.size());
|
||||
|
||||
for (final NetworkInterface networkInterface : ifaces) {
|
||||
tasks.add(new Callable<byte[]>() {
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class URISchema<T, P> {
|
|||
public static Map<String, String> parseQuery(String uri,
|
||||
Map<String, String> propertyOverrides) throws URISyntaxException {
|
||||
try {
|
||||
Map<String, String> rc = new HashMap<String, String>();
|
||||
Map<String, String> rc = new HashMap<>();
|
||||
if (uri != null && !uri.isEmpty()) {
|
||||
String[] parameters = uri.split("&");
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public class PairTest extends Assert {
|
|||
|
||||
@Test
|
||||
public void testPair() {
|
||||
Pair<Integer, Integer> p = new Pair<Integer, Integer>(Integer.valueOf(12), Integer.valueOf(13));
|
||||
Pair<Integer, Integer> p = new Pair<>(Integer.valueOf(12), Integer.valueOf(13));
|
||||
int hash = p.hashCode();
|
||||
p.setA(null);
|
||||
assertTrue(hash != p.hashCode());
|
||||
|
|
|
@ -134,7 +134,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
|
|||
*/
|
||||
private static final class JGroupsReceiver extends ReceiverAdapter {
|
||||
|
||||
private final BlockingQueue<byte[]> dequeue = new LinkedBlockingDeque<byte[]>();
|
||||
private final BlockingQueue<byte[]> dequeue = new LinkedBlockingDeque<>();
|
||||
|
||||
@Override
|
||||
public void receive(org.jgroups.Message msg) {
|
||||
|
@ -160,7 +160,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint {
|
|||
int refCount = 1;
|
||||
JChannel channel;
|
||||
String channelName;
|
||||
final List<JGroupsReceiver> receivers = new ArrayList<JGroupsReceiver>();
|
||||
final List<JGroupsReceiver> receivers = new ArrayList<>();
|
||||
|
||||
public JChannelWrapper(String channelName, JChannel channel) throws Exception {
|
||||
this.refCount = 1;
|
||||
|
|
|
@ -310,7 +310,7 @@ public class TransportConfiguration implements Serializable {
|
|||
|
||||
if (params == null) {
|
||||
if (num > 0) {
|
||||
params = new HashMap<String, Object>();
|
||||
params = new HashMap<>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -209,7 +209,7 @@ public final class ManagementHelper {
|
|||
else if (val instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) val;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
Iterator<String> iter = jsonObject.keys();
|
||||
|
||||
|
@ -222,7 +222,7 @@ public final class ManagementHelper {
|
|||
innerVal = ManagementHelper.fromJSONArray(((JSONArray) innerVal));
|
||||
}
|
||||
else if (innerVal instanceof JSONObject) {
|
||||
Map<String, Object> innerMap = new HashMap<String, Object>();
|
||||
Map<String, Object> innerMap = new HashMap<>();
|
||||
JSONObject o = (JSONObject) innerVal;
|
||||
Iterator it = o.keys();
|
||||
while (it.hasNext()) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class AddressQueryImpl implements ClientSession.AddressQuery {
|
|||
final List<SimpleString> queueNames,
|
||||
final boolean autoCreateJmsQueues) {
|
||||
this.exists = exists;
|
||||
this.queueNames = new ArrayList<SimpleString>(queueNames);
|
||||
this.queueNames = new ArrayList<>(queueNames);
|
||||
this.autoCreateJmsQueues = autoCreateJmsQueues;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal {
|
|||
|
||||
private final int ackBatchSize;
|
||||
|
||||
private final PriorityLinkedList<ClientMessageInternal> buffer = new PriorityLinkedListImpl<ClientMessageInternal>(ClientConsumerImpl.NUM_PRIORITIES);
|
||||
private final PriorityLinkedList<ClientMessageInternal> buffer = new PriorityLinkedListImpl<>(ClientConsumerImpl.NUM_PRIORITIES);
|
||||
|
||||
private final Runner runner = new Runner();
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana
|
|||
|
||||
public static final int MAX_UNREFERENCED_CREDITS_CACHE_SIZE = 1000;
|
||||
|
||||
private final Map<SimpleString, ClientProducerCredits> producerCredits = new LinkedHashMap<SimpleString, ClientProducerCredits>();
|
||||
private final Map<SimpleString, ClientProducerCredits> producerCredits = new LinkedHashMap<>();
|
||||
|
||||
private final Map<SimpleString, ClientProducerCredits> unReferencedCredits = new LinkedHashMap<SimpleString, ClientProducerCredits>();
|
||||
private final Map<SimpleString, ClientProducerCredits> unReferencedCredits = new LinkedHashMap<>();
|
||||
|
||||
private final ClientSessionInternal session;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
|
||||
private final long connectionTTL;
|
||||
|
||||
private final Set<ClientSessionInternal> sessions = new HashSet<ClientSessionInternal>();
|
||||
private final Set<ClientSessionInternal> sessions = new HashSet<>();
|
||||
|
||||
private final Object createSessionLock = new Object();
|
||||
|
||||
|
@ -123,9 +123,9 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
|
||||
private int reconnectAttempts;
|
||||
|
||||
private final Set<SessionFailureListener> listeners = new ConcurrentHashSet<SessionFailureListener>();
|
||||
private final Set<SessionFailureListener> listeners = new ConcurrentHashSet<>();
|
||||
|
||||
private final Set<FailoverEventListener> failoverListeners = new ConcurrentHashSet<FailoverEventListener>();
|
||||
private final Set<FailoverEventListener> failoverListeners = new ConcurrentHashSet<>();
|
||||
|
||||
private Connector connector;
|
||||
|
||||
|
@ -222,7 +222,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
|
||||
confirmationWindowWarning = new ConfirmationWindowWarning(serverLocator.getConfirmationWindowSize() < 0);
|
||||
|
||||
lifeCycleListeners = new HashSet<ConnectionLifeCycleListener>();
|
||||
lifeCycleListeners = new HashSet<>();
|
||||
|
||||
connectionReadyForWrites = true;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
private void closeCleanSessions(boolean close) {
|
||||
HashSet<ClientSessionInternal> sessionsToClose;
|
||||
synchronized (sessions) {
|
||||
sessionsToClose = new HashSet<ClientSessionInternal>(sessions);
|
||||
sessionsToClose = new HashSet<>(sessions);
|
||||
}
|
||||
// work on a copied set. the session will be removed from sessions when session.close() is
|
||||
// called
|
||||
|
@ -633,7 +633,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
|
||||
if (connection == null) {
|
||||
synchronized (sessions) {
|
||||
sessionsToClose = new HashSet<ClientSessionInternal>(sessions);
|
||||
sessionsToClose = new HashSet<>(sessions);
|
||||
}
|
||||
callFailoverListeners(FailoverEventType.FAILOVER_FAILED);
|
||||
callSessionFailureListeners(me, true, false, scaleDownTargetNodeID);
|
||||
|
@ -697,7 +697,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
final boolean afterReconnect,
|
||||
final boolean failedOver,
|
||||
final String scaleDownTargetNodeID) {
|
||||
final List<SessionFailureListener> listenersClone = new ArrayList<SessionFailureListener>(listeners);
|
||||
final List<SessionFailureListener> listenersClone = new ArrayList<>(listeners);
|
||||
|
||||
for (final SessionFailureListener listener : listenersClone) {
|
||||
try {
|
||||
|
@ -741,7 +741,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
final ActiveMQException cause) {
|
||||
HashSet<ClientSessionInternal> sessionsToFailover;
|
||||
synchronized (sessions) {
|
||||
sessionsToFailover = new HashSet<ClientSessionInternal>(sessions);
|
||||
sessionsToFailover = new HashSet<>(sessions);
|
||||
}
|
||||
|
||||
for (ClientSessionInternal session : sessionsToFailover) {
|
||||
|
@ -1195,7 +1195,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
|
|||
private final WeakReference<PingRunnable> pingRunnable;
|
||||
|
||||
ActualScheduledPinger(final PingRunnable runnable) {
|
||||
pingRunnable = new WeakReference<PingRunnable>(runnable);
|
||||
pingRunnable = new WeakReference<>(runnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.apache.activemq.artemis.utils.XidCodecSupport;
|
|||
|
||||
public final class ClientSessionImpl implements ClientSessionInternal, FailureListener {
|
||||
|
||||
private final Map<String, String> metadata = new HashMap<String, String>();
|
||||
private final Map<String, String> metadata = new HashMap<>();
|
||||
|
||||
private final ClientSessionFactoryInternal sessionFactory;
|
||||
|
||||
|
@ -74,10 +74,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
/**
|
||||
* All access to producers are guarded (i.e. synchronized) on itself.
|
||||
*/
|
||||
private final Set<ClientProducerInternal> producers = new HashSet<ClientProducerInternal>();
|
||||
private final Set<ClientProducerInternal> producers = new HashSet<>();
|
||||
|
||||
// Consumers must be an ordered map so if we fail we recreate them in the same order with the same ids
|
||||
private final Map<ConsumerContext, ClientConsumerInternal> consumers = new LinkedHashMap<ConsumerContext, ClientConsumerInternal>();
|
||||
private final Map<ConsumerContext, ClientConsumerInternal> consumers = new LinkedHashMap<>();
|
||||
|
||||
private volatile boolean closed;
|
||||
|
||||
|
@ -1012,7 +1012,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
HashMap<String, String> metaDataToSend;
|
||||
|
||||
synchronized (metadata) {
|
||||
metaDataToSend = new HashMap<String, String>(metadata);
|
||||
metaDataToSend = new HashMap<>(metadata);
|
||||
}
|
||||
|
||||
sessionContext.resetMetadata(metaDataToSend);
|
||||
|
@ -1652,7 +1652,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
Set<ClientProducerInternal> producersClone;
|
||||
|
||||
synchronized (producers) {
|
||||
producersClone = new HashSet<ClientProducerInternal>(producers);
|
||||
producersClone = new HashSet<>(producers);
|
||||
}
|
||||
return producersClone;
|
||||
}
|
||||
|
@ -1664,7 +1664,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
|
|||
*/
|
||||
public Set<ClientConsumerInternal> cloneConsumers() {
|
||||
synchronized (consumers) {
|
||||
return new HashSet<ClientConsumerInternal>(consumers.values());
|
||||
return new HashSet<>(consumers.values());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DelegatingSession implements ClientSessionInternal {
|
|||
|
||||
private volatile boolean closed;
|
||||
|
||||
private static Set<DelegatingSession> sessions = new ConcurrentHashSet<DelegatingSession>();
|
||||
private static Set<DelegatingSession> sessions = new ConcurrentHashSet<>();
|
||||
|
||||
public static volatile boolean debug;
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
|||
|
||||
private transient String identity;
|
||||
|
||||
private final Set<ClientSessionFactoryInternal> factories = new HashSet<ClientSessionFactoryInternal>();
|
||||
private final Set<ClientSessionFactoryInternal> factories = new HashSet<>();
|
||||
|
||||
private final Set<ClientSessionFactoryInternal> connectingFactories = new HashSet<ClientSessionFactoryInternal>();
|
||||
private final Set<ClientSessionFactoryInternal> connectingFactories = new HashSet<>();
|
||||
|
||||
private volatile TransportConfiguration[] initialConnectors;
|
||||
|
||||
|
@ -183,9 +183,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
|||
private transient STATE state;
|
||||
private transient CountDownLatch latch;
|
||||
|
||||
private final List<Interceptor> incomingInterceptors = new CopyOnWriteArrayList<Interceptor>();
|
||||
private final List<Interceptor> incomingInterceptors = new CopyOnWriteArrayList<>();
|
||||
|
||||
private final List<Interceptor> outgoingInterceptors = new CopyOnWriteArrayList<Interceptor>();
|
||||
private final List<Interceptor> outgoingInterceptors = new CopyOnWriteArrayList<>();
|
||||
|
||||
private static ExecutorService globalThreadPool;
|
||||
|
||||
|
@ -1427,7 +1427,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
|||
|
||||
Set<ClientSessionFactoryInternal> clonedFactory;
|
||||
synchronized (factories) {
|
||||
clonedFactory = new HashSet<ClientSessionFactoryInternal>(factories);
|
||||
clonedFactory = new HashSet<>(factories);
|
||||
|
||||
factories.clear();
|
||||
}
|
||||
|
@ -1536,7 +1536,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
|||
TopologyMember actMember = topology.getMember(nodeID);
|
||||
|
||||
if (actMember != null && actMember.getLive() != null && actMember.getBackup() != null) {
|
||||
HashSet<ClientSessionFactory> clonedFactories = new HashSet<ClientSessionFactory>();
|
||||
HashSet<ClientSessionFactory> clonedFactories = new HashSet<>();
|
||||
synchronized (factories) {
|
||||
clonedFactories.addAll(factories);
|
||||
}
|
||||
|
@ -1802,7 +1802,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
|
|||
}
|
||||
}
|
||||
}
|
||||
connectors = new ArrayList<Connector>();
|
||||
connectors = new ArrayList<>();
|
||||
if (initialConnectors != null) {
|
||||
for (TransportConfiguration initialConnector : initialConnectors) {
|
||||
ClientSessionFactoryInternal factory = new ClientSessionFactoryImpl(ServerLocatorImpl.this, initialConnector, callTimeout, callFailoverTimeout, clientFailureCheckPeriod, connectionTTL, retryInterval, retryIntervalMultiplier, maxRetryInterval, reconnectAttempts, threadPool, scheduledThreadPool, incomingInterceptors, outgoingInterceptors);
|
||||
|
|
|
@ -345,7 +345,7 @@ public final class Topology {
|
|||
final Map<String, TopologyMemberImpl> copy;
|
||||
|
||||
synchronized (Topology.this) {
|
||||
copy = new HashMap<String, TopologyMemberImpl>(topology);
|
||||
copy = new HashMap<>(topology);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, TopologyMemberImpl> entry : copy.entrySet()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public final class TopologyMemberImpl implements TopologyMember {
|
|||
this.nodeId = nodeId;
|
||||
this.backupGroupName = backupGroupName;
|
||||
this.scaleDownGroupName = scaleDownGroupName;
|
||||
this.connector = new Pair<TransportConfiguration, TransportConfiguration>(a, b);
|
||||
this.connector = new Pair<>(a, b);
|
||||
uniqueEventID = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
|
|||
|
||||
private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled();
|
||||
|
||||
private final List<DiscoveryListener> listeners = new ArrayList<DiscoveryListener>();
|
||||
private final List<DiscoveryListener> listeners = new ArrayList<>();
|
||||
|
||||
private final String name;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
|
|||
|
||||
private final Object waitLock = new Object();
|
||||
|
||||
private final Map<String, DiscoveryEntry> connectors = new ConcurrentHashMap<String, DiscoveryEntry>();
|
||||
private final Map<String, DiscoveryEntry> connectors = new ConcurrentHashMap<>();
|
||||
|
||||
private final long timeout;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
|
|||
|
||||
private final String nodeID;
|
||||
|
||||
private final Map<String, String> uniqueIDMap = new HashMap<String, String>();
|
||||
private final Map<String, String> uniqueIDMap = new HashMap<>();
|
||||
|
||||
private final BroadcastEndpoint endpoint;
|
||||
|
||||
|
@ -192,7 +192,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
|
|||
}
|
||||
|
||||
public synchronized List<DiscoveryEntry> getDiscoveryEntries() {
|
||||
List<DiscoveryEntry> list = new ArrayList<DiscoveryEntry>(connectors.values());
|
||||
List<DiscoveryEntry> list = new ArrayList<>(connectors.values());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -408,7 +408,7 @@ public abstract class MessageImpl implements MessageInternal {
|
|||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
map.put("messageID", messageID);
|
||||
if (userID != null) {
|
||||
|
|
|
@ -130,7 +130,7 @@ public final class ChannelImpl implements Channel {
|
|||
this.confWindowSize = confWindowSize;
|
||||
|
||||
if (confWindowSize != -1) {
|
||||
resendCache = new ConcurrentLinkedQueue<Packet>();
|
||||
resendCache = new ConcurrentLinkedQueue<>();
|
||||
}
|
||||
else {
|
||||
resendCache = null;
|
||||
|
|
|
@ -52,7 +52,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
|
|||
// -----------------------------------------------------------------------------------
|
||||
private final PacketDecoder packetDecoder;
|
||||
|
||||
private final Map<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>();
|
||||
private final Map<Long, Channel> channels = new ConcurrentHashMap<>();
|
||||
|
||||
private final long blockingCallTimeout;
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement
|
|||
// method is
|
||||
// complete
|
||||
|
||||
Set<Channel> allChannels = new HashSet<Channel>(channels.values());
|
||||
Set<Channel> allChannels = new HashSet<>(channels.values());
|
||||
|
||||
if (!criticalError) {
|
||||
removeAllChannels();
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ClusterTopologyChangeMessage extends PacketImpl {
|
|||
else {
|
||||
b = null;
|
||||
}
|
||||
pair = new Pair<TransportConfiguration, TransportConfiguration>(a, b);
|
||||
pair = new Pair<>(a, b);
|
||||
last = buffer.readBoolean();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class ClusterTopologyChangeMessage_V2 extends ClusterTopologyChangeMessag
|
|||
else {
|
||||
b = null;
|
||||
}
|
||||
pair = new Pair<TransportConfiguration, TransportConfiguration>(a, b);
|
||||
pair = new Pair<>(a, b);
|
||||
last = buffer.readBoolean();
|
||||
}
|
||||
if (buffer.readableBytes() > 0) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SessionBindingQueryResponseMessage extends PacketImpl {
|
|||
public void decodeRest(final ActiveMQBuffer buffer) {
|
||||
exists = buffer.readBoolean();
|
||||
int numQueues = buffer.readInt();
|
||||
queueNames = new ArrayList<SimpleString>(numQueues);
|
||||
queueNames = new ArrayList<>(numQueues);
|
||||
for (int i = 0; i < numQueues; i++) {
|
||||
queueNames.add(buffer.readSimpleString());
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl {
|
|||
@Override
|
||||
public void decodeRest(final ActiveMQBuffer buffer) {
|
||||
int len = buffer.readInt();
|
||||
xids = new ArrayList<Xid>(len);
|
||||
xids = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xid xid = XidCodecSupport.decodeXid(buffer);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class TransportConfigurationUtil {
|
|||
}
|
||||
|
||||
private static Map<String, Object> cloneDefaults(Map<String, Object> defaults) {
|
||||
Map<String, Object> cloned = new HashMap<String, Object>();
|
||||
Map<String, Object> cloned = new HashMap<>();
|
||||
for (Map.Entry entry : defaults.entrySet()) {
|
||||
cloned.put((String) entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class NettyConnection implements Connection {
|
|||
|
||||
private final Semaphore writeLock = new Semaphore(1);
|
||||
|
||||
private final Set<ReadyListener> readyListeners = new ConcurrentHashSet<ReadyListener>();
|
||||
private final Set<ReadyListener> readyListeners = new ConcurrentHashSet<>();
|
||||
|
||||
private RemotingConnection protocolConnection;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class NettyConnector extends AbstractConnector {
|
|||
ResourceLeakDetector.setEnabled(false);
|
||||
|
||||
// Set default Configuration
|
||||
Map<String, Object> config = new HashMap<String, Object>();
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST);
|
||||
config.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT);
|
||||
DEFAULT_CONFIG = Collections.unmodifiableMap(config);
|
||||
|
@ -202,7 +202,7 @@ public class NettyConnector extends AbstractConnector {
|
|||
|
||||
private long batchDelay;
|
||||
|
||||
private ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<Object, Connection>();
|
||||
private ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<>();
|
||||
|
||||
private String servletPath;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class SharedNioEventLoopGroup extends NioEventLoopGroup {
|
|||
|
||||
private static SharedNioEventLoopGroup instance;
|
||||
|
||||
private final AtomicReference<ScheduledFuture<?>> shutdown = new AtomicReference<ScheduledFuture<?>>();
|
||||
private final AtomicReference<ScheduledFuture<?>> shutdown = new AtomicReference<>();
|
||||
private final AtomicLong nioChannelFactoryCount = new AtomicLong();
|
||||
private final Promise<?> terminationPromise = ImmediateEventExecutor.INSTANCE.newPromise();
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ public class TransportConstants {
|
|||
public static final long DEFAULT_CONNECTIONS_ALLOWED = -1L;
|
||||
|
||||
static {
|
||||
Set<String> allowableAcceptorKeys = new HashSet<String>();
|
||||
Set<String> allowableAcceptorKeys = new HashSet<>();
|
||||
allowableAcceptorKeys.add(TransportConstants.SSL_ENABLED_PROP_NAME);
|
||||
allowableAcceptorKeys.add(TransportConstants.HTTP_RESPONSE_TIME_PROP_NAME);
|
||||
allowableAcceptorKeys.add(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME);
|
||||
|
@ -237,7 +237,7 @@ public class TransportConstants {
|
|||
|
||||
ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
|
||||
|
||||
Set<String> allowableConnectorKeys = new HashSet<String>();
|
||||
Set<String> allowableConnectorKeys = new HashSet<>();
|
||||
allowableConnectorKeys.add(TransportConstants.SSL_ENABLED_PROP_NAME);
|
||||
allowableConnectorKeys.add(TransportConstants.HTTP_ENABLED_PROP_NAME);
|
||||
allowableConnectorKeys.add(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME);
|
||||
|
|
|
@ -124,7 +124,7 @@ public class MessageUtil {
|
|||
|
||||
public static void clearProperties(Message message) {
|
||||
|
||||
List<SimpleString> toRemove = new ArrayList<SimpleString>();
|
||||
List<SimpleString> toRemove = new ArrayList<>();
|
||||
|
||||
for (SimpleString propName : message.getPropertyNames()) {
|
||||
if (!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
|
||||
|
@ -139,7 +139,7 @@ public class MessageUtil {
|
|||
}
|
||||
|
||||
public static Set<String> getPropertyNames(Message message) {
|
||||
HashSet<String> set = new HashSet<String>();
|
||||
HashSet<String> set = new HashSet<>();
|
||||
|
||||
for (SimpleString propName : message.getPropertyNames()) {
|
||||
if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
|
||||
|
|
|
@ -32,8 +32,8 @@ import org.apache.activemq.artemis.spi.core.remoting.Connection;
|
|||
|
||||
public abstract class AbstractRemotingConnection implements RemotingConnection {
|
||||
|
||||
protected final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
|
||||
protected final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
|
||||
protected final List<FailureListener> failureListeners = new CopyOnWriteArrayList<>();
|
||||
protected final List<CloseListener> closeListeners = new CopyOnWriteArrayList<>();
|
||||
protected final Connection transportConnection;
|
||||
protected final Executor executor;
|
||||
protected final long creationTime;
|
||||
|
@ -47,11 +47,11 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
|
|||
|
||||
@Override
|
||||
public List<FailureListener> getFailureListeners() {
|
||||
return new ArrayList<FailureListener>(failureListeners);
|
||||
return new ArrayList<>(failureListeners);
|
||||
}
|
||||
|
||||
protected void callFailureListeners(final ActiveMQException me, String scaleDownTargetNodeID) {
|
||||
final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
|
||||
final List<FailureListener> listenersClone = new ArrayList<>(failureListeners);
|
||||
|
||||
for (final FailureListener listener : listenersClone) {
|
||||
try {
|
||||
|
@ -71,7 +71,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
|
|||
}
|
||||
|
||||
protected void callClosingListeners() {
|
||||
final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
|
||||
final List<CloseListener> listenersClone = new ArrayList<>(closeListeners);
|
||||
|
||||
for (final CloseListener listener : listenersClone) {
|
||||
try {
|
||||
|
@ -140,7 +140,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection {
|
|||
|
||||
@Override
|
||||
public List<CloseListener> removeCloseListeners() {
|
||||
List<CloseListener> ret = new ArrayList<CloseListener>(closeListeners);
|
||||
List<CloseListener> ret = new ArrayList<>(closeListeners);
|
||||
|
||||
closeListeners.clear();
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ConfigurationHelper {
|
|||
}
|
||||
|
||||
public static Set<String> checkKeys(final Set<String> allowableKeys, final Set<String> keys) {
|
||||
Set<String> invalid = new HashSet<String>();
|
||||
Set<String> invalid = new HashSet<>();
|
||||
|
||||
for (String key : keys) {
|
||||
if (!allowableKeys.contains(key)) {
|
||||
|
@ -135,7 +135,7 @@ public class ConfigurationHelper {
|
|||
}
|
||||
|
||||
public static Set<String> checkKeysExist(final Set<String> requiredKeys, final Set<String> keys) {
|
||||
Set<String> invalid = new HashSet<String>(requiredKeys);
|
||||
Set<String> invalid = new HashSet<>(requiredKeys);
|
||||
|
||||
for (String key : keys) {
|
||||
if (requiredKeys.contains(key)) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
|
|||
|
||||
private static final int INITIAL_ITERATOR_ARRAY_SIZE = 10;
|
||||
|
||||
private final Node<E> head = new Node<E>(null);
|
||||
private final Node<E> head = new Node<>(null);
|
||||
|
||||
private Node<E> tail = null;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
|
|||
|
||||
@Override
|
||||
public void addHead(E e) {
|
||||
Node<E> node = new Node<E>(e);
|
||||
Node<E> node = new Node<>(e);
|
||||
|
||||
node.next = head.next;
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class LinkedListImpl<E> implements LinkedList<E> {
|
|||
addHead(e);
|
||||
}
|
||||
else {
|
||||
Node<E> node = new Node<E>(e);
|
||||
Node<E> node = new Node<>(e);
|
||||
|
||||
node.prev = tail;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public class MemorySize {
|
|||
}
|
||||
|
||||
private static void forceGC() {
|
||||
WeakReference<Object> dumbReference = new WeakReference<Object>(new Object());
|
||||
WeakReference<Object> dumbReference = new WeakReference<>(new Object());
|
||||
// A loop that will wait GC, using the minimal time as possible
|
||||
while (dumbReference.get() != null) {
|
||||
System.gc();
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory {
|
|||
*/
|
||||
private static final class OrderedExecutor implements Executor {
|
||||
|
||||
private final ConcurrentLinkedQueue<Runnable> tasks = new ConcurrentLinkedQueue<Runnable>();
|
||||
private final ConcurrentLinkedQueue<Runnable> tasks = new ConcurrentLinkedQueue<>();
|
||||
|
||||
// @protected by tasks
|
||||
private boolean running;
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PriorityLinkedListImpl<T> implements PriorityLinkedList<T> {
|
|||
levels = (LinkedListImpl<T>[]) Array.newInstance(LinkedListImpl.class, priorities);
|
||||
|
||||
for (int i = 0; i < priorities; i++) {
|
||||
levels[i] = new LinkedListImpl<T>();
|
||||
levels[i] = new LinkedListImpl<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SecurityFormatter {
|
|||
List<String> consume = toList(consumeRoles);
|
||||
List<String> manage = toList(manageRoles);
|
||||
|
||||
Set<String> allRoles = new HashSet<String>();
|
||||
Set<String> allRoles = new HashSet<>();
|
||||
allRoles.addAll(createDurableQueue);
|
||||
allRoles.addAll(deleteDurableQueue);
|
||||
allRoles.addAll(createNonDurableQueue);
|
||||
|
@ -49,7 +49,7 @@ public class SecurityFormatter {
|
|||
allRoles.addAll(consume);
|
||||
allRoles.addAll(manage);
|
||||
|
||||
Set<Role> roles = new HashSet<Role>(allRoles.size());
|
||||
Set<Role> roles = new HashSet<>(allRoles.size());
|
||||
for (String role : allRoles) {
|
||||
roles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role)));
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class SecurityFormatter {
|
|||
}
|
||||
|
||||
private static List<String> toList(final String commaSeparatedString) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> list = new ArrayList<>();
|
||||
if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0) {
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
|
|||
|
||||
// The soft references that are already good.
|
||||
// too bad there's no way to override the queue method on ReferenceQueue, so I wouldn't need this
|
||||
private final ReferenceQueue<V> refQueue = new ReferenceQueue<V>();
|
||||
private final ReferenceQueue<V> refQueue = new ReferenceQueue<>();
|
||||
|
||||
private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<K, AggregatedSoftReference>();
|
||||
private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<>();
|
||||
|
||||
private final AtomicLong usedCounter = new AtomicLong(0);
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
|
|||
|
||||
private void checkCacheSize() {
|
||||
if (maxElements > 0 && mapDelegate.size() > maxElements) {
|
||||
TreeSet<AggregatedSoftReference> usedReferences = new TreeSet<AggregatedSoftReference>(new ComparatorAgregated());
|
||||
TreeSet<AggregatedSoftReference> usedReferences = new TreeSet<>(new ComparatorAgregated());
|
||||
|
||||
for (AggregatedSoftReference ref : mapDelegate.values()) {
|
||||
V v = ref.get();
|
||||
|
@ -260,7 +260,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
|
|||
@Override
|
||||
public Collection<V> values() {
|
||||
processQueue();
|
||||
ArrayList<V> list = new ArrayList<V>();
|
||||
ArrayList<V> list = new ArrayList<>();
|
||||
|
||||
for (AggregatedSoftReference refs : mapDelegate.values()) {
|
||||
V value = refs.get();
|
||||
|
@ -278,11 +278,11 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
|
|||
@Override
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
processQueue();
|
||||
HashSet<Map.Entry<K, V>> set = new HashSet<Map.Entry<K, V>>();
|
||||
HashSet<Map.Entry<K, V>> set = new HashSet<>();
|
||||
for (Map.Entry<K, AggregatedSoftReference> pair : mapDelegate.entrySet()) {
|
||||
V value = pair.getValue().get();
|
||||
if (value != null) {
|
||||
set.add(new EntryElement<K, V>(pair.getKey(), value));
|
||||
set.add(new EntryElement<>(pair.getKey(), value));
|
||||
}
|
||||
}
|
||||
return set;
|
||||
|
|
|
@ -118,7 +118,7 @@ public final class VersionLoader {
|
|||
int microVersion = Integer.valueOf(versionProps.getProperty("activemq.version.microVersion"));
|
||||
int[] incrementingVersions = parseCompatibleVersionList(versionProps.getProperty("activemq.version.incrementingVersion"));
|
||||
int[] compatibleVersionArray = parseCompatibleVersionList(versionProps.getProperty("activemq.version.compatibleVersionList"));
|
||||
List<Version> definedVersions = new ArrayList<Version>(incrementingVersions.length);
|
||||
List<Version> definedVersions = new ArrayList<>(incrementingVersions.length);
|
||||
for (int incrementingVersion : incrementingVersions) {
|
||||
definedVersions.add(new VersionImpl(versionName, majorVersion, minorVersion, microVersion, incrementingVersion, compatibleVersionArray));
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ public final class XMLUtil {
|
|||
}
|
||||
|
||||
private static List<Node> filter(final NodeList nl, final short[] typesToFilter) {
|
||||
List<Node> nodes = new ArrayList<Node>();
|
||||
List<Node> nodes = new ArrayList<>();
|
||||
|
||||
outer:
|
||||
for (int i = 0; i < nl.getLength(); i++) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class JSONArray {
|
|||
* Construct an empty JSONArray.
|
||||
*/
|
||||
public JSONArray() {
|
||||
myArrayList = new ArrayList<Object>();
|
||||
myArrayList = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,7 +161,7 @@ public class JSONArray {
|
|||
* @param collection A Collection.
|
||||
*/
|
||||
public JSONArray(final Collection collection) {
|
||||
myArrayList = collection == null ? new ArrayList<Object>() : new ArrayList<Object>(collection);
|
||||
myArrayList = collection == null ? new ArrayList<>() : new ArrayList<>(collection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +169,7 @@ public class JSONArray {
|
|||
* The collection should have Java Beans.
|
||||
*/
|
||||
public JSONArray(final Collection collection, final boolean includeSuperClass) {
|
||||
myArrayList = collection == null ? new ArrayList<Object>() : new ArrayList<Object>(collection.size());
|
||||
myArrayList = collection == null ? new ArrayList<>() : new ArrayList<>(collection.size());
|
||||
if (collection != null) {
|
||||
Iterator<Object> iter = collection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public class CompressionUtilTest extends Assert {
|
|||
AtomicLong counter = new AtomicLong(0);
|
||||
DeflaterReader reader = new DeflaterReader(inputStream, counter);
|
||||
|
||||
ArrayList<Integer> zipHolder = new ArrayList<Integer>();
|
||||
ArrayList<Integer> zipHolder = new ArrayList<>();
|
||||
int b = reader.read();
|
||||
|
||||
while (b != -1) {
|
||||
|
@ -79,7 +79,7 @@ public class CompressionUtilTest extends Assert {
|
|||
DeflaterReader reader = new DeflaterReader(inputStream, counter);
|
||||
|
||||
byte[] buffer = new byte[7];
|
||||
ArrayList<Integer> zipHolder = new ArrayList<Integer>();
|
||||
ArrayList<Integer> zipHolder = new ArrayList<>();
|
||||
|
||||
int n = reader.read(buffer);
|
||||
while (n != -1) {
|
||||
|
@ -122,7 +122,7 @@ public class CompressionUtilTest extends Assert {
|
|||
ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes);
|
||||
|
||||
InflaterReader inflater = new InflaterReader(byteInput);
|
||||
ArrayList<Integer> holder = new ArrayList<Integer>();
|
||||
ArrayList<Integer> holder = new ArrayList<>();
|
||||
int read = inflater.read();
|
||||
|
||||
while (read != -1) {
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ConcurrentHashSetTest extends Assert {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
set = new ConcurrentHashSet<String>();
|
||||
set = new ConcurrentHashSet<>();
|
||||
element = RandomUtil.randomString();
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert {
|
|||
|
||||
@Test
|
||||
public void testCalculationOnMultiThread() throws Throwable {
|
||||
final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<Long>();
|
||||
final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<>();
|
||||
|
||||
final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
|
||||
|
||||
|
|
|
@ -79,11 +79,11 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
|
|||
|
||||
private final int connectionType;
|
||||
|
||||
private final Set<ActiveMQSession> sessions = new ConcurrentHashSet<ActiveMQSession>();
|
||||
private final Set<ActiveMQSession> sessions = new ConcurrentHashSet<>();
|
||||
|
||||
private final Set<SimpleString> tempQueues = new ConcurrentHashSet<SimpleString>();
|
||||
private final Set<SimpleString> tempQueues = new ConcurrentHashSet<>();
|
||||
|
||||
private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<SimpleString>();
|
||||
private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<>();
|
||||
|
||||
private volatile boolean hasNoLocal;
|
||||
|
||||
|
@ -327,7 +327,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
|
|||
sessionFactory.close();
|
||||
|
||||
try {
|
||||
for (ActiveMQSession session : new HashSet<ActiveMQSession>(sessions)) {
|
||||
for (ActiveMQSession session : new HashSet<>(sessions)) {
|
||||
session.close();
|
||||
}
|
||||
|
||||
|
@ -689,7 +689,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
|
|||
private final WeakReference<ActiveMQConnection> connectionRef;
|
||||
|
||||
JMSFailureListener(final ActiveMQConnection connection) {
|
||||
connectionRef = new WeakReference<ActiveMQConnection>(connection);
|
||||
connectionRef = new WeakReference<>(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -742,7 +742,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
|
|||
private final WeakReference<ActiveMQConnection> connectionRef;
|
||||
|
||||
FailoverEventListenerImpl(final ActiveMQConnection connection) {
|
||||
connectionRef = new WeakReference<ActiveMQConnection>(connection);
|
||||
connectionRef = new WeakReference<>(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ActiveMQConnectionMetaData implements ConnectionMetaData {
|
|||
|
||||
@Override
|
||||
public Enumeration getJMSXPropertyNames() throws JMSException {
|
||||
Vector<Object> v = new Vector<Object>();
|
||||
Vector<Object> v = new Vector<>();
|
||||
v.add("JMSXGroupID");
|
||||
v.add("JMSXGroupSeq");
|
||||
v.add("JMSXDeliveryCount");
|
||||
|
|
|
@ -202,7 +202,7 @@ public class ActiveMQDestination implements Destination, Serializable, Reference
|
|||
throw new JMSRuntimeException("Invalid message queue name: " + queueName);
|
||||
}
|
||||
|
||||
Pair<String, String> pair = new Pair<String, String>(parts[0].toString(), parts[1].toString());
|
||||
Pair<String, String> pair = new Pair<>(parts[0].toString(), parts[1].toString());
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ public final class ActiveMQJMSProducer implements JMSProducer {
|
|||
public Set<String> getPropertyNames() {
|
||||
try {
|
||||
Set<SimpleString> simplePropNames = properties.getPropertyNames();
|
||||
Set<String> propNames = new HashSet<String>(simplePropNames.size());
|
||||
Set<String> propNames = new HashSet<>(simplePropNames.size());
|
||||
|
||||
for (SimpleString str : simplePropNames) {
|
||||
propNames.add(str.toString());
|
||||
|
|
|
@ -314,7 +314,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess
|
|||
@Override
|
||||
public Enumeration getMapNames() throws JMSException {
|
||||
Set<SimpleString> simplePropNames = map.getPropertyNames();
|
||||
Set<String> propNames = new HashSet<String>(simplePropNames.size());
|
||||
Set<String> propNames = new HashSet<>(simplePropNames.size());
|
||||
|
||||
for (SimpleString str : simplePropNames) {
|
||||
propNames.add(str.toString());
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ActiveMQMessage implements javax.jms.Message {
|
|||
public static final byte TYPE = org.apache.activemq.artemis.api.core.Message.DEFAULT_TYPE;
|
||||
|
||||
public static Map<String, Object> coreMaptoJMSMap(final Map<String, Object> coreMessage) {
|
||||
Map<String, Object> jmsMessage = new HashMap<String, Object>();
|
||||
Map<String, Object> jmsMessage = new HashMap<>();
|
||||
|
||||
String deliveryMode = (Boolean) coreMessage.get("durable") ? "PERSISTENT" : "NON_PERSISTENT";
|
||||
byte priority = (Byte) coreMessage.get("priority");
|
||||
|
@ -95,7 +95,7 @@ public class ActiveMQMessage implements javax.jms.Message {
|
|||
|
||||
// Static --------------------------------------------------------
|
||||
|
||||
private static final HashSet<String> reservedIdentifiers = new HashSet<String>();
|
||||
private static final HashSet<String> reservedIdentifiers = new HashSet<>();
|
||||
|
||||
static {
|
||||
ActiveMQMessage.reservedIdentifiers.add("NULL");
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
|
||||
private boolean recoverCalled;
|
||||
|
||||
private final Set<ActiveMQMessageConsumer> consumers = new HashSet<ActiveMQMessageConsumer>();
|
||||
private final Set<ActiveMQMessageConsumer> consumers = new HashSet<>();
|
||||
|
||||
// Constructors --------------------------------------------------
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class ActiveMQSession implements QueueSession, TopicSession {
|
|||
connection.getThreadAwareContext().assertNotMessageListenerThread();
|
||||
synchronized (connection) {
|
||||
try {
|
||||
for (ActiveMQMessageConsumer cons : new HashSet<ActiveMQMessageConsumer>(consumers)) {
|
||||
for (ActiveMQMessageConsumer cons : new HashSet<>(consumers)) {
|
||||
cons.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SelectorTranslator {
|
|||
|
||||
int matchPos = 0;
|
||||
|
||||
List<Integer> positions = new ArrayList<Integer>();
|
||||
List<Integer> positions = new ArrayList<>();
|
||||
|
||||
boolean replaceInQuotes = match.charAt(0) == quote;
|
||||
|
||||
|
|
|
@ -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<Long>();
|
||||
private Set<Long> messageListenerThreads = new ConcurrentHashSet<>();
|
||||
|
||||
/**
|
||||
* Sets current thread to the context
|
||||
|
|
|
@ -74,17 +74,17 @@ public class ReadOnlyContext implements Context, Serializable {
|
|||
private String nameInNamespace = "";
|
||||
|
||||
public ReadOnlyContext() {
|
||||
environment = new Hashtable<String, Object>();
|
||||
bindings = new HashMap<String, Object>();
|
||||
treeBindings = new HashMap<String, Object>();
|
||||
environment = new Hashtable<>();
|
||||
bindings = new HashMap<>();
|
||||
treeBindings = new HashMap<>();
|
||||
}
|
||||
|
||||
public ReadOnlyContext(Hashtable env) {
|
||||
if (env == null) {
|
||||
this.environment = new Hashtable<String, Object>();
|
||||
this.environment = new Hashtable<>();
|
||||
}
|
||||
else {
|
||||
this.environment = new Hashtable<String, Object>(env);
|
||||
this.environment = new Hashtable<>(env);
|
||||
}
|
||||
this.bindings = Collections.EMPTY_MAP;
|
||||
this.treeBindings = Collections.EMPTY_MAP;
|
||||
|
@ -92,13 +92,13 @@ public class ReadOnlyContext implements Context, Serializable {
|
|||
|
||||
public ReadOnlyContext(Hashtable environment, Map<String, Object> bindings) {
|
||||
if (environment == null) {
|
||||
this.environment = new Hashtable<String, Object>();
|
||||
this.environment = new Hashtable<>();
|
||||
}
|
||||
else {
|
||||
this.environment = new Hashtable<String, Object>(environment);
|
||||
this.environment = new Hashtable<>(environment);
|
||||
}
|
||||
this.bindings = new HashMap<String, Object>();
|
||||
treeBindings = new HashMap<String, Object>();
|
||||
this.bindings = new HashMap<>();
|
||||
treeBindings = new HashMap<>();
|
||||
if (bindings != null) {
|
||||
for (Map.Entry<String, Object> binding : bindings.entrySet()) {
|
||||
try {
|
||||
|
@ -120,7 +120,7 @@ public class ReadOnlyContext implements Context, Serializable {
|
|||
protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env) {
|
||||
this.bindings = clone.bindings;
|
||||
this.treeBindings = clone.treeBindings;
|
||||
this.environment = new Hashtable<String, Object>(env);
|
||||
this.environment = new Hashtable<>(env);
|
||||
}
|
||||
|
||||
protected ReadOnlyContext(ReadOnlyContext clone, Hashtable<String, Object> env, String nameInNamespace) {
|
||||
|
@ -155,7 +155,7 @@ public class ReadOnlyContext implements Context, Serializable {
|
|||
assert name != null && name.length() > 0;
|
||||
assert !frozen;
|
||||
|
||||
Map<String, Object> newBindings = new HashMap<String, Object>();
|
||||
Map<String, Object> newBindings = new HashMap<>();
|
||||
int pos = name.indexOf('/');
|
||||
if (pos == -1) {
|
||||
if (treeBindings.put(name, value) != null) {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ConnectionFactoryURITest {
|
|||
|
||||
private static final String[] V6IPs = {"fe80::baf6:b1ff:fe12:daf7%eth0", "2620:db8:1:2::1%em1"};
|
||||
|
||||
private static Set<String> ignoreList = new HashSet<String>();
|
||||
private static Set<String> ignoreList = new HashSet<>();
|
||||
|
||||
static {
|
||||
ignoreList.add("protocolManagerFactoryStr");
|
||||
|
|
|
@ -185,7 +185,7 @@ public final class JMSBridgeImpl implements JMSBridge {
|
|||
* Constructor for MBean
|
||||
*/
|
||||
public JMSBridgeImpl() {
|
||||
messages = new LinkedList<Message>();
|
||||
messages = new LinkedList<>();
|
||||
executor = createExecutor();
|
||||
}
|
||||
|
||||
|
@ -1563,7 +1563,7 @@ public final class JMSBridgeImpl implements JMSBridge {
|
|||
String propName = en.nextElement();
|
||||
|
||||
if (oldProps == null) {
|
||||
oldProps = new HashMap<String, Object>();
|
||||
oldProps = new HashMap<>();
|
||||
}
|
||||
|
||||
oldProps.put(propName, msg.getObjectProperty(propName));
|
||||
|
|
|
@ -220,7 +220,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
|
|||
@Override
|
||||
public Map<String, Map<String, Object>[]> listDeliveringMessages() throws Exception {
|
||||
try {
|
||||
Map<String, Map<String, Object>[]> returnMap = new HashMap<String, Map<String, Object>[]>();
|
||||
Map<String, Map<String, Object>[]> returnMap = new HashMap<>();
|
||||
|
||||
// the workingMap from the queue-control
|
||||
Map<String, Map<String, Object>[]> workingMap = coreQueueControl.listDeliveringMessages();
|
||||
|
|
|
@ -162,7 +162,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
|||
server.createConnectionFactory(name, ha, JMSFactoryType.valueOf(cfType), connectorNames[0], JMSServerControlImpl.convert(bindings));
|
||||
}
|
||||
else {
|
||||
List<String> connectorList = new ArrayList<String>(connectorNames.length);
|
||||
List<String> connectorList = new ArrayList<>(connectorNames.length);
|
||||
|
||||
for (String str : connectorNames) {
|
||||
connectorList.add(str);
|
||||
|
@ -262,7 +262,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
|||
configuration.setDiscoveryGroupName(connectorNames[0]);
|
||||
}
|
||||
else {
|
||||
ArrayList<String> connectorNamesList = new ArrayList<String>();
|
||||
ArrayList<String> connectorNamesList = new ArrayList<>();
|
||||
for (String nameC : connectorNames) {
|
||||
connectorNamesList.add(nameC);
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
|||
|
||||
Set<ServerSession> sessions = server.getActiveMQServer().getSessions();
|
||||
|
||||
Map<Object, ServerSession> jmsSessions = new HashMap<Object, ServerSession>();
|
||||
Map<Object, ServerSession> jmsSessions = new HashMap<>();
|
||||
|
||||
// First separate the real jms sessions, after all we are only interested in those here on the *jms* server controller
|
||||
for (ServerSession session : sessions) {
|
||||
|
@ -745,7 +745,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
|||
@Override
|
||||
public String[] listTargetDestinations(String sessionID) throws Exception {
|
||||
String[] addresses = server.getActiveMQServer().getActiveMQServerControl().listTargetAddresses(sessionID);
|
||||
Map<String, DestinationControl> allDests = new HashMap<String, DestinationControl>();
|
||||
Map<String, DestinationControl> allDests = new HashMap<>();
|
||||
|
||||
Object[] queueControls = server.getActiveMQServer().getManagementService().getResources(JMSQueueControl.class);
|
||||
for (Object queueControl2 : queueControls) {
|
||||
|
@ -759,7 +759,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
|||
allDests.put(topicControl.getAddress(), topicControl);
|
||||
}
|
||||
|
||||
List<String> destinations = new ArrayList<String>();
|
||||
List<String> destinations = new ArrayList<>();
|
||||
for (String addresse : addresses) {
|
||||
DestinationControl control = allDests.get(addresse);
|
||||
if (control != null) {
|
||||
|
|
|
@ -260,7 +260,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl {
|
|||
|
||||
private Object[] listSubscribersInfos(final DurabilityType durability) {
|
||||
List<QueueControl> queues = getQueues(durability);
|
||||
List<Object[]> subInfos = new ArrayList<Object[]>(queues.size());
|
||||
List<Object[]> subInfos = new ArrayList<>(queues.size());
|
||||
|
||||
for (QueueControl queue : queues) {
|
||||
String clientID = null;
|
||||
|
@ -342,7 +342,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl {
|
|||
|
||||
private List<QueueControl> getQueues(final DurabilityType durability) {
|
||||
try {
|
||||
List<QueueControl> matchingQueues = new ArrayList<QueueControl>();
|
||||
List<QueueControl> matchingQueues = new ArrayList<>();
|
||||
String[] queues = addressControl.getQueueNames();
|
||||
for (String queue : queues) {
|
||||
QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue);
|
||||
|
|
|
@ -36,7 +36,7 @@ public class PersistedBindings implements EncodingSupport {
|
|||
|
||||
private String name;
|
||||
|
||||
private ArrayList<String> bindings = new ArrayList<String>();
|
||||
private ArrayList<String> bindings = new ArrayList<>();
|
||||
|
||||
// Static --------------------------------------------------------
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class PersistedBindings implements EncodingSupport {
|
|||
type = PersistedType.getType(buffer.readByte());
|
||||
name = buffer.readSimpleString().toString();
|
||||
int bindingArraySize = buffer.readInt();
|
||||
bindings = new ArrayList<String>(bindingArraySize);
|
||||
bindings = new ArrayList<>(bindingArraySize);
|
||||
|
||||
for (int i = 0; i < bindingArraySize; i++) {
|
||||
bindings.add(buffer.readSimpleString().toString());
|
||||
|
|
|
@ -62,11 +62,11 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
|
||||
private volatile boolean started;
|
||||
|
||||
private final Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>();
|
||||
private final Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>();
|
||||
private final Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<Pair<PersistedType, String>, PersistedBindings> mapBindings = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedBindings>();
|
||||
private final Map<Pair<PersistedType, String>, PersistedBindings> mapBindings = new ConcurrentHashMap<>();
|
||||
|
||||
private final Configuration config;
|
||||
|
||||
|
@ -101,7 +101,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
// Public --------------------------------------------------------
|
||||
@Override
|
||||
public List<PersistedConnectionFactory> recoverConnectionFactories() {
|
||||
List<PersistedConnectionFactory> cfs = new ArrayList<PersistedConnectionFactory>(mapFactories.values());
|
||||
List<PersistedConnectionFactory> cfs = new ArrayList<>(mapFactories.values());
|
||||
return cfs;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
|
||||
@Override
|
||||
public List<PersistedDestination> recoverDestinations() {
|
||||
List<PersistedDestination> destinations = new ArrayList<PersistedDestination>(this.destinations.values());
|
||||
List<PersistedDestination> destinations = new ArrayList<>(this.destinations.values());
|
||||
return destinations;
|
||||
}
|
||||
|
||||
|
@ -134,18 +134,18 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
long id = idGenerator.generateID();
|
||||
destination.setId(id);
|
||||
jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
|
||||
destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
|
||||
destinations.put(new Pair<>(destination.getType(), destination.getName()), destination);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PersistedBindings> recoverPersistedBindings() throws Exception {
|
||||
ArrayList<PersistedBindings> list = new ArrayList<PersistedBindings>(mapBindings.values());
|
||||
ArrayList<PersistedBindings> list = new ArrayList<>(mapBindings.values());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBindings(PersistedType type, String name, String... address) throws Exception {
|
||||
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
|
||||
Pair<PersistedType, String> key = new Pair<>(type, name);
|
||||
|
||||
long tx = idGenerator.generateID();
|
||||
|
||||
|
@ -174,7 +174,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
|
||||
@Override
|
||||
public void deleteBindings(PersistedType type, String name, String address) throws Exception {
|
||||
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
|
||||
Pair<PersistedType, String> key = new Pair<>(type, name);
|
||||
|
||||
long tx = idGenerator.generateID();
|
||||
|
||||
|
@ -202,7 +202,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
|
||||
@Override
|
||||
public void deleteBindings(PersistedType type, String name) throws Exception {
|
||||
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
|
||||
Pair<PersistedType, String> key = new Pair<>(type, name);
|
||||
|
||||
PersistedBindings currentBindings = mapBindings.remove(key);
|
||||
|
||||
|
@ -213,7 +213,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
|
||||
@Override
|
||||
public void deleteDestination(final PersistedType type, final String name) throws Exception {
|
||||
PersistedDestination destination = destinations.remove(new Pair<PersistedType, String>(type, name));
|
||||
PersistedDestination destination = destinations.remove(new Pair<>(type, name));
|
||||
if (destination != null) {
|
||||
jmsJournal.appendDeleteRecord(destination.getId(), false);
|
||||
}
|
||||
|
@ -243,9 +243,9 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
public void load() throws Exception {
|
||||
mapFactories.clear();
|
||||
|
||||
List<RecordInfo> data = new ArrayList<RecordInfo>();
|
||||
List<RecordInfo> data = new ArrayList<>();
|
||||
|
||||
ArrayList<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>();
|
||||
ArrayList<PreparedTransactionInfo> list = new ArrayList<>();
|
||||
|
||||
jmsJournal.load(data, list, null);
|
||||
|
||||
|
@ -266,13 +266,13 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager {
|
|||
PersistedDestination destination = new PersistedDestination();
|
||||
destination.decode(buffer);
|
||||
destination.setId(id);
|
||||
destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
|
||||
destinations.put(new Pair<>(destination.getType(), destination.getName()), destination);
|
||||
}
|
||||
else if (rec == BINDING_RECORD) {
|
||||
PersistedBindings bindings = new PersistedBindings();
|
||||
bindings.decode(buffer);
|
||||
bindings.setId(id);
|
||||
Pair<PersistedType, String> key = new Pair<PersistedType, String>(bindings.getType(), bindings.getName());
|
||||
Pair<PersistedType, String> key = new Pair<>(bindings.getType(), bindings.getName());
|
||||
mapBindings.put(key, bindings);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -540,7 +540,7 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
|
|||
int nConnectors = buffer.readInt();
|
||||
|
||||
if (nConnectors > 0) {
|
||||
connectorNames = new ArrayList<String>(nConnectors);
|
||||
connectorNames = new ArrayList<>(nConnectors);
|
||||
|
||||
for (int i = 0; i < nConnectors; i++) {
|
||||
SimpleString str = buffer.readSimpleString();
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.apache.activemq.artemis.jms.server.config.TopicConfiguration;
|
|||
|
||||
public class JMSConfigurationImpl implements JMSConfiguration {
|
||||
|
||||
private List<ConnectionFactoryConfiguration> connectionFactoryConfigurations = new ArrayList<ConnectionFactoryConfiguration>();
|
||||
private List<ConnectionFactoryConfiguration> connectionFactoryConfigurations = new ArrayList<>();
|
||||
|
||||
private List<JMSQueueConfiguration> queueConfigurations = new ArrayList<JMSQueueConfiguration>();
|
||||
private List<JMSQueueConfiguration> queueConfigurations = new ArrayList<>();
|
||||
|
||||
private List<TopicConfiguration> topicConfigurations = new ArrayList<TopicConfiguration>();
|
||||
private List<TopicConfiguration> topicConfigurations = new ArrayList<>();
|
||||
|
||||
private String domain = ActiveMQDefaultConfiguration.getDefaultJmxDomain();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class TransportConfigurationEncodingSupport {
|
|||
|
||||
public static List<Pair<TransportConfiguration, TransportConfiguration>> decodeConfigs(ActiveMQBuffer buffer) {
|
||||
int size = buffer.readInt();
|
||||
List<Pair<TransportConfiguration, TransportConfiguration>> configs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>(size);
|
||||
List<Pair<TransportConfiguration, TransportConfiguration>> configs = new ArrayList<>(size);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
TransportConfiguration live = decode(buffer);
|
||||
|
@ -41,7 +41,7 @@ public class TransportConfigurationEncodingSupport {
|
|||
if (hasBackup) {
|
||||
backup = decode(buffer);
|
||||
}
|
||||
configs.add(new Pair<TransportConfiguration, TransportConfiguration>(live, backup));
|
||||
configs.add(new Pair<>(live, backup));
|
||||
}
|
||||
|
||||
return configs;
|
||||
|
@ -51,7 +51,7 @@ public class TransportConfigurationEncodingSupport {
|
|||
String name = BufferHelper.readNullableSimpleStringAsString(buffer);
|
||||
String factoryClassName = buffer.readSimpleString().toString();
|
||||
int paramSize = buffer.readInt();
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
for (int i = 0; i < paramSize; i++) {
|
||||
String key = buffer.readSimpleString().toString();
|
||||
String value = buffer.readSimpleString().toString();
|
||||
|
|
|
@ -104,20 +104,20 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
|
||||
private BindingRegistry registry;
|
||||
|
||||
private final Map<String, ActiveMQQueue> queues = new HashMap<String, ActiveMQQueue>();
|
||||
private final Map<String, ActiveMQQueue> queues = new HashMap<>();
|
||||
|
||||
private final Map<String, ActiveMQTopic> topics = new HashMap<String, ActiveMQTopic>();
|
||||
private final Map<String, ActiveMQTopic> topics = new HashMap<>();
|
||||
|
||||
private final Map<String, ActiveMQConnectionFactory> connectionFactories = new HashMap<String, ActiveMQConnectionFactory>();
|
||||
private final Map<String, ActiveMQConnectionFactory> connectionFactories = new HashMap<>();
|
||||
|
||||
private final Map<String, List<String>> queueBindings = new HashMap<String, List<String>>();
|
||||
private final Map<String, List<String>> queueBindings = new HashMap<>();
|
||||
|
||||
private final Map<String, List<String>> topicBindings = new HashMap<String, List<String>>();
|
||||
private final Map<String, List<String>> topicBindings = new HashMap<>();
|
||||
|
||||
private final Map<String, List<String>> connectionFactoryBindings = new HashMap<String, List<String>>();
|
||||
private final Map<String, List<String>> connectionFactoryBindings = new HashMap<>();
|
||||
|
||||
// We keep things cached if objects are created while the JMS is not active
|
||||
private final List<Runnable> cachedCommands = new ArrayList<Runnable>();
|
||||
private final List<Runnable> cachedCommands = new ArrayList<>();
|
||||
|
||||
private final ActiveMQServer server;
|
||||
|
||||
|
@ -133,7 +133,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
|
||||
private JMSStorageManager storage;
|
||||
|
||||
private final Map<String, List<String>> unRecoveredBindings = new HashMap<String, List<String>>();
|
||||
private final Map<String, List<String>> unRecoveredBindings = new HashMap<>();
|
||||
|
||||
public JMSServerManagerImpl(final ActiveMQServer server) throws Exception {
|
||||
this.server = server;
|
||||
|
@ -224,7 +224,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
|
||||
unbindBindings(connectionFactoryBindings);
|
||||
|
||||
for (String connectionFactory : new HashSet<String>(connectionFactories.keySet())) {
|
||||
for (String connectionFactory : new HashSet<>(connectionFactories.keySet())) {
|
||||
shutdownConnectionFactory(connectionFactory);
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
}
|
||||
|
||||
if (bindingsList == null) {
|
||||
bindingsList = new ArrayList<String>();
|
||||
bindingsList = new ArrayList<>();
|
||||
mapBindings.put(name, bindingsList);
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
}
|
||||
|
||||
if (bindingsList == null) {
|
||||
bindingsList = new ArrayList<String>();
|
||||
bindingsList = new ArrayList<>();
|
||||
mapBindings.put(record.getName(), bindingsList);
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
String[] usedBindings = null;
|
||||
|
||||
if (bindings != null) {
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<String>();
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<>();
|
||||
|
||||
for (String bindingsItem : bindings) {
|
||||
if (bindToBindings(bindingsItem, destination)) {
|
||||
|
@ -546,7 +546,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
throw new IllegalArgumentException("Queue does not exist");
|
||||
}
|
||||
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<String>();
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<>();
|
||||
|
||||
if (bindings != null) {
|
||||
for (String bindingsItem : bindings) {
|
||||
|
@ -989,7 +989,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
|
||||
ActiveMQConnectionFactory cf = internalCreateCF(cfConfig);
|
||||
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<String>();
|
||||
ArrayList<String> bindingsToAdd = new ArrayList<>();
|
||||
|
||||
for (String bindingsItem : bindings) {
|
||||
if (bindToBindings(bindingsItem, cf)) {
|
||||
|
@ -1302,7 +1302,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
return "";
|
||||
}
|
||||
|
||||
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<Map.Entry<Xid, Long>>(xids.entrySet());
|
||||
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet());
|
||||
Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>() {
|
||||
@Override
|
||||
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
|
||||
|
@ -1332,7 +1332,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
return "<h3>*** Prepared Transaction Details ***</h3><p>No entry.</p>";
|
||||
}
|
||||
|
||||
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<Map.Entry<Xid, Long>>(xids.entrySet());
|
||||
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet());
|
||||
Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>() {
|
||||
@Override
|
||||
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) {
|
||||
|
@ -1411,7 +1411,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
|
|||
private void addToBindings(Map<String, List<String>> map, String name, String... bindings) {
|
||||
List<String> list = map.get(name);
|
||||
if (list == null) {
|
||||
list = new ArrayList<String>();
|
||||
list = new ArrayList<>();
|
||||
map.put(name, list);
|
||||
}
|
||||
for (String bindingsItem : bindings) {
|
||||
|
|
|
@ -363,7 +363,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
|
|||
|
||||
private volatile long bufferReuseLastTime = System.currentTimeMillis();
|
||||
|
||||
private final ConcurrentLinkedQueue<ByteBuffer> reuseBuffersQueue = new ConcurrentLinkedQueue<ByteBuffer>();
|
||||
private final ConcurrentLinkedQueue<ByteBuffer> reuseBuffersQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
private boolean stopped = false;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class TimedBuffer {
|
|||
|
||||
bufferLimit = 0;
|
||||
|
||||
callbacks = new ArrayList<IOCallback>();
|
||||
callbacks = new ArrayList<>();
|
||||
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public class TimedBuffer {
|
|||
pendingSync = false;
|
||||
|
||||
// swap the instance as the previous callback list is being used asynchronously
|
||||
callbacks = new LinkedList<IOCallback>();
|
||||
callbacks = new LinkedList<>();
|
||||
|
||||
buffer.clear();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class NIOSequentialFileFactory extends AbstractSequentialFileFactory {
|
|||
// the main portion is outside of the VM heap
|
||||
// and the JDK will not have any reference about it to take GC into account
|
||||
// so we force a GC and try again.
|
||||
WeakReference<Object> obj = new WeakReference<Object>(new Object());
|
||||
WeakReference<Object> obj = new WeakReference<>(new Object());
|
||||
try {
|
||||
long timeout = System.currentTimeMillis() + 5000;
|
||||
while (System.currentTimeMillis() > timeout && obj.get() != null) {
|
||||
|
|
|
@ -25,9 +25,9 @@ public class PreparedTransactionInfo {
|
|||
|
||||
public final byte[] extraData;
|
||||
|
||||
public final List<RecordInfo> records = new ArrayList<RecordInfo>();
|
||||
public final List<RecordInfo> records = new ArrayList<>();
|
||||
|
||||
public final List<RecordInfo> recordsToDelete = new ArrayList<RecordInfo>();
|
||||
public final List<RecordInfo> recordsToDelete = new ArrayList<>();
|
||||
|
||||
public PreparedTransactionInfo(final long id, final byte[] extraData) {
|
||||
this.id = id;
|
||||
|
|
|
@ -55,9 +55,9 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
|
|||
|
||||
private ActiveMQBuffer writingChannel;
|
||||
|
||||
private final Set<Long> recordsSnapshot = new ConcurrentHashSet<Long>();
|
||||
private final Set<Long> recordsSnapshot = new ConcurrentHashSet<>();
|
||||
|
||||
protected final List<JournalFile> newDataFiles = new ArrayList<JournalFile>();
|
||||
protected final List<JournalFile> newDataFiles = new ArrayList<>();
|
||||
|
||||
// Static --------------------------------------------------------
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public final class FileWrapperJournal extends JournalBase {
|
|||
|
||||
private final ReentrantLock lockAppend = new ReentrantLock();
|
||||
|
||||
private final ConcurrentMap<Long, AtomicInteger> transactions = new ConcurrentHashMap<Long, AtomicInteger>();
|
||||
private final ConcurrentMap<Long, AtomicInteger> transactions = new ConcurrentHashMap<>();
|
||||
private final JournalImpl journal;
|
||||
protected volatile JournalFile currentFile;
|
||||
|
||||
|
|
|
@ -48,18 +48,18 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
|
|||
private static final short COMPACT_SPLIT_LINE = 2;
|
||||
|
||||
// Snapshot of transactions that were pending when the compactor started
|
||||
private final Map<Long, PendingTransaction> pendingTransactions = new ConcurrentHashMap<Long, PendingTransaction>();
|
||||
private final Map<Long, PendingTransaction> pendingTransactions = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<Long, JournalRecord> newRecords = new HashMap<Long, JournalRecord>();
|
||||
private final Map<Long, JournalRecord> newRecords = new HashMap<>();
|
||||
|
||||
private final Map<Long, JournalTransaction> newTransactions = new HashMap<Long, JournalTransaction>();
|
||||
private final Map<Long, JournalTransaction> newTransactions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Commands that happened during compacting
|
||||
* We can't process any counts during compacting, as we won't know in what files the records are taking place, so
|
||||
* we cache those updates. As soon as we are done we take the right account.
|
||||
*/
|
||||
private final LinkedList<CompactCommand> pendingCommands = new LinkedList<CompactCommand>();
|
||||
private final LinkedList<CompactCommand> pendingCommands = new LinkedList<>();
|
||||
|
||||
public static SequentialFile readControlFile(final SequentialFileFactory fileFactory,
|
||||
final List<String> dataFiles,
|
||||
|
@ -70,7 +70,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
|
|||
if (controlFile.exists()) {
|
||||
JournalFile file = new JournalFileImpl(controlFile, 0, JournalImpl.FORMAT_VERSION);
|
||||
|
||||
final ArrayList<RecordInfo> records = new ArrayList<RecordInfo>();
|
||||
final ArrayList<RecordInfo> records = new ArrayList<>();
|
||||
|
||||
JournalImpl.readJournalFile(fileFactory, file, new JournalReaderCallbackAbstract() {
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ
|
|||
for (int i = 0; i < numberRenames; i++) {
|
||||
String from = input.readUTF();
|
||||
String to = input.readUTF();
|
||||
renameFile.add(new Pair<String, String>(from, to));
|
||||
renameFile.add(new Pair<>(from, to));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class JournalFileImpl implements JournalFile {
|
|||
|
||||
private final int version;
|
||||
|
||||
private final Map<JournalFile, AtomicInteger> negCounts = new ConcurrentHashMap<JournalFile, AtomicInteger>();
|
||||
private final Map<JournalFile, AtomicInteger> negCounts = new ConcurrentHashMap<>();
|
||||
|
||||
public JournalFileImpl(final SequentialFile file, final long fileID, final int version) {
|
||||
this.file = file;
|
||||
|
|
|
@ -61,11 +61,11 @@ public class JournalFilesRepository {
|
|||
|
||||
private final JournalImpl journal;
|
||||
|
||||
private final BlockingDeque<JournalFile> dataFiles = new LinkedBlockingDeque<JournalFile>();
|
||||
private final BlockingDeque<JournalFile> dataFiles = new LinkedBlockingDeque<>();
|
||||
|
||||
private final ConcurrentLinkedQueue<JournalFile> freeFiles = new ConcurrentLinkedQueue<JournalFile>();
|
||||
private final ConcurrentLinkedQueue<JournalFile> freeFiles = new ConcurrentLinkedQueue<>();
|
||||
|
||||
private final BlockingQueue<JournalFile> openedFiles = new LinkedBlockingQueue<JournalFile>();
|
||||
private final BlockingQueue<JournalFile> openedFiles = new LinkedBlockingQueue<>();
|
||||
|
||||
private final AtomicLong nextFileID = new AtomicLong(0);
|
||||
|
||||
|
|
|
@ -174,10 +174,10 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
private final JournalFilesRepository filesRepository;
|
||||
|
||||
// Compacting may replace this structure
|
||||
private final ConcurrentMap<Long, JournalRecord> records = new ConcurrentHashMap<Long, JournalRecord>();
|
||||
private final ConcurrentMap<Long, JournalRecord> records = new ConcurrentHashMap<>();
|
||||
|
||||
// Compacting may replace this structure
|
||||
private final ConcurrentMap<Long, JournalTransaction> transactions = new ConcurrentHashMap<Long, JournalTransaction>();
|
||||
private final ConcurrentMap<Long, JournalTransaction> transactions = new ConcurrentHashMap<>();
|
||||
|
||||
// This will be set only while the JournalCompactor is being executed
|
||||
private volatile JournalCompactor compactor;
|
||||
|
@ -188,7 +188,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
|
||||
private ExecutorService compactorExecutor = null;
|
||||
|
||||
private ConcurrentHashSet<CountDownLatch> latches = new ConcurrentHashSet<CountDownLatch>();
|
||||
private ConcurrentHashSet<CountDownLatch> latches = new ConcurrentHashSet<>();
|
||||
|
||||
// Lock used during the append of records
|
||||
// This lock doesn't represent a global lock.
|
||||
|
@ -348,7 +348,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
public List<JournalFile> orderFiles() throws Exception {
|
||||
List<String> fileNames = fileFactory.listFiles(filesRepository.getFileExtension());
|
||||
|
||||
List<JournalFile> orderedFiles = new ArrayList<JournalFile>(fileNames.size());
|
||||
List<JournalFile> orderedFiles = new ArrayList<>(fileNames.size());
|
||||
|
||||
for (String fileName : fileNames) {
|
||||
SequentialFile file = fileFactory.createSequentialFile(fileName);
|
||||
|
@ -1168,9 +1168,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
final List<PreparedTransactionInfo> preparedTransactions,
|
||||
final TransactionFailureCallback failureCallback,
|
||||
final boolean fixBadTX) throws Exception {
|
||||
final Set<Long> recordsToDelete = new HashSet<Long>();
|
||||
final Set<Long> recordsToDelete = new HashSet<>();
|
||||
// ArrayList was taking too long to delete elements on checkDeleteSize
|
||||
final List<RecordInfo> records = new LinkedList<RecordInfo>();
|
||||
final List<RecordInfo> records = new LinkedList<>();
|
||||
|
||||
final int DELETE_FLUSH = 20000;
|
||||
|
||||
|
@ -1296,7 +1296,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
|
||||
compactorLock.writeLock().lock();
|
||||
try {
|
||||
ArrayList<JournalFile> dataFilesToProcess = new ArrayList<JournalFile>(filesRepository.getDataFilesCount());
|
||||
ArrayList<JournalFile> dataFilesToProcess = new ArrayList<>(filesRepository.getDataFilesCount());
|
||||
|
||||
boolean previousReclaimValue = isAutoReclaim();
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
transactions.clear();
|
||||
currentFile = null;
|
||||
|
||||
final Map<Long, TransactionHolder> loadTransactions = new LinkedHashMap<Long, TransactionHolder>();
|
||||
final Map<Long, TransactionHolder> loadTransactions = new LinkedHashMap<>();
|
||||
|
||||
final List<JournalFile> orderedFiles = orderFiles();
|
||||
|
||||
|
@ -2194,7 +2194,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
cleanupList = null;
|
||||
}
|
||||
else {
|
||||
cleanupList = new ArrayList<Pair<String, String>>();
|
||||
cleanupList = new ArrayList<>();
|
||||
cleanupList.add(cleanupRename);
|
||||
}
|
||||
return AbstractJournalUpdateTask.writeControlFile(fileFactory, files, newFiles, cleanupList);
|
||||
|
@ -2545,9 +2545,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
* @throws Exception
|
||||
*/
|
||||
private void checkControlFile() throws Exception {
|
||||
ArrayList<String> dataFiles = new ArrayList<String>();
|
||||
ArrayList<String> newFiles = new ArrayList<String>();
|
||||
ArrayList<Pair<String, String>> renames = new ArrayList<Pair<String, String>>();
|
||||
ArrayList<String> dataFiles = new ArrayList<>();
|
||||
ArrayList<String> newFiles = new ArrayList<>();
|
||||
ArrayList<Pair<String, String>> renames = new ArrayList<>();
|
||||
|
||||
SequentialFile controlFile = JournalCompactor.readControlFile(fileFactory, dataFiles, newFiles, renames);
|
||||
if (controlFile != null) {
|
||||
|
@ -2629,9 +2629,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
|
||||
public final long transactionID;
|
||||
|
||||
public final List<RecordInfo> recordInfos = new ArrayList<RecordInfo>();
|
||||
public final List<RecordInfo> recordInfos = new ArrayList<>();
|
||||
|
||||
public final List<RecordInfo> recordsToDelete = new ArrayList<RecordInfo>();
|
||||
public final List<RecordInfo> recordsToDelete = new ArrayList<>();
|
||||
|
||||
public boolean prepared;
|
||||
|
||||
|
@ -2726,7 +2726,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
|
|||
public synchronized Map<Long, JournalFile> createFilesForBackupSync(long[] fileIds) throws Exception {
|
||||
synchronizationLock();
|
||||
try {
|
||||
Map<Long, JournalFile> map = new HashMap<Long, JournalFile>();
|
||||
Map<Long, JournalFile> map = new HashMap<>();
|
||||
long maxID = -1;
|
||||
for (long id : fileIds) {
|
||||
maxID = Math.max(maxID, id);
|
||||
|
|
|
@ -47,10 +47,10 @@ public class JournalRecord {
|
|||
|
||||
void addUpdateFile(final JournalFile updateFile, final int size) {
|
||||
if (updateFiles == null) {
|
||||
updateFiles = new ArrayList<Pair<JournalFile, Integer>>();
|
||||
updateFiles = new ArrayList<>();
|
||||
}
|
||||
|
||||
updateFiles.add(new Pair<JournalFile, Integer>(updateFile, size));
|
||||
updateFiles.add(new Pair<>(updateFile, size));
|
||||
|
||||
updateFile.incPosCount();
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public class JournalTransaction {
|
|||
public void merge(final JournalTransaction other) {
|
||||
if (other.pos != null) {
|
||||
if (pos == null) {
|
||||
pos = new ArrayList<JournalUpdate>();
|
||||
pos = new ArrayList<>();
|
||||
}
|
||||
|
||||
pos.addAll(other.pos);
|
||||
|
@ -111,7 +111,7 @@ public class JournalTransaction {
|
|||
|
||||
if (other.neg != null) {
|
||||
if (neg == null) {
|
||||
neg = new ArrayList<JournalUpdate>();
|
||||
neg = new ArrayList<>();
|
||||
}
|
||||
|
||||
neg.addAll(other.neg);
|
||||
|
@ -119,7 +119,7 @@ public class JournalTransaction {
|
|||
|
||||
if (other.pendingFiles != null) {
|
||||
if (pendingFiles == null) {
|
||||
pendingFiles = new HashSet<JournalFile>();
|
||||
pendingFiles = new HashSet<>();
|
||||
}
|
||||
|
||||
pendingFiles.addAll(other.pendingFiles);
|
||||
|
@ -169,7 +169,7 @@ public class JournalTransaction {
|
|||
|
||||
public TransactionCallback getCallback(final JournalFile file) throws Exception {
|
||||
if (callbackList == null) {
|
||||
callbackList = new HashMap<JournalFile, TransactionCallback>();
|
||||
callbackList = new HashMap<>();
|
||||
}
|
||||
|
||||
currentCallback = callbackList.get(file);
|
||||
|
@ -194,7 +194,7 @@ public class JournalTransaction {
|
|||
addFile(file);
|
||||
|
||||
if (pos == null) {
|
||||
pos = new ArrayList<JournalUpdate>();
|
||||
pos = new ArrayList<>();
|
||||
}
|
||||
|
||||
pos.add(new JournalUpdate(file, id, size));
|
||||
|
@ -206,7 +206,7 @@ public class JournalTransaction {
|
|||
addFile(file);
|
||||
|
||||
if (neg == null) {
|
||||
neg = new ArrayList<JournalUpdate>();
|
||||
neg = new ArrayList<>();
|
||||
}
|
||||
|
||||
neg.add(new JournalUpdate(file, id, 0));
|
||||
|
@ -349,7 +349,7 @@ public class JournalTransaction {
|
|||
|
||||
private void addFile(final JournalFile file) {
|
||||
if (pendingFiles == null) {
|
||||
pendingFiles = new HashSet<JournalFile>();
|
||||
pendingFiles = new HashSet<>();
|
||||
}
|
||||
|
||||
if (!pendingFiles.contains(file)) {
|
||||
|
|
|
@ -112,7 +112,7 @@ public abstract class ArtemisAbstractPlugin extends AbstractMojo {
|
|||
}
|
||||
|
||||
protected List<Artifact> explodeDependencies(Artifact artifact) throws DependencyCollectionException {
|
||||
final List<Artifact> dependencies = new LinkedList<Artifact>();
|
||||
final List<Artifact> dependencies = new LinkedList<>();
|
||||
|
||||
CollectRequest exploreDependenciesRequest = new CollectRequest(new Dependency(artifact, "compile"), remoteRepos);
|
||||
CollectResult result = repositorySystem.collectDependencies(repoSession, exploreDependenciesRequest);
|
||||
|
|
|
@ -249,7 +249,7 @@ public final class ServerJMSMapMessage extends ServerJMSMessage implements MapMe
|
|||
@Override
|
||||
public Enumeration getMapNames() throws JMSException {
|
||||
Set<SimpleString> simplePropNames = map.getPropertyNames();
|
||||
Set<String> propNames = new HashSet<String>(simplePropNames.size());
|
||||
Set<String> propNames = new HashSet<>(simplePropNames.size());
|
||||
|
||||
for (SimpleString str : simplePropNames) {
|
||||
propNames.add(str.toString());
|
||||
|
|
|
@ -33,7 +33,7 @@ public class HQPropertiesConverter {
|
|||
private static Map<SimpleString, SimpleString> amqHqDictionary;
|
||||
|
||||
static {
|
||||
Map<SimpleString, SimpleString> d = new HashMap<SimpleString, SimpleString>();
|
||||
Map<SimpleString, SimpleString> d = new HashMap<>();
|
||||
|
||||
// Add entries for outgoing messages
|
||||
d.put(new SimpleString("_HQ_ACTUAL_EXPIRY"), new SimpleString("_AMQ_ACTUAL_EXPIRY"));
|
||||
|
|
|
@ -90,7 +90,7 @@ public class MQTTConnection implements RemotingConnection {
|
|||
@Override
|
||||
public List<CloseListener> removeCloseListeners() {
|
||||
synchronized (closeListeners) {
|
||||
List<CloseListener> deletedCloseListeners = new ArrayList<CloseListener>(closeListeners);
|
||||
List<CloseListener> deletedCloseListeners = new ArrayList<>(closeListeners);
|
||||
closeListeners.clear();
|
||||
return deletedCloseListeners;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class MQTTConnection implements RemotingConnection {
|
|||
@Override
|
||||
public List<FailureListener> removeFailureListeners() {
|
||||
synchronized (failureListeners) {
|
||||
List<FailureListener> deletedFailureListeners = new ArrayList<FailureListener>(failureListeners);
|
||||
List<FailureListener> deletedFailureListeners = new ArrayList<>(failureListeners);
|
||||
failureListeners.clear();
|
||||
return deletedFailureListeners;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class MQTTConnectionManager {
|
|||
private MQTTSession session;
|
||||
|
||||
//TODO Read in a list of existing client IDs from stored Sessions.
|
||||
public static Set<String> CONNECTED_CLIENTS = new ConcurrentHashSet<String>();
|
||||
public static Set<String> CONNECTED_CLIENTS = new ConcurrentHashSet<>();
|
||||
|
||||
private MQTTLogger log = MQTTLogger.LOGGER;
|
||||
|
||||
|
|
|
@ -80,13 +80,13 @@ public class MQTTSessionState {
|
|||
|
||||
void addOutbandMessageRef(int mqttId, String address, long serverMessageId, int qos) {
|
||||
synchronized (outboundLock) {
|
||||
outboundMessageReferenceStore.put(mqttId, new Pair<String, Long>(address, serverMessageId));
|
||||
outboundMessageReferenceStore.put(mqttId, new Pair<>(address, serverMessageId));
|
||||
if (qos == 2) {
|
||||
if (reverseOutboundReferenceStore.containsKey(address)) {
|
||||
reverseOutboundReferenceStore.get(address).put(serverMessageId, mqttId);
|
||||
}
|
||||
else {
|
||||
ConcurrentHashMap<Long, Integer> serverToMqttId = new ConcurrentHashMap<Long, Integer>();
|
||||
ConcurrentHashMap<Long, Integer> serverToMqttId = new ConcurrentHashMap<>();
|
||||
serverToMqttId.put(serverMessageId, mqttId);
|
||||
reverseOutboundReferenceStore.put(address, serverToMqttId);
|
||||
}
|
||||
|
|
|
@ -108,9 +108,9 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
|
||||
private final long creationTime;
|
||||
|
||||
private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>();
|
||||
private final List<FailureListener> failureListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>();
|
||||
private final List<CloseListener> closeListeners = new CopyOnWriteArrayList<>();
|
||||
|
||||
private boolean destroyed = false;
|
||||
|
||||
|
@ -132,20 +132,20 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
|
||||
private final ReentrantReadWriteLock serviceLock = new ReentrantReadWriteLock();
|
||||
|
||||
protected final List<Command> dispatchQueue = new LinkedList<Command>();
|
||||
protected final List<Command> dispatchQueue = new LinkedList<>();
|
||||
|
||||
private boolean inServiceException;
|
||||
|
||||
private final AtomicBoolean asyncException = new AtomicBoolean(false);
|
||||
|
||||
private final Map<ConsumerId, AMQConsumerBrokerExchange> consumerExchanges = new HashMap<ConsumerId, AMQConsumerBrokerExchange>();
|
||||
private final Map<ProducerId, AMQProducerBrokerExchange> producerExchanges = new HashMap<ProducerId, AMQProducerBrokerExchange>();
|
||||
private final Map<ConsumerId, AMQConsumerBrokerExchange> consumerExchanges = new HashMap<>();
|
||||
private final Map<ProducerId, AMQProducerBrokerExchange> producerExchanges = new HashMap<>();
|
||||
|
||||
private ConnectionState state;
|
||||
|
||||
private final Set<ActiveMQDestination> tempQueues = new ConcurrentHashSet<ActiveMQDestination>();
|
||||
private final Set<ActiveMQDestination> tempQueues = new ConcurrentHashSet<>();
|
||||
|
||||
private Map<TransactionId, TransactionInfo> txMap = new ConcurrentHashMap<TransactionId, TransactionInfo>();
|
||||
private Map<TransactionId, TransactionInfo> txMap = new ConcurrentHashMap<>();
|
||||
|
||||
private volatile AMQSession advisorySession;
|
||||
|
||||
|
@ -341,7 +341,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
|
||||
@Override
|
||||
public List<CloseListener> removeCloseListeners() {
|
||||
List<CloseListener> ret = new ArrayList<CloseListener>(closeListeners);
|
||||
List<CloseListener> ret = new ArrayList<>(closeListeners);
|
||||
|
||||
closeListeners.clear();
|
||||
|
||||
|
@ -364,7 +364,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
|
||||
@Override
|
||||
public List<FailureListener> removeFailureListeners() {
|
||||
List<FailureListener> ret = new ArrayList<FailureListener>(failureListeners);
|
||||
List<FailureListener> ret = new ArrayList<>(failureListeners);
|
||||
|
||||
failureListeners.clear();
|
||||
|
||||
|
@ -464,7 +464,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
}
|
||||
|
||||
private void callFailureListeners(final ActiveMQException me) {
|
||||
final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners);
|
||||
final List<FailureListener> listenersClone = new ArrayList<>(failureListeners);
|
||||
|
||||
for (final FailureListener listener : listenersClone) {
|
||||
try {
|
||||
|
@ -480,7 +480,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S
|
|||
}
|
||||
|
||||
private void callClosingListeners() {
|
||||
final List<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners);
|
||||
final List<CloseListener> listenersClone = new ArrayList<>(closeListeners);
|
||||
|
||||
for (final CloseListener listener : listenersClone) {
|
||||
try {
|
||||
|
|
|
@ -119,19 +119,19 @@ public class OpenWireProtocolManager implements ProtocolManager<Interceptor>, No
|
|||
// from broker
|
||||
protected final Map<ConnectionId, OpenWireConnection> brokerConnectionStates = Collections.synchronizedMap(new HashMap<ConnectionId, OpenWireConnection>());
|
||||
|
||||
private final CopyOnWriteArrayList<OpenWireConnection> connections = new CopyOnWriteArrayList<OpenWireConnection>();
|
||||
private final CopyOnWriteArrayList<OpenWireConnection> connections = new CopyOnWriteArrayList<>();
|
||||
|
||||
protected final ConcurrentMap<ConnectionId, ConnectionInfo> connectionInfos = new ConcurrentHashMap<ConnectionId, ConnectionInfo>();
|
||||
protected final ConcurrentMap<ConnectionId, ConnectionInfo> connectionInfos = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<String, AMQConnectionContext> clientIdSet = new HashMap<String, AMQConnectionContext>();
|
||||
private final Map<String, AMQConnectionContext> clientIdSet = new HashMap<>();
|
||||
|
||||
private String brokerName;
|
||||
|
||||
private Map<SessionId, AMQSession> sessions = new ConcurrentHashMap<SessionId, AMQSession>();
|
||||
private Map<SessionId, AMQSession> sessions = new ConcurrentHashMap<>();
|
||||
|
||||
private Map<TransactionId, AMQSession> transactions = new ConcurrentHashMap<TransactionId, AMQSession>();
|
||||
private Map<TransactionId, AMQSession> transactions = new ConcurrentHashMap<>();
|
||||
|
||||
private Map<String, SessionId> sessionIdMap = new ConcurrentHashMap<String, SessionId>();
|
||||
private Map<String, SessionId> sessionIdMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final ScheduledExecutorService scheduledPool;
|
||||
|
||||
|
@ -649,7 +649,7 @@ public class OpenWireProtocolManager implements ProtocolManager<Interceptor>, No
|
|||
}
|
||||
|
||||
public TransactionId[] recoverTransactions(Set<SessionId> sIds) {
|
||||
List<TransactionId> recovered = new ArrayList<TransactionId>();
|
||||
List<TransactionId> recovered = new ArrayList<>();
|
||||
if (sIds != null) {
|
||||
for (SessionId sid : sIds) {
|
||||
AMQSession s = this.sessions.get(sid);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AMQConsumer implements BrowserListener {
|
|||
|
||||
private final int prefetchSize;
|
||||
private AtomicInteger windowAvailable;
|
||||
private final java.util.Queue<MessageInfo> deliveringRefs = new ConcurrentLinkedQueue<MessageInfo>();
|
||||
private final java.util.Queue<MessageInfo> deliveringRefs = new ConcurrentLinkedQueue<>();
|
||||
private long messagePullSequence = 0;
|
||||
private MessagePullHandler messagePullHandler;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ public class AMQServerSession extends ServerSessionImpl {
|
|||
|
||||
if (oper != null) {
|
||||
List<MessageReference> ackRefs = oper.getReferencesToAcknowledge();
|
||||
Map<Long, List<MessageReference>> toAcks = new HashMap<Long, List<MessageReference>>();
|
||||
Map<Long, List<MessageReference>> toAcks = new HashMap<>();
|
||||
for (MessageReference ref : ackRefs) {
|
||||
Long consumerId = ref.getConsumerId();
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class AMQServerSession extends ServerSessionImpl {
|
|||
if (acked.contains(ref.getMessage().getMessageID())) {
|
||||
List<MessageReference> ackList = toAcks.get(consumerId);
|
||||
if (ackList == null) {
|
||||
ackList = new ArrayList<MessageReference>();
|
||||
ackList = new ArrayList<>();
|
||||
toAcks.put(consumerId, ackList);
|
||||
}
|
||||
ackList.add(ref);
|
||||
|
@ -329,7 +329,7 @@ public class AMQServerSession extends ServerSessionImpl {
|
|||
Pair<UUID, AtomicLong> value = targetAddressInfos.get(msg.getAddress());
|
||||
|
||||
if (value == null) {
|
||||
targetAddressInfos.put(msg.getAddress(), new Pair<UUID, AtomicLong>(msg.getUserID(), new AtomicLong(1)));
|
||||
targetAddressInfos.put(msg.getAddress(), new Pair<>(msg.getUserID(), new AtomicLong(1)));
|
||||
}
|
||||
else {
|
||||
value.setA(msg.getUserID());
|
||||
|
|
|
@ -399,7 +399,7 @@ public class AMQSession implements SessionCallback {
|
|||
}
|
||||
else {
|
||||
Iterator<AMQConsumer> iter = consumers.values().iterator();
|
||||
Set<Long> acked = new HashSet<Long>();
|
||||
Set<Long> acked = new HashSet<>();
|
||||
while (iter.hasNext()) {
|
||||
AMQConsumer consumer = iter.next();
|
||||
consumer.rollbackTx(acked);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue