use of org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider in project hudi by apache.
the class TestZookeeperBasedLockProvider method testReentrantLock.
@Test
public void testReentrantLock() {
ZookeeperBasedLockProvider zookeeperBasedLockProvider = new ZookeeperBasedLockProvider(lockConfiguration, client);
Assertions.assertTrue(zookeeperBasedLockProvider.tryLock(lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY), TimeUnit.MILLISECONDS));
try {
zookeeperBasedLockProvider.tryLock(lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY), TimeUnit.MILLISECONDS);
Assertions.fail();
} catch (HoodieLockException e) {
// expected
}
zookeeperBasedLockProvider.unlock();
}
use of org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider in project hudi by apache.
the class TestZookeeperBasedLockProvider method testUnLock.
@Test
public void testUnLock() {
ZookeeperBasedLockProvider zookeeperBasedLockProvider = new ZookeeperBasedLockProvider(lockConfiguration, client);
Assertions.assertTrue(zookeeperBasedLockProvider.tryLock(lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY), TimeUnit.MILLISECONDS));
zookeeperBasedLockProvider.unlock();
zookeeperBasedLockProvider.tryLock(lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY), TimeUnit.MILLISECONDS);
}
use of org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider in project hudi by apache.
the class TestZookeeperBasedLockProvider method testAcquireLock.
@Test
public void testAcquireLock() {
ZookeeperBasedLockProvider zookeeperBasedLockProvider = new ZookeeperBasedLockProvider(lockConfiguration, client);
Assertions.assertTrue(zookeeperBasedLockProvider.tryLock(lockConfiguration.getConfig().getLong(LOCK_ACQUIRE_WAIT_TIMEOUT_MS_PROP_KEY), TimeUnit.MILLISECONDS));
zookeeperBasedLockProvider.unlock();
}
use of org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider in project hudi by apache.
the class TestZookeeperBasedLockProvider method testUnlockWithoutLock.
@Test
public void testUnlockWithoutLock() {
ZookeeperBasedLockProvider zookeeperBasedLockProvider = new ZookeeperBasedLockProvider(lockConfiguration, client);
zookeeperBasedLockProvider.unlock();
}
Aggregations