Search in sources :

Example 1 with CallsPerMember

use of com.hazelcast.spi.CallsPerMember in project hazelcast by hazelcast.

the class OperationParkerImpl_populateTest method populateRemoteCall.

@Test
public void populateRemoteCall() {
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    HazelcastInstance local = factory.newHazelcastInstance();
    HazelcastInstance remote = factory.newHazelcastInstance();
    NodeEngineImpl nodeEngine = getNode(local).nodeEngine;
    OperationParkerImpl operationParker = (OperationParkerImpl) nodeEngine.getOperationParker();
    Address thisAddress = getNode(local).nodeEngine.getThisAddress();
    Address thatAddress = getNode(remote).nodeEngine.getThisAddress();
    DummyBlockingOperation blockingOperation = new DummyBlockingOperation(new WaitNotifyKeyImpl());
    setCallerAddress(blockingOperation, thatAddress);
    setCallId(blockingOperation, 100);
    operationParker.park(blockingOperation);
    CallsPerMember callsPerMember = new CallsPerMember(thisAddress);
    operationParker.populate(callsPerMember);
    assertEquals(singleton(thatAddress), callsPerMember.addresses());
    assertArrayEquals(new long[] { 100 }, callsPerMember.toOpControl(thatAddress).runningOperations());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CallsPerMember(com.hazelcast.spi.CallsPerMember) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) OperationAccessor.setCallerAddress(com.hazelcast.spi.OperationAccessor.setCallerAddress) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with CallsPerMember

use of com.hazelcast.spi.CallsPerMember in project hazelcast by hazelcast.

the class OperationParkerImpl_populateTest method populateLocalCall.

@Test
public void populateLocalCall() {
    HazelcastInstance hz = createHazelcastInstance();
    NodeEngineImpl nodeEngine = getNode(hz).nodeEngine;
    OperationParkerImpl operationParker = (OperationParkerImpl) nodeEngine.getOperationParker();
    Address thisAddress = nodeEngine.getThisAddress();
    DummyBlockingOperation blockingOperation = new DummyBlockingOperation(new WaitNotifyKeyImpl());
    setCallId(blockingOperation, 100);
    operationParker.park(blockingOperation);
    CallsPerMember callsPerMember = new CallsPerMember(thisAddress);
    operationParker.populate(callsPerMember);
    assertEquals(singleton(thisAddress), callsPerMember.addresses());
    assertArrayEquals(new long[] { 100 }, callsPerMember.toOpControl(thisAddress).runningOperations());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) CallsPerMember(com.hazelcast.spi.CallsPerMember) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) OperationAccessor.setCallerAddress(com.hazelcast.spi.OperationAccessor.setCallerAddress) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 Address (com.hazelcast.nio.Address)2 CallsPerMember (com.hazelcast.spi.CallsPerMember)2 OperationAccessor.setCallerAddress (com.hazelcast.spi.OperationAccessor.setCallerAddress)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 ParallelTest (com.hazelcast.test.annotation.ParallelTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1