public static synchronized IDGenerator generatorFor(SynchronizedGeneratorIdentity synchronizedGeneratorIdentity,
                                                        Mode mode)
            throws IOException {

        String instanceKey = synchronizedGeneratorIdentity.getZNode();
        if (!instances.containsKey(instanceKey)) {
            logger.debug("Creating new instance.");
            instances.putIfAbsent(instanceKey, new BaseUniqueIDGenerator(synchronizedGeneratorIdentity, mode));
        }
        return instances.get(instanceKey);
    }
public static synchronized IDGenerator generatorFor ( SynchronizedGeneratorIdentity synchronizedGeneratorIdentity , Mode mode ) throws IOException { String instanceKey = synchronizedGeneratorIdentity . getZNode ( ) ; if ( ! instances . containsKey ( instanceKey ) ) { logger . debug ( "Creating new instance." ) ; instances . putIfAbsent ( instanceKey , new BaseUniqueIDGenerator ( synchronizedGeneratorIdentity , mode ) ) ; } return instances . get ( instanceKey ) ; }
Get the synchronized ID generator instance.

@param synchronizedGeneratorIdentity An instance of {@link SynchronizedGeneratorIdentity} to (re)use for
acquiring the generator ID.
@param mode                          Generator mode.
@return An instance of this class.
@throws IOException Thrown when something went wrong trying to find the cluster ID or trying to claim a
generator ID.