public MPConnection getOrCreateNewMPConnection ( SIBUuid8 remoteUuid , MEConnection conn ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getOrCreateNewMPConnection" , new Object [ ] { remoteUuid , conn } ) ; MPConnection mpConn ; synchronized ( _mpConnectionsByMEConnection ) { //look up the connection in the cache mpConn = _mpConnectionsByMEConnection . get ( conn ) ; //if it is not in the cache if ( mpConn == null ) { //make sure we know the cellule if ( remoteUuid == null ) { remoteUuid = new SIBUuid8 ( conn . getMessagingEngine ( ) . getUuid ( ) ) ; } //create a new MPConnection for this MEConnection mpConn = new MPConnection ( this , conn , remoteUuid ) ; //put it in the cache _mpConnectionsByMEConnection . put ( conn , mpConn ) ; _mpConnectionsByMEUuid . put ( remoteUuid , mpConn ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getOrCreateNewMPConnection" , mpConn ) ; //return the MPConnection return mpConn ; }
Get a MPConnection from the cache and if there isn t one create a new one and put it in the cache .