Examples of LockRequest


Examples of com.hazelcast.concurrent.lock.client.LockRequest

        return (Long) invoke(request);
    }

    public void lock(long leaseTime, TimeUnit timeUnit) {
        shouldBePositive(leaseTime, "leaseTime");
        LockRequest request = new LockRequest(getKeyData(), ThreadUtil.getThreadId(), getTimeInMillis(leaseTime, timeUnit), -1);
        invoke(request);
    }
View Full Code Here

Examples of com.hazelcast.concurrent.lock.client.LockRequest

            return false;
        }
    }

    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        LockRequest request = new LockRequest(getKeyData(),
                ThreadUtil.getThreadId(), Long.MAX_VALUE, getTimeInMillis(time, unit));
        Boolean result = invoke(request);
        return result;
    }
View Full Code Here

Examples of com.hazelcast.concurrent.lock.client.LockRequest

        return (Long) invoke(request);
    }

    public void lock(long leaseTime, TimeUnit timeUnit) {
        shouldBePositive(leaseTime, "leaseTime");
        LockRequest request = new LockRequest(getKeyData(), ThreadUtil.getThreadId(), getTimeInMillis(leaseTime, timeUnit), -1);
        invoke(request);
    }
View Full Code Here

Examples of com.hazelcast.concurrent.lock.client.LockRequest

    public void lock() {
        lock(Long.MAX_VALUE, null);
    }

    public void lockInterruptibly() throws InterruptedException {
        LockRequest request = new LockRequest(getKeyData(), ThreadUtil.getThreadId(), Long.MAX_VALUE, -1);
        invokeInterruptibly(request, getKeyData());
    }
View Full Code Here

Examples of com.hazelcast.concurrent.lock.client.LockRequest

            return false;
        }
    }

    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        LockRequest request = new LockRequest(getKeyData(),
                ThreadUtil.getThreadId(), Long.MAX_VALUE, getTimeInMillis(time, unit));
        Boolean result = invoke(request);
        return result;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.api.LockRequest

    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    bldr.addLockComponent(comp);
    boolean caughtException = false;
    try {
      LockRequest req = bldr.build();
    } catch (RuntimeException e) {
      Assert.assertEquals("Cannot build a lock without giving a user", e.getMessage());
      caughtException = true;
    }
    Assert.assertTrue(caughtException);
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.api.LockRequest

    LockComponent comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    bldr.addLockComponent(comp).setUser("fred");
    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    bldr.addLockComponent(comp);
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(2, locks.size());
    Assert.assertEquals("fred", req.getUser());
    Assert.assertEquals(InetAddress.getLocalHost().getHostName(), req.getHostname());
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.api.LockRequest

    bldr.addLockComponent(comp).setUser(null);
    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    comp.setTablename("mytable");
    comp.setPartitionname("mypartition");
    bldr.addLockComponent(comp);
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(2, locks.size());
    Assert.assertEquals("unknown", req.getUser());
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.api.LockRequest

    LockRequestBuilder bldr = new LockRequestBuilder();
    LockComponent comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    bldr.addLockComponent(comp).setUser("fred");
    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "yourdb");
    bldr.addLockComponent(comp);
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(2, locks.size());
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.api.LockRequest

    LockRequestBuilder bldr = new LockRequestBuilder();
    LockComponent comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    bldr.addLockComponent(comp);
    comp = new LockComponent(LockType.EXCLUSIVE, LockLevel.DB, "mydb");
    bldr.addLockComponent(comp).setUser("fred");
    LockRequest req = bldr.build();
    List<LockComponent> locks = req.getComponent();
    Assert.assertEquals(1, locks.size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.