private Bucket getOrCreateBucketForKey ( Object key ) { int index = getBucketIndexForKey ( key ) ; // Double-checked locking. Safe since buckets do not initialize any state // until they are synchronized by the caller. d739870 Bucket bucket = buckets [ index ] ; if ( bucket == null ) { synchronized ( bucketLock ) { bucket = buckets [ index ] ; if ( bucket == null ) { // If this is to be a cache of EJB Wrappers, then create Wrapper // specific buckets, that hold EJSWrapperCommon objects, // otherwise create generic BucketImpl. d195605 bucket = wrappers ? new WrapperBucket ( this ) : new BucketImpl ( ) ; buckets [ index ] = bucket ; } } } return bucket ; }
Returns the bucket which the specified key hashes to or creates it if it does not exist .