private Object syncPutIntoBucket ( FastSyncHashBucket hb , FastSyncHashEntry newEntry ) { FastSyncHashEntry e = null ; FastSyncHashEntry last = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "syncPutIntoBucket" ) ; } synchronized ( hb ) { e = hb . root ; // already in there? while ( e != null ) { if ( e . key == newEntry . key ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: key/hash pair is already in the bucket" ) ; } return e . value ; } last = e ; e = e . next ; } if ( last == null ) { if ( hb . root == null ) { // this is root hb . root = newEntry ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: Adding new entry at the beginning (root)" ) ; } return newEntry . value ; } last = hb . root ; while ( last . next != null ) { last = last . next ; } } last . next = newEntry ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "syncPutIntoBucket: Adding new entry at the end" ) ; } return newEntry . value ; } // end-sync }
Put synchronized into bucket .