Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

critical path in lookup of DBPortPool #67

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/main/com/mongodb/DBPortPool.java
Expand Up @@ -54,16 +54,11 @@ static class Holder {

DBPortPool get( ServerAddress addr ){

DBPortPool p = _pools.get( addr );

if (p != null)
return p;

synchronized (_pools) {
p = _pools.get( addr );
if (p != null) {
DBPortPool p = _pools.get( addr );

if (p != null)
return p;
}

p = new DBPortPool( addr , _options );
_pools.put( addr , p);
Expand All @@ -85,9 +80,9 @@ DBPortPool get( ServerAddress addr ){
}
}

return p;
}

return p;
}

void close(){
Expand Down Expand Up @@ -115,7 +110,7 @@ private ObjectName createObjectName( ServerAddress addr ) throws MalformedObject
}

final MongoOptions _options;
final Map<ServerAddress,DBPortPool> _pools = Collections.synchronizedMap( new HashMap<ServerAddress,DBPortPool>() );
final Map<ServerAddress,DBPortPool> _pools = new HashMap<ServerAddress,DBPortPool>();
final MBeanServer _server;
}

Expand Down