public LockReplicationOperation(LockStoreContainer container, int partitionId, int replicaIndex) {
   this.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
   final Collection<LockStoreImpl> lockStores = container.getLockStores();
   for (LockStoreImpl ls : lockStores) {
     if (ls.getTotalBackupCount() < replicaIndex) {
       continue;
     }
     locks.add(ls);
   }
 }
 @Override
 protected void writeInternal(final ObjectDataOutput out) throws IOException {
   super.writeInternal(out);
   int len = locks.size();
   out.writeInt(len);
   if (len > 0) {
     for (LockStoreImpl ls : locks) {
       ls.writeData(out);
     }
   }
 }
 @Override
 protected void readInternal(final ObjectDataInput in) throws IOException {
   super.readInternal(in);
   int len = in.readInt();
   if (len > 0) {
     for (int i = 0; i < len; i++) {
       LockStoreImpl ls = new LockStoreImpl();
       ls.readData(in);
       locks.add(ls);
     }
   }
 }
Beispiel #4
0
 @Override
 public final boolean shouldWait() {
   LockStoreImpl lockStore = getLockStore();
   return getWaitTimeout() != 0 && !lockStore.canAcquireLock(key, getCallerUuid(), threadId);
 }
 @Override
 public void run() throws Exception {
   LockStoreImpl lockStore = getLockStore();
   response = lockStore.getLockCount(key);
 }