Added generic types to all collections usage
git-svn-id: https://svn.apache.org/repos/asf/geronimo/components/txmanager/trunk@585608 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java
index e230a35..302f945 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java
@@ -17,9 +17,9 @@
package org.apache.geronimo.connector.outbound;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
@@ -269,7 +269,7 @@
}
}
- protected abstract void getExpiredManagedConnectionInfos(long threshold, ArrayList killList);
+ protected abstract void getExpiredManagedConnectionInfos(long threshold, List<ManagedConnectionInfo> killList);
protected abstract boolean addToPool(ManagedConnectionInfo mci);
@@ -296,10 +296,9 @@
interceptor.resizeLock.readLock().lock();
try {
long threshold = System.currentTimeMillis() - interceptor.idleTimeoutMilliseconds;
- ArrayList killList = new ArrayList(interceptor.getPartitionMaxSize());
+ List<ManagedConnectionInfo> killList = new ArrayList<ManagedConnectionInfo>(interceptor.getPartitionMaxSize());
interceptor.getExpiredManagedConnectionInfos(threshold, killList);
- for (Iterator i = killList.iterator(); i.hasNext();) {
- ManagedConnectionInfo managedConnectionInfo = (ManagedConnectionInfo) i.next();
+ for (ManagedConnectionInfo managedConnectionInfo : killList) {
ConnectionInfo killInfo = new ConnectionInfo(managedConnectionInfo);
interceptor.internalReturn(killInfo, ConnectionReturnAction.DESTROY);
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java
index 34f01ef..1e713fa 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionReturnAction.java
@@ -27,14 +27,12 @@
* @version 1.0
*/
public class ConnectionReturnAction {
-
public final static ConnectionReturnAction RETURN_HANDLE =
new ConnectionReturnAction();
public final static ConnectionReturnAction DESTROY =
new ConnectionReturnAction();
private ConnectionReturnAction() {
+ }
- } // ConnectionReturnAction constructor
-
-} // ConnectionReturnAction
+}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java
index 135b852..0cee78d 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ConnectionTrackingInterceptor.java
@@ -95,19 +95,17 @@
next.destroy();
}
- public void enter(Collection connectionInfos)
- throws ResourceException {
- for (Iterator i = connectionInfos.iterator(); i.hasNext();) {
- ConnectionInfo connectionInfo = (ConnectionInfo) i.next();
+ public void enter(Collection<ConnectionInfo> connectionInfos) throws ResourceException {
+ for (ConnectionInfo connectionInfo : connectionInfos) {
next.getConnection(connectionInfo);
}
}
- public void exit(Collection connectionInfos)
+ public void exit(Collection<ConnectionInfo> connectionInfos)
throws ResourceException {
- for (Iterator i = connectionInfos.iterator(); i.hasNext();) {
- ConnectionInfo connectionInfo = (ConnectionInfo) i.next();
+ for (Iterator<ConnectionInfo> iterator = connectionInfos.iterator(); iterator.hasNext();) {
+ ConnectionInfo connectionInfo = iterator.next();
if (connectionInfo.isUnshareable()) {
//if one is, they all are
return;
@@ -116,7 +114,7 @@
ManagedConnection managedConnection = managedConnectionInfo.getManagedConnection();
if (managedConnection instanceof DissociatableManagedConnection
&& managedConnectionInfo.isFirstConnectionInfo(connectionInfo)) {
- i.remove();
+ iterator.remove();
((DissociatableManagedConnection) managedConnection).dissociateConnections();
managedConnectionInfo.clearConnectionHandles();
//todo this needs some kind of check so cx isn't returned more than once
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
index 5e2d117..c3de7b0 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/GeronimoConnectionEventListener.java
@@ -42,7 +42,7 @@
private final ManagedConnectionInfo managedConnectionInfo;
private final ConnectionInterceptor stack;
- private final List connectionInfos = new ArrayList();
+ private final List<ConnectionInfo> connectionInfos = new ArrayList<ConnectionInfo>();
private boolean errorOccurred = false;
public GeronimoConnectionEventListener(
@@ -143,7 +143,7 @@
return !connectionInfos.isEmpty() && connectionInfos.get(0) == connectionInfo;
}
- public Collection getConnectionInfos() {
+ public Collection<ConnectionInfo> getConnectionInfos() {
return Collections.unmodifiableCollection(connectionInfos);
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java
index c2a7937..81d5f67 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionInfo.java
@@ -129,7 +129,7 @@
listener.clearConnectionInfos();
}
- public Collection getConnectionInfos() {
+ public Collection<ConnectionInfo> getConnectionInfos() {
return listener.getConnectionInfos();
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
index c93acf9..750c623 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
@@ -18,7 +18,6 @@
package org.apache.geronimo.connector.outbound;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import javax.resource.ResourceException;
@@ -45,7 +44,7 @@
private final boolean useCRI;
- private final Map pools = new HashMap();
+ private final Map<SubjectCRIKey,PoolingAttributes> pools = new HashMap<SubjectCRIKey,PoolingAttributes>();
// volatile is not necessary, here, because of synchronization. but maintained for consistency with other Interceptors...
private volatile boolean destroyed = false;
@@ -75,7 +74,7 @@
poolInterceptor = (ConnectionInterceptor) pools.get(key);
if (poolInterceptor == null) {
poolInterceptor = singlePoolFactory.addPoolingInterceptors(next);
- pools.put(key, poolInterceptor);
+ pools.put(key, (PoolingAttributes) poolInterceptor);
}
}
mci.setPoolInterceptor(poolInterceptor);
@@ -94,10 +93,11 @@
public void destroy() {
synchronized (pools) {
destroyed = true;
- for (Iterator it = pools.entrySet().iterator(); it.hasNext(); ) {
- ((ConnectionInterceptor)((Map.Entry)it.next()).getValue()).destroy();
- it.remove();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
+ ConnectionInterceptor poolInterceptor = (ConnectionInterceptor) poolingAttributes;
+ poolInterceptor.destroy();
}
+ pools.clear();
}
next.destroy();
}
@@ -112,8 +112,7 @@
public void setPartitionMaxSize(int maxSize) throws InterruptedException {
singlePoolFactory.setPartitionMaxSize(maxSize);
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
poolingAttributes.setPartitionMaxSize(maxSize);
}
}
@@ -124,16 +123,14 @@
public void setPartitionMinSize(int minSize) {
singlePoolFactory.setPartitionMinSize(minSize);
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
poolingAttributes.setPartitionMinSize(minSize);
}
}
public int getIdleConnectionCount() {
int count = 0;
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
count += poolingAttributes.getIdleConnectionCount();
}
return count;
@@ -141,8 +138,7 @@
public int getConnectionCount() {
int count = 0;
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
count += poolingAttributes.getConnectionCount();
}
return count;
@@ -154,8 +150,7 @@
public void setBlockingTimeoutMilliseconds(int timeoutMilliseconds) {
singlePoolFactory.setBlockingTimeoutMilliseconds(timeoutMilliseconds);
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
poolingAttributes.setBlockingTimeoutMilliseconds(timeoutMilliseconds);
}
}
@@ -166,8 +161,7 @@
public void setIdleTimeoutMinutes(int idleTimeoutMinutes) {
singlePoolFactory.setIdleTimeoutMinutes(idleTimeoutMinutes);
- for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
- PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+ for (PoolingAttributes poolingAttributes : pools.values()) {
poolingAttributes.setIdleTimeoutMinutes(idleTimeoutMinutes);
}
}
@@ -194,15 +188,11 @@
public boolean equals(Object other) {
if (!(other instanceof SubjectCRIKey)) {
return false;
- } // end of if ()
+ }
SubjectCRIKey o = (SubjectCRIKey) other;
- if (hashcode != o.hashcode) {
- return false;
- } // end of if ()
- return subject == null
- ? o.subject == null
- : subject.equals(o.subject)
- && cri == null ? o.cri == null : cri.equals(o.cri);
+ return hashcode == o.hashcode &&
+ (subject == null ? o.subject == null : subject.equals(o.subject) &&
+ cri == null ? o.cri == null : cri.equals(o.cri));
}
}
-} // MultiPoolConnectionInterceptor
+}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
index 3efa0e7..6b240a7 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
@@ -17,9 +17,9 @@
package org.apache.geronimo.connector.outbound;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;
@@ -96,7 +96,6 @@
if (log.isTraceEnabled()) {
log.trace("Supplying pooled connection MCI: " + connectionInfo.getManagedConnectionInfo() + " MC: " + connectionInfo.getManagedConnectionInfo().getManagedConnection() + " from pool: " + this);
}
- return;
} else {
//matching failed.
ConnectionInfo returnCI = new ConnectionInfo();
@@ -194,7 +193,7 @@
}
- protected void getExpiredManagedConnectionInfos(long threshold, ArrayList killList) {
+ protected void getExpiredManagedConnectionInfos(long threshold, List<ManagedConnectionInfo> killList) {
synchronized (pool) {
for (int i = 0; i < pool.currentSize(); i++) {
ManagedConnectionInfo mci = pool.peek(i);
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
index 6eac273..70a0c8f 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
@@ -17,10 +17,10 @@
package org.apache.geronimo.connector.outbound;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.List;
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;
@@ -37,9 +37,9 @@
*/
public class SinglePoolMatchAllConnectionInterceptor extends AbstractSinglePoolConnectionInterceptor {
- private HashMap pool;
+ private Map<ManagedConnection, ManagedConnectionInfo> pool;
- private int maxSize;
+ private final int maxSize;
public SinglePoolMatchAllConnectionInterceptor(final ConnectionInterceptor next,
int maxSize,
@@ -49,7 +49,7 @@
super(next, maxSize, minSize, blockingTimeoutMilliseconds, idleTimeoutMinutes);
this.maxSize = maxSize;
- pool = new HashMap(maxSize);
+ pool = new HashMap<ManagedConnection, ManagedConnectionInfo>(maxSize);
}
protected void internalGetConnection(ConnectionInfo connectionInfo) throws ResourceException {
@@ -67,7 +67,7 @@
mci.getSubject(),
mci.getConnectionRequestInfo());
if (matchedMC != null) {
- connectionInfo.setManagedConnectionInfo((ManagedConnectionInfo) pool.get(matchedMC));
+ connectionInfo.setManagedConnectionInfo(pool.get(matchedMC));
pool.remove(matchedMC);
if (log.isTraceEnabled()) {
log.trace("Returning pooled connection " + connectionInfo.getManagedConnectionInfo());
@@ -143,14 +143,13 @@
protected void internalDestroy() {
synchronized (pool) {
- Iterator it = pool.keySet().iterator();
- for (; it.hasNext(); ) {
+ for (ManagedConnection managedConnection : pool.keySet()) {
try {
- ((ManagedConnection)it.next()).destroy();
+ managedConnection.destroy();
+ } catch (ResourceException ignore) {
}
- catch (ResourceException re) { } // ignore
- it.remove();
}
+ pool.clear();
}
}
@@ -159,33 +158,35 @@
}
public int getIdleConnectionCount() {
- return pool.size();
+ synchronized (pool) {
+ return pool.size();
+ }
}
protected void transferConnections(int maxSize, int shrinkNow) {
//1st example: copy 0 (none)
//2nd example: copy 10 (all)
- HashMap oldPool = pool;
- pool = new HashMap(maxSize);
- //since we have replaced pool already, pool.remove will be very fast:-)
- assert oldPool.size() == connectionCount;
- Iterator it = oldPool.entrySet().iterator();
- for (int i = 0; i < shrinkNow; i++) {
- ConnectionInfo killInfo = new ConnectionInfo((ManagedConnectionInfo) ((Map.Entry)it.next()).getValue());
- internalReturn(killInfo, ConnectionReturnAction.DESTROY);
+ synchronized (pool) {
+ Map<ManagedConnection, ManagedConnectionInfo> oldPool = pool;
+ Map<ManagedConnection, ManagedConnectionInfo> newPool = new HashMap<ManagedConnection, ManagedConnectionInfo>(maxSize);
+ //since we have replaced pool already, pool.remove will be very fast:-)
+ assert oldPool.size() == connectionCount;
+ Iterator<Map.Entry<ManagedConnection, ManagedConnectionInfo>> it = oldPool.entrySet().iterator();
+ for (int i = 0; i < shrinkNow; i++) {
+ ConnectionInfo killInfo = new ConnectionInfo((ManagedConnectionInfo) ((Map.Entry)it.next()).getValue());
+ internalReturn(killInfo, ConnectionReturnAction.DESTROY);
+ }
+ for (; it.hasNext(); ) {
+ Map.Entry<ManagedConnection, ManagedConnectionInfo> entry = it.next();
+ newPool.put(entry.getKey(), entry.getValue());
+ }
+ pool = newPool;
}
- for (; it.hasNext(); ) {
- Map.Entry entry = (Map.Entry) it.next();
- pool.put(entry.getKey(), entry.getValue());
- }
-
}
- protected void getExpiredManagedConnectionInfos(long threshold, ArrayList killList) {
+ protected void getExpiredManagedConnectionInfos(long threshold, List<ManagedConnectionInfo> killList) {
synchronized (pool) {
- for (Iterator iterator = pool.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
- ManagedConnectionInfo mci = (ManagedConnectionInfo) entry.getValue();
+ for (ManagedConnectionInfo mci : pool.values()) {
if (mci.getLastUsed() < threshold) {
killList.add(mci);
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java
index 03ca1c1..4094959 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ThreadLocalCachingConnectionInterceptor.java
@@ -31,7 +31,7 @@
private final ConnectionInterceptor next;
- private final ThreadLocal connections = new ThreadLocal();
+ private final ThreadLocal<ManagedConnectionInfo> connections = new ThreadLocal<ManagedConnectionInfo>();
private final boolean matchConnections;
public ThreadLocalCachingConnectionInterceptor(final ConnectionInterceptor next, final boolean matchConnections) {
@@ -45,7 +45,7 @@
next.getConnection(connectionInfo);
return;
}
- ManagedConnectionInfo managedConnectionInfo = (ManagedConnectionInfo) connections.get();
+ ManagedConnectionInfo managedConnectionInfo = connections.get();
if (managedConnectionInfo != null) {
if (matchConnections) {
ManagedConnectionInfo mciRequest = connectionInfo.getManagedConnectionInfo();
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java
index e4ad23b..96d79ff 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/TransactionCachingInterceptor.java
@@ -17,9 +17,7 @@
package org.apache.geronimo.connector.outbound;
-import java.util.Collections;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
import javax.resource.ResourceException;
@@ -160,8 +158,7 @@
}
returnHandle(sharedMCI);
}
- for (Iterator iterator = managedConnectionInfos.getUnshared().iterator(); iterator.hasNext();) {
- ManagedConnectionInfo managedConnectionInfo = (ManagedConnectionInfo) iterator.next();
+ for (ManagedConnectionInfo managedConnectionInfo : managedConnectionInfos.getUnshared()) {
if (log.isTraceEnabled()) {
log.trace("Transaction completed, attempting to return unshared connection MCI: " + managedConnectionInfo + " for managed connection " + managedConnectionInfo.getManagedConnection() + " to tx caching interceptor " + this);
}
@@ -177,7 +174,7 @@
public static class ManagedConnectionInfos {
private ManagedConnectionInfo shared;
- private Set unshared = Collections.EMPTY_SET;
+ private Set<ManagedConnectionInfo> unshared = new HashSet<ManagedConnectionInfo>(1);
public ManagedConnectionInfo getShared() {
return shared;
@@ -187,19 +184,16 @@
this.shared = shared;
}
- public Set getUnshared() {
+ public Set<ManagedConnectionInfo> getUnshared() {
return unshared;
}
public void addUnshared(ManagedConnectionInfo unsharedMCI) {
- if (this.unshared == Collections.EMPTY_SET) {
- this.unshared = new HashSet();
- }
- this.unshared.add(unsharedMCI);
+ unshared.add(unsharedMCI);
}
public boolean containsUnshared(ManagedConnectionInfo unsharedMCI) {
- return this.unshared.contains(unsharedMCI);
+ return unshared.contains(unsharedMCI);
}
public void remove(ManagedConnectionInfo managedConnectionInfo) {
@@ -210,5 +204,4 @@
}
}
}
-
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java
index 4cf0b0c..bcd2899 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinator.java
@@ -59,8 +59,8 @@
private static final Log log = LogFactory.getLog(ConnectionTrackingCoordinator.class.getName());
private final boolean lazyConnect;
- private final ThreadLocal currentInstanceContexts = new ThreadLocal();
- private final ConcurrentMap proxiesByConnectionInfo = new ConcurrentHashMap();
+ private final ThreadLocal<ConnectorInstanceContext> currentInstanceContexts = new ThreadLocal<ConnectorInstanceContext>();
+ private final ConcurrentMap<ConnectionInfo,Object> proxiesByConnectionInfo = new ConcurrentHashMap<ConnectionInfo,Object>();
public ConnectionTrackingCoordinator() {
this(false);
@@ -75,25 +75,23 @@
}
public ConnectorInstanceContext enter(ConnectorInstanceContext newContext) throws ResourceException {
- ConnectorInstanceContext oldContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext oldContext = currentInstanceContexts.get();
currentInstanceContexts.set(newContext);
associateConnections(newContext);
return oldContext;
}
private void associateConnections(ConnectorInstanceContext context) throws ResourceException {
- Map connectionManagerToManagedConnectionInfoMap = context.getConnectionManagerMap();
- for (Iterator i = connectionManagerToManagedConnectionInfoMap.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- ConnectionTrackingInterceptor mcci =
- (ConnectionTrackingInterceptor) entry.getKey();
- Set connections = (Set) entry.getValue();
- mcci.enter(connections);
- }
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerToManagedConnectionInfoMap = context.getConnectionManagerMap();
+ for (Map.Entry<ConnectionTrackingInterceptor, Set<ConnectionInfo>> entry : connectionManagerToManagedConnectionInfoMap.entrySet()) {
+ ConnectionTrackingInterceptor mcci = entry.getKey();
+ Set<ConnectionInfo> connections = entry.getValue();
+ mcci.enter(connections);
+ }
}
public void newTransaction() throws ResourceException {
- ConnectorInstanceContext currentContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext currentContext = currentInstanceContexts.get();
if (currentContext == null) {
return;
}
@@ -101,20 +99,18 @@
}
public void exit(ConnectorInstanceContext oldContext) throws ResourceException {
- ConnectorInstanceContext currentContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext currentContext = currentInstanceContexts.get();
try {
// for each connection type opened in this componet
- Map resources = currentContext.getConnectionManagerMap();
- for (Iterator i = resources.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- ConnectionTrackingInterceptor mcci =
- (ConnectionTrackingInterceptor) entry.getKey();
- Set connections = (Set) entry.getValue();
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> resources = currentContext.getConnectionManagerMap();
+ for (Iterator<Map.Entry<ConnectionTrackingInterceptor, Set<ConnectionInfo>>> iterator = resources.entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry<ConnectionTrackingInterceptor, Set<ConnectionInfo>> entry = iterator.next();
+ ConnectionTrackingInterceptor mcci = entry.getKey();
+ Set<ConnectionInfo> connections = entry.getValue();
// release proxy connections
if (lazyConnect) {
- for (Iterator infoIterator = connections.iterator(); infoIterator.hasNext();) {
- ConnectionInfo connectionInfo = (ConnectionInfo) infoIterator.next();
+ for (ConnectionInfo connectionInfo : connections) {
releaseProxyConnection(connectionInfo);
}
}
@@ -124,7 +120,7 @@
// if no connection remain clear context... we could support automatic commit, rollback or exception here
if (connections.isEmpty()) {
- i.remove();
+ iterator.remove();
}
}
} finally {
@@ -147,15 +143,15 @@
ConnectionInfo connectionInfo,
boolean reassociate) throws ResourceException {
- ConnectorInstanceContext currentContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext currentContext = currentInstanceContexts.get();
if (currentContext == null) {
return;
}
- Map resources = currentContext.getConnectionManagerMap();
- Set infos = (Set) resources.get(connectionTrackingInterceptor);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> resources = currentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = resources.get(connectionTrackingInterceptor);
if (infos == null) {
- infos = new HashSet();
+ infos = new HashSet<ConnectionInfo>();
resources.put(connectionTrackingInterceptor, infos);
}
@@ -178,18 +174,18 @@
ConnectionInfo connectionInfo,
ConnectionReturnAction connectionReturnAction) {
- ConnectorInstanceContext currentContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext currentContext = currentInstanceContexts.get();
if (currentContext == null) {
return;
}
- Map resources = currentContext.getConnectionManagerMap();
- Set infos = (Set) resources.get(connectionTrackingInterceptor);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> resources = currentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = resources.get(connectionTrackingInterceptor);
if (infos != null) {
if (connectionInfo.getConnectionHandle() == null) {
//destroy was called as a result of an error
ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
- Collection toRemove = mci.getConnectionInfos();
+ Collection<ConnectionInfo> toRemove = mci.getConnectionInfos();
infos.removeAll(toRemove);
} else {
infos.remove(connectionInfo);
@@ -216,15 +212,15 @@
* @param key the unique id of the connection manager
*/
public void setEnvironment(ConnectionInfo connectionInfo, String key) {
- ConnectorInstanceContext currentContext = (ConnectorInstanceContext) currentInstanceContexts.get();
+ ConnectorInstanceContext currentContext = currentInstanceContexts.get();
if (currentContext != null) {
// is this resource unshareable in this component context
- Set unshareableResources = currentContext.getUnshareableResources();
+ Set<String> unshareableResources = currentContext.getUnshareableResources();
boolean unshareable = unshareableResources.contains(key);
connectionInfo.setUnshareable(unshareable);
// does this resource use application managed security in this component context
- Set applicationManagedSecurityResources = currentContext.getApplicationManagedSecurityResources();
+ Set<String> applicationManagedSecurityResources = currentContext.getApplicationManagedSecurityResources();
boolean applicationManagedSecurity = applicationManagedSecurityResources.contains(key);
connectionInfo.setApplicationManagedSecurity(applicationManagedSecurity);
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java
index 578b604..1f9499a 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContext.java
@@ -17,6 +17,9 @@
package org.apache.geronimo.connector.outbound.connectiontracking;
+import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
+import org.apache.geronimo.connector.outbound.ConnectionInfo;
+
import java.util.Map;
import java.util.Set;
@@ -28,9 +31,9 @@
* IMPORTANT INVARIANT: this should always return a map, never null.
* @return map of ConnectionManager to (list of ) managed connection info objects.
*/
- Map getConnectionManagerMap();
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> getConnectionManagerMap();
- Set getUnshareableResources();
+ Set<String> getUnshareableResources();
- Set getApplicationManagedSecurityResources();
+ Set<String> getApplicationManagedSecurityResources();
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java
index 268c428..35b9969 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectorInstanceContextImpl.java
@@ -17,6 +17,9 @@
package org.apache.geronimo.connector.outbound.connectiontracking;
+import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
+import org.apache.geronimo.connector.outbound.ConnectionInfo;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -29,24 +32,24 @@
*
* */
public class ConnectorInstanceContextImpl implements ConnectorInstanceContext {
- private final Map connectionManagerMap = new HashMap();
- private final Set unshareableResources;
- private final Set applicationManagedSecurityResources;
+ private final Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = new HashMap<ConnectionTrackingInterceptor, Set<ConnectionInfo>>();
+ private final Set<String> unshareableResources;
+ private final Set<String> applicationManagedSecurityResources;
- public ConnectorInstanceContextImpl(Set unshareableResources, Set applicationManagedSecurityResources) {
+ public ConnectorInstanceContextImpl(Set<String> unshareableResources, Set<String> applicationManagedSecurityResources) {
this.unshareableResources = unshareableResources;
this.applicationManagedSecurityResources = applicationManagedSecurityResources;
}
- public Map getConnectionManagerMap() {
+ public Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> getConnectionManagerMap() {
return connectionManagerMap;
}
- public Set getUnshareableResources() {
+ public Set<String> getUnshareableResources() {
return unshareableResources;
}
- public Set getApplicationManagedSecurityResources() {
+ public Set<String> getApplicationManagedSecurityResources() {
return applicationManagedSecurityResources;
}
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/SharedConnectorInstanceContext.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/SharedConnectorInstanceContext.java
index 53c0a50..174e588 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/SharedConnectorInstanceContext.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/SharedConnectorInstanceContext.java
@@ -16,6 +16,9 @@
*/
package org.apache.geronimo.connector.outbound.connectiontracking;
+import org.apache.geronimo.connector.outbound.ConnectionTrackingInterceptor;
+import org.apache.geronimo.connector.outbound.ConnectionInfo;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -26,18 +29,18 @@
*/
public class SharedConnectorInstanceContext implements ConnectorInstanceContext {
- private Map connectionManagerMap = new HashMap();
+ private Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = new HashMap<ConnectionTrackingInterceptor, Set<ConnectionInfo>>();
- private final Set unshareableResources;
- private final Set applicationManagedSecurityResources;
+ private final Set<String> unshareableResources;
+ private final Set<String> applicationManagedSecurityResources;
private boolean hide = false;
- public SharedConnectorInstanceContext(Set unshareableResources, Set applicationManagedSecurityResources, boolean share) {
+ public SharedConnectorInstanceContext(Set<String> unshareableResources, Set<String> applicationManagedSecurityResources, boolean share) {
this.unshareableResources = unshareableResources;
this.applicationManagedSecurityResources = applicationManagedSecurityResources;
if (!share) {
- connectionManagerMap = new HashMap();
+ connectionManagerMap = new HashMap<ConnectionTrackingInterceptor, Set<ConnectionInfo>>();
}
}
@@ -49,18 +52,18 @@
this.hide = true;
}
- public Map getConnectionManagerMap() {
+ public Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> getConnectionManagerMap() {
if (hide) {
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
return connectionManagerMap;
}
- public Set getUnshareableResources() {
+ public Set<String> getUnshareableResources() {
return unshareableResources;
}
- public Set getApplicationManagedSecurityResources() {
+ public Set<String> getApplicationManagedSecurityResources() {
return applicationManagedSecurityResources;
}
}
diff --git a/geronimo-connector/src/main/java/org/apache/geronimo/connector/work/pool/WorkExecutorPoolImpl.java b/geronimo-connector/src/main/java/org/apache/geronimo/connector/work/pool/WorkExecutorPoolImpl.java
index 199f897..4826fd0 100644
--- a/geronimo-connector/src/main/java/org/apache/geronimo/connector/work/pool/WorkExecutorPoolImpl.java
+++ b/geronimo-connector/src/main/java/org/apache/geronimo/connector/work/pool/WorkExecutorPoolImpl.java
@@ -47,7 +47,7 @@
* @param maxSize Maximum size of the work executor pool.
*/
public WorkExecutorPoolImpl(int maxSize) {
- pooledExecutor = new ThreadPoolExecutor(1, maxSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue());
+ pooledExecutor = new ThreadPoolExecutor(1, maxSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
/*
FIXME: How to do this with concurrent.util ?
pooledExecutor.waitWhenBlocked();
diff --git a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java
index 8c3a6b6..04f812b 100644
--- a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java
+++ b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerStressTest.java
@@ -66,7 +66,7 @@
for (int i = 0; i < repeatCount; i++) {
try {
long start = System.currentTimeMillis();
- defaultComponentInterceptor.invoke(new ConnectorInstanceContextImpl(new HashSet(), new HashSet()));
+ defaultComponentInterceptor.invoke(new ConnectorInstanceContextImpl(new HashSet<String>(), new HashSet<String>()));
long duration = System.currentTimeMillis() - start;
if (duration > 100) {
localSlowCount++;
diff --git a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
index 0de142e..e0d4103 100644
--- a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
+++ b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
@@ -73,8 +73,8 @@
protected MockManagedConnectionFactory mockManagedConnectionFactory;
protected ConnectorInstanceContextImpl connectorInstanceContext;
protected DefaultComponentInterceptor defaultComponentInterceptor;
- protected Set unshareableResources = new HashSet();
- protected Set applicationManagedSecurityResources = new HashSet();
+ protected Set<String> unshareableResources = new HashSet<String>();
+ protected Set<String> applicationManagedSecurityResources = new HashSet<String>();
protected MockManagedConnection mockManagedConnection;
protected Subject subject;
protected UserTransaction userTransaction;
@@ -93,6 +93,7 @@
private ClassLoader classLoader = this.getClass().getClassLoader();
protected void setUp() throws Exception {
+ super.setUp();
TransactionManagerImpl transactionManager = new TransactionManagerImpl();
this.transactionManager = transactionManager;
@@ -126,6 +127,7 @@
connectionManagerDeployment = null;
connectionFactory = null;
connectorInstanceContext = null;
+ super.tearDown();
}
public Object invoke(ConnectorInstanceContext newConnectorInstanceContext) throws Throwable {
diff --git a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java
index e8ea77f..9a0fc8a 100644
--- a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java
+++ b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorProxyTest.java
@@ -46,8 +46,8 @@
private ConnectionTrackingCoordinator connectionTrackingCoordinator;
private ConnectionTrackingInterceptor key1;
private Subject subject = null;
- private Set unshareableResources;
- private Set applicationManagedSecurityResources;
+ private Set<String> unshareableResources;
+ private Set<String> applicationManagedSecurityResources;
private ManagedConnectionInfo mci;
private ConnectionImpl connection;
@@ -55,8 +55,8 @@
super.setUp();
connectionTrackingCoordinator = new ConnectionTrackingCoordinator(true);
key1 = new ConnectionTrackingInterceptor(this, name1, connectionTrackingCoordinator);
- unshareableResources = new HashSet();
- applicationManagedSecurityResources = new HashSet();
+ unshareableResources = new HashSet<String>();
+ applicationManagedSecurityResources = new HashSet<String>();
mci = new ManagedConnectionInfo(null, null);
mci.setManagedConnection(new MockManagedConnection());
@@ -81,8 +81,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -108,7 +108,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertEquals("Expected no connection set for key1", null, infos);
// enter again, and close the handle
@@ -135,8 +135,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -180,7 +180,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos);
// use connection which will cause it to get a new handle if it is not closed
@@ -203,8 +203,8 @@
connectionTrackingCoordinator.handleObtained(key1, connectionInfo, false);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -246,7 +246,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos);
// enter again
diff --git a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java
index a16e601..fdaa0aa 100644
--- a/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java
+++ b/geronimo-connector/src/test/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorTest.java
@@ -44,16 +44,16 @@
private ConnectionTrackingInterceptor key1;
private ConnectionTrackingInterceptor nestedKey;
private Subject subject = null;
- private Set unshareableResources;
- private Set applicationManagedSecurityResources;
+ private Set<String> unshareableResources;
+ private Set<String> applicationManagedSecurityResources;
protected void setUp() throws Exception {
super.setUp();
connectionTrackingCoordinator = new ConnectionTrackingCoordinator(false);
key1 = new ConnectionTrackingInterceptor(this, name1, connectionTrackingCoordinator);
nestedKey = new ConnectionTrackingInterceptor(this, name2, connectionTrackingCoordinator);
- unshareableResources = new HashSet();
- applicationManagedSecurityResources = new HashSet();
+ unshareableResources = new HashSet<String>();
+ applicationManagedSecurityResources = new HashSet<String>();
}
protected void tearDown() throws Exception {
@@ -77,8 +77,8 @@
connectionTrackingCoordinator.exit(oldConnectorInstanceContext);
// connection should be in component instance context
- Map connectionManagerMap = componentContext.getConnectionManagerMap();
- Set infos = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> infos = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos);
assertEquals("Expected one connection for key1", 1, infos.size());
assertTrue("Expected to get supplied ConnectionInfo from infos", connectionInfo == infos.iterator().next());
@@ -91,7 +91,7 @@
// connection should not be in context
connectionManagerMap = componentContext.getConnectionManagerMap();
- infos = (Set) connectionManagerMap.get(key1);
+ infos = connectionManagerMap.get(key1);
assertEquals("Expected no connection set for key1", null, infos);
}
@@ -125,8 +125,8 @@
// exit nested component context
connectionTrackingCoordinator.exit(oldConnectorInstanceContext2);
- Map nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
- Set nestedInfos = (Set) nestedConnectionManagerMap.get(nestedKey);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> nestedConnectionManagerMap = nextedComponentContext.getConnectionManagerMap();
+ Set<ConnectionInfo> nestedInfos = nestedConnectionManagerMap.get(nestedKey);
assertNotNull("Expected one connections for key2", nestedInfos);
assertEquals("Expected one connection for key2", 1, nestedInfos.size());
assertSame("Expected to get supplied ConnectionInfo from infos", nestedConnectionInfo, nestedInfos.iterator().next());
@@ -135,8 +135,8 @@
// exit outer component context
connectionTrackingCoordinator.exit(oldConnectorInstanceContext1);
- Map connectionManagerMap = componentContext1.getConnectionManagerMap();
- Set infos1 = (Set) connectionManagerMap.get(key1);
+ Map<ConnectionTrackingInterceptor, Set<ConnectionInfo>> connectionManagerMap = componentContext1.getConnectionManagerMap();
+ Set<ConnectionInfo> infos1 = connectionManagerMap.get(key1);
assertNotNull("Expected one connections for key1", infos1);
assertEquals("Expected one connection for key1", 1, infos1.size());
assertSame("Expected to get supplied ConnectionInfo from infos", connectionInfo1, infos1.iterator().next());
@@ -150,7 +150,7 @@
// connection should not be in context
connectionManagerMap = componentContext1.getConnectionManagerMap();
- infos1 = (Set) connectionManagerMap.get(key1);
+ infos1 = connectionManagerMap.get(key1);
assertNull("Expected no connection set for key1", infos1);
}