Skip to content

Commit b0e163e

Browse files
committed
[JAVA-263]: NullPointerException due to race condition during concurrent access to DBTCPTransport
1 parent 2ae5e43 commit b0e163e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/com/mongodb/DBTCPConnector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ void testMaster()
403403
}
404404
}
405405

406-
private boolean _set( ServerAddress addr ){
407-
if ( _curMaster == addr )
406+
private synchronized boolean _set( ServerAddress addr ){
407+
if ( _curMaster == addr && _masterPortPool != null )
408408
return false;
409409
_curMaster = addr;
410410
_masterPortPool = _portHolder.get( addr );

0 commit comments

Comments
 (0)