use of com.hazelcast.internal.util.LockGuard in project hazelcast by hazelcast.
the class ClusterStateManagerTest method test_lockClusterState_extendLease.
@Test
public void test_lockClusterState_extendLease() throws Exception {
Address initiator = newAddress();
clusterStateManager.lockClusterState(ClusterStateChange.from(FROZEN), initiator, TXN, 10000, MEMBERLIST_VERSION, PARTITION_STAMP);
clusterStateManager.lockClusterState(ClusterStateChange.from(FROZEN), initiator, TXN, TimeUnit.DAYS.toMillis(1), MEMBERLIST_VERSION, PARTITION_STAMP);
LockGuard stateLock = clusterStateManager.getStateLock();
assertTrue(Clock.currentTimeMillis() + TimeUnit.HOURS.toMillis(12) < stateLock.getLockExpiryTime());
}
use of com.hazelcast.internal.util.LockGuard in project hazelcast by hazelcast.
the class ClusterStateManagerTest method test_changeLocalClusterState_success.
@Test
public void test_changeLocalClusterState_success() throws Exception {
ClusterStateChange newState = ClusterStateChange.from(FROZEN);
Address initiator = newAddress();
clusterStateManager.lockClusterState(newState, initiator, TXN, 10000, MEMBERLIST_VERSION, PARTITION_STAMP);
clusterStateManager.commitClusterState(newState, initiator, TXN);
assertEquals(newState.getNewState(), clusterStateManager.getState());
LockGuard stateLock = clusterStateManager.getStateLock();
assertFalse(stateLock.isLocked());
}
Aggregations