public synchronized static IDGenerator generatorFor ( int generatorId , int clusterId , Mode mode ) { assertParameterWithinBounds ( "generatorId" , 0 , Blueprint . MAX_GENERATOR_ID , generatorId ) ; assertParameterWithinBounds ( "clusterId" , 0 , Blueprint . MAX_CLUSTER_ID , clusterId ) ; String generatorAndCluster = String . format ( "%d_%d" , generatorId , clusterId ) ; if ( ! instances . containsKey ( generatorAndCluster ) ) { GeneratorIdentityHolder identityHolder = LocalGeneratorIdentity . with ( clusterId , generatorId ) ; instances . putIfAbsent ( generatorAndCluster , new BaseUniqueIDGenerator ( identityHolder , mode ) ) ; } return instances . get ( generatorAndCluster ) ; }
Return the UniqueIDGenerator instance for this specific generator - ID cluster - ID combination . If one was already created that is returned .