Examples of remoteLock()


Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        // Do it again; should fail as another thread from caller already
        // acquired the lock
//        resetToStrict(handler); // fail if we call the local handler
//        replay(handler);

        rsp = target.remoteLock("test", caller, 1000);

        assertEquals(RemoteLockResponse.Flag.REJECT, rsp.flag);
        assertEquals(caller, rsp.holder);

        verifyZeroInteractions(handler);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        assertFalse(node1.equals(caller1));

        ClusterNode caller2 = testee.getCurrentView().get(2);
        assertFalse(node1.equals(caller2));

        RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);

        assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
        assertNull(rsp.holder);

        verify(handler).lockFromCluster("test", caller1, 1000);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        // A call from a different caller should be rejected without need
        // to go to the LocalLockHandler
//        resetToStrict(handler);
//        replay(handler);

        rsp = target.remoteLock("test", caller2, 1000);

        assertEquals(RemoteLockResponse.Flag.REJECT, rsp.flag);
        assertEquals(caller1, rsp.holder);

        verifyNoMoreInteractions(handler);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        // We throw TimeoutException to indicate "node1" holds the lock
        // A second attempt should succeed if the local lock is released
        // We return normally to indicate success
        doThrow(new TimeoutException(node1)).doNothing().when(handler).lockFromCluster("test", caller1, 1000);

        RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);

        assertEquals(RemoteLockResponse.Flag.FAIL, rsp.flag);
        assertEquals(node1, rsp.holder);

        rsp = target.remoteLock("test", caller1, 1000);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);

        assertEquals(RemoteLockResponse.Flag.FAIL, rsp.flag);
        assertEquals(node1, rsp.holder);

        rsp = target.remoteLock("test", caller1, 1000);
       
        assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
        assertNull(rsp.holder);
    }
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        assertFalse(node1.equals(caller1));

        ClusterNode caller2 = members.get(2);
        assertFalse(node1.equals(caller2));

        RemoteLockResponse rsp = target.remoteLock("test", caller1, 1000);

        verify(handler).lockFromCluster("test", caller1, 1000);

        assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
        assertNull(rsp.holder);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        testee.membershipChanged(dead, new Vector<ClusterNode>(), all);

        verify(handler).unlockFromCluster("test", caller1);
       
        // A call from a different caller should work
        rsp = target.remoteLock("test", caller2, 1000);

        verify(handler).lockFromCluster("test", caller2, 1000);

        assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
        assertNull(rsp.holder);
View Full Code Here

Examples of org.jboss.as.clustering.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

        ClusterNode caller1 = testee.getCurrentView().get(0);
        ClusterNode caller2 = testee.getCurrentView().get(2);

        when(handler.getLockHolder("test")).thenReturn(caller1);

        RemoteLockResponse rsp = target.remoteLock("test", caller1, 1);
       
        verify(handler).lockFromCluster(eq("test"), eq(caller1), anyLong());

        assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

     
      resetToStrict(handler);     
      handler.lockFromCluster("test", caller, 1000);
      replay(handler);
     
      RemoteLockResponse rsp = target.remoteLock("test", caller, 1000);
     
      assertEquals(RemoteLockResponse.Flag.OK, rsp.flag);
      assertNull(rsp.holder);
     
      verify(handler);
View Full Code Here

Examples of org.jboss.ha.framework.server.lock.AbstractClusterLockSupport.RpcTarget.remoteLock()

      // Do it again; should fail as another thread from caller already
      // acquired the lock
      resetToStrict(handler); // fail if we call the local handler
      replay(handler);
     
      rsp = target.remoteLock("test", caller, 1000);
     
      assertEquals(RemoteLockResponse.Flag.REJECT, rsp.flag);
      assertEquals(caller, rsp.holder);
     
      verify(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.