コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 /** Release a lock for the sequence name. */
 protected void releaseLock(String seqName) {
   ConcurrencyManager manager = getLocks().get(seqName);
   manager.release();
 }