/** * Acquire a lock for the sequence name. A lock should be, and only be, acquired when allocating * new sequences from the database. */ protected void acquireLock(String sequenceName) { ConcurrencyManager manager = getLocks().get(sequenceName); if (manager == null) { synchronized (getLocks()) { manager = getLocks().get(sequenceName); if (manager == null) { manager = new ConcurrencyManager(); getLocks().put(sequenceName, manager); } } } manager.acquire(); }
/** Release a lock for the sequence name. */ protected void releaseLock(String seqName) { ConcurrencyManager manager = getLocks().get(seqName); manager.release(); }