コード例 #1
0
  /**
   * Returns a lock queue for a lock identified by the combination of <code>lockRegionName</code>
   * and <code>lockKey</code>. If the lock queue does not exist, creates and registers it.
   *
   * @param lockRegionName a name of the region where this lock is going to be placed. The region
   *     name is used to separate cluster-wide and cache-specific locks.
   * @param lockKey@return a lock queue.
   * @return the lock queue.
   */
  public LockQueue getLockQueue(final String lockRegionName, final Binary lockKey) {

    final LockQueueKey lockQueueKey = new LockQueueKey(lockRegionName, lockKey);
    LockQueue lockQueue = lockQueues.get(lockQueueKey);
    if (lockQueue == null) {

      lockQueue = new LockQueue();
      lockQueues.put(lockQueueKey, lockQueue);
    }
    return lockQueue;
  }
コード例 #2
0
  /** {@inheritDoc} */
  public void readWire(final DataInputStream in) throws IOException, ClassNotFoundException {

    final int size = in.readInt();
    for (int i = 0; i < size; i++) {

      final LockQueueKey lockQueueKey = new LockQueueKey();
      lockQueueKey.readWire(in);
      final LockQueue lockQueue = new LockQueue();
      lockQueue.readWire(in);
      lockQueues.put(lockQueueKey, lockQueue);
    }
  }