Examples of lockFromCluster()


Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

     
      ClusterNode caller = testee.getCurrentView().get(0);
      assertFalse(node1.equals(caller));
     
      resetToStrict(handler);     
      handler.lockFromCluster("test", caller, 1000);
      replay(handler);
     
      RemoteLockResponse rsp = target.remoteLock("test", caller, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

     
      ClusterNode caller2 = testee.getCurrentView().get(2);
      assertFalse(node1.equals(caller2));
     
      resetToStrict(handler);       
      handler.lockFromCluster("test", caller1, 1000);   
      replay(handler);
     
      RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

      // When caller 1 invokes, block before giving response
      CountDownLatch answerStartLatch = new CountDownLatch(1);
      CountDownLatch answerDoneLatch = new CountDownLatch(1);
      BlockingAnswer<Boolean> caller1Answer = new BlockingAnswer<Boolean>(Boolean.TRUE, answerStartLatch, null, answerDoneLatch);
      BlockingAnswer<Boolean> caller2Answer = new BlockingAnswer<Boolean>(new TimeoutException(caller1), answerDoneLatch, 0, null, null);
      handler.lockFromCluster("test", caller1, 1000);
      expectLastCall().andAnswer(caller1Answer);
      handler.lockFromCluster("test", caller2, 1000);

     
      // There is a race where t1 may have already marked the lock as LOCKED in
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

      CountDownLatch answerDoneLatch = new CountDownLatch(1);
      BlockingAnswer<Boolean> caller1Answer = new BlockingAnswer<Boolean>(Boolean.TRUE, answerStartLatch, null, answerDoneLatch);
      BlockingAnswer<Boolean> caller2Answer = new BlockingAnswer<Boolean>(new TimeoutException(caller1), answerDoneLatch, 0, null, null);
      handler.lockFromCluster("test", caller1, 1000);
      expectLastCall().andAnswer(caller1Answer);
      handler.lockFromCluster("test", caller2, 1000);

     
      // There is a race where t1 may have already marked the lock as LOCKED in
      // which case t2 will not call handler.lockFromCluster("test", caller2, 1000);
      // See FIXME in method javadoc. So, we use times(0, 1) to specify no
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

      ClusterNode caller1 = testee.getCurrentView().get(0);
      assertFalse(node1.equals(caller1));
     
      resetToStrict(handler);  
      // We throw TimeoutException to indicate "node1" holds the lock
      handler.lockFromCluster("test", caller1, 1000);
      expectLastCall().andThrow(new TimeoutException(node1));   
      replay(handler);
     
      RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);
     
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

     
      // A second attempt should succeed if the local lock is released
     
      resetToStrict(handler);    
      // We return normally to indicate success
      handler.lockFromCluster("test", caller1, 1000);   
      replay(handler);
     
      rsp = target.remoteLock("test", caller1, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

                                           eq("remoteLock"),
                                           eqLockParams(node1, 2000000),
                                           aryEq(AbstractClusterLockSupport.REMOTE_LOCK_TYPES),
                                           eq(true))).andReturn(rspList).atLeastOnce();
     
      handler.lockFromCluster(eq("test"), eq(node1), anyLong());
      expectLastCall().andThrow(new TimeoutException(node1)).atLeastOnce();

     
      expect(partition.callMethodOnCluster(eq("test"),
                                           eq("releaseRemoteLock"),
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

     
      ClusterNode caller2 = members.get(2);
      assertFalse(node1.equals(caller2));
     
      resetToStrict(handler);            
      handler.lockFromCluster("test", caller1, 1000);
      replay(handler);
     
      RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

     
      verify(handler);
     
      // A call from a different caller should work
      resetToStrict(handler);            
      handler.lockFromCluster("test", caller2, 1000);
      replay(handler);
     
      rsp = target.remoteLock("test", caller2, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.LocalLockHandler.lockFromCluster()

      ClusterNode caller2 = testee.getCurrentView().get(2);
     
      resetToStrict(partition);
      resetToStrict(handler);
     
      handler.lockFromCluster(eq("test"), eq(caller1), anyLong());
     
      expect(handler.getLockHolder("test")).andReturn(caller1);
     
      replay(partition);
      replay(handler);
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.