8159822: Non-synchronized access to shared members of com.sun.jndi.ldap.pool.Pool
Reviewed-by: coffeys
This commit is contained in:
parent
50e42d2212
commit
06075b3f8b
@ -118,7 +118,11 @@ final public class Pool {
|
|||||||
PooledConnectionFactory factory) throws NamingException {
|
PooledConnectionFactory factory) throws NamingException {
|
||||||
|
|
||||||
d("get(): ", id);
|
d("get(): ", id);
|
||||||
d("size: ", map.size());
|
if (debug) {
|
||||||
|
synchronized (map) {
|
||||||
|
d("size: ", map.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
expungeStaleConnections();
|
expungeStaleConnections();
|
||||||
|
|
||||||
@ -141,10 +145,9 @@ final public class Pool {
|
|||||||
// Keep the weak reference through the element of a linked list
|
// Keep the weak reference through the element of a linked list
|
||||||
weakRefs.add(weakRef);
|
weakRefs.add(weakRef);
|
||||||
}
|
}
|
||||||
|
d("get(): size after: ", map.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
d("get(): size after: ", map.size());
|
|
||||||
|
|
||||||
return conns.get(timeout, factory); // get one connection from list
|
return conns.get(timeout, factory); // get one connection from list
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,19 +212,24 @@ final public class Pool {
|
|||||||
out.println("maximum pool size: " + maxSize);
|
out.println("maximum pool size: " + maxSize);
|
||||||
out.println("preferred pool size: " + prefSize);
|
out.println("preferred pool size: " + prefSize);
|
||||||
out.println("initial pool size: " + initSize);
|
out.println("initial pool size: " + initSize);
|
||||||
out.println("current pool size: " + map.size());
|
|
||||||
|
|
||||||
for (Map.Entry<Object, ConnectionsRef> entry : map.entrySet()) {
|
synchronized (map) {
|
||||||
id = entry.getKey();
|
out.println("current pool size: " + map.size());
|
||||||
conns = entry.getValue().getConnections();
|
|
||||||
out.println(" " + id + ":" + conns.getStats());
|
for (Map.Entry<Object, ConnectionsRef> entry : map.entrySet()) {
|
||||||
|
id = entry.getKey();
|
||||||
|
conns = entry.getValue().getConnections();
|
||||||
|
out.println(" " + id + ":" + conns.getStats());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out.println("====== Pool end =====================");
|
out.println("====== Pool end =====================");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " " + map.toString();
|
synchronized (map) {
|
||||||
|
return super.toString() + " " + map.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void d(String msg, int i) {
|
private void d(String msg, int i) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user