@Test public void testShouldCleanLock() throws IOException { ThemisLock lock = getLock(COLUMN); Mockito.when(mockRegister.isWorkerAlive(lock.getClientAddress())).thenReturn(true); Assert.assertFalse(lockCleaner.shouldCleanLock(lock)); Mockito.when(mockRegister.isWorkerAlive(lock.getClientAddress())).thenReturn(false); Assert.assertTrue(lockCleaner.shouldCleanLock(lock)); }
public boolean shouldCleanLock(ThemisLock lock) throws IOException { boolean isWorkerAlive = register.isWorkerAlive(lock.getClientAddress()); if (!isWorkerAlive) { LOG.warn("worker, address=" + lock.getClientAddress() + " is not alive"); return true; } return lock.isLockExpired(); }
LockCleaner extends ServerLockCleaner { public boolean shouldCleanLock(ThemisLock lock) throws IOException { boolean isWorkerAlive = register.isWorkerAlive(lock.getClientAddress()); if (!isWorkerAlive) { LOG.warn("worker, address=" + lock.getClientAddress() + " is not alive"); return true; } return lock.isLockExpired(); } }
LockCleaner extends ServerLockCleaner { public boolean shouldCleanLock(ThemisLock lock) throws IOException { boolean isWorkerAlive = register.isWorkerAlive(lock.getClientAddress()); if (!isWorkerAlive) { LOG.warn("worker, address=" + lock.getClientAddress() + " is not alive"); return true; } return lock.isLockExpired(); } LockCleaner(Configuration conf, HConnection conn, WorkerRegister register,
      ThemisCoprocessorClient cpClient); }
LockCleaner extends ServerLockCleaner { public boolean shouldCleanLock(ThemisLock lock) throws IOException { boolean isWorkerAlive = register.isWorkerAlive(lock.getClientAddress()); if (!isWorkerAlive) { LOG.warn("worker, address=" + lock.getClientAddress() + " is not alive"); return true; } return lock.isLockExpired(); } LockCleaner(Configuration conf, HConnection conn, WorkerRegister register,
      ThemisCoprocessorClient cpClient); static LockCleaner getLockCleaner(Configuration conf, HConnection conn,
      WorkerRegister register, ThemisCoprocessorClient cpClient); boolean shouldCleanLock(ThemisLock lock); static List<ThemisLock> constructLocks(byte[] tableName, List<KeyValue> lockKvs,
      ThemisCoprocessorClient cpClient, int clientLockTTL); static void checkLockExpired(ThemisLock lock, ThemisCoprocessorClient cpClient,
      int clientLockTTL); void tryToCleanLocks(byte[] tableName, List<KeyValue> lockColumns); boolean checkLockExpiredAndTryToCleanLock(ThemisLock lock); boolean tryToCleanLock(ThemisLock lock); }
LockCleaner extends ServerLockCleaner { public boolean shouldCleanLock(ThemisLock lock) throws IOException { boolean isWorkerAlive = register.isWorkerAlive(lock.getClientAddress()); if (!isWorkerAlive) { LOG.warn("worker, address=" + lock.getClientAddress() + " is not alive"); return true; } return lock.isLockExpired(); } LockCleaner(Configuration conf, HConnection conn, WorkerRegister register,
      ThemisCoprocessorClient cpClient); static LockCleaner getLockCleaner(Configuration conf, HConnection conn,
      WorkerRegister register, ThemisCoprocessorClient cpClient); boolean shouldCleanLock(ThemisLock lock); static List<ThemisLock> constructLocks(byte[] tableName, List<KeyValue> lockKvs,
      ThemisCoprocessorClient cpClient, int clientLockTTL); static void checkLockExpired(ThemisLock lock, ThemisCoprocessorClient cpClient,
      int clientLockTTL); void tryToCleanLocks(byte[] tableName, List<KeyValue> lockColumns); boolean checkLockExpiredAndTryToCleanLock(ThemisLock lock); boolean tryToCleanLock(ThemisLock lock);  }