Search in sources :

Example 16 with ServiceLock

use of org.apache.accumulo.fate.zookeeper.ServiceLock in project accumulo by apache.

the class ServiceLockIT method testNoParent.

@Test(timeout = 10000)
public void testNoParent() throws Exception {
    var parent = ServiceLock.path("/zltestNoParent-" + this.hashCode() + "-l" + pdCount.incrementAndGet());
    ServiceLock zl = getZooLock(parent, UUID.randomUUID());
    assertFalse(zl.isLocked());
    TestALW lw = new TestALW();
    zl.lock(lw, "test1".getBytes(UTF_8));
    lw.waitForChanges(1);
    assertFalse(lw.locked);
    assertFalse(zl.isLocked());
    assertNotNull(lw.exception);
    assertNull(lw.reason);
}
Also used : ServiceLock(org.apache.accumulo.fate.zookeeper.ServiceLock) Test(org.junit.Test)

Aggregations

ServiceLock (org.apache.accumulo.fate.zookeeper.ServiceLock)16 ZooReaderWriter (org.apache.accumulo.fate.zookeeper.ZooReaderWriter)8 Test (org.junit.Test)8 LockLossReason (org.apache.accumulo.fate.zookeeper.ServiceLock.LockLossReason)5 LockWatcher (org.apache.accumulo.fate.zookeeper.ServiceLock.LockWatcher)5 UUID (java.util.UUID)4 ServerServices (org.apache.accumulo.core.util.ServerServices)4 IOException (java.io.IOException)3 KeeperException (org.apache.zookeeper.KeeperException)3 ZooKeeper (org.apache.zookeeper.ZooKeeper)3 UnknownHostException (java.net.UnknownHostException)2 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)2 ServerContext (org.apache.accumulo.server.ServerContext)2 TException (org.apache.thrift.TException)2 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 FileNotFoundException (java.io.FileNotFoundException)1 Field (java.lang.reflect.Field)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 ThriftSecurityException (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)1