Search in sources :

Example 41 with Member

use of com.hazelcast.core.Member in project hazelcast by hazelcast.

the class ClientExecutorServiceProxy method submitToMembers.

@Override
public void submitToMembers(Runnable command, Collection<Member> members, MultiExecutionCallback callback) {
    Callable<?> callable = createRunnableAdapter(command);
    MultiExecutionCallbackWrapper multiExecutionCallbackWrapper = new MultiExecutionCallbackWrapper(members.size(), callback);
    for (Member member : members) {
        final ExecutionCallbackWrapper executionCallback = new ExecutionCallbackWrapper(multiExecutionCallbackWrapper, member);
        submitToMember(callable, member, executionCallback);
    }
}
Also used : Member(com.hazelcast.core.Member)

Example 42 with Member

use of com.hazelcast.core.Member in project hazelcast by hazelcast.

the class ClientExecutorServiceProxy method submitToAllMembers.

@Override
public <T> void submitToAllMembers(Callable<T> task, MultiExecutionCallback callback) {
    final Collection<Member> memberList = getContext().getClusterService().getMemberList();
    MultiExecutionCallbackWrapper multiExecutionCallbackWrapper = new MultiExecutionCallbackWrapper(memberList.size(), callback);
    for (Member member : memberList) {
        final ExecutionCallbackWrapper<T> executionCallback = new ExecutionCallbackWrapper<T>(multiExecutionCallbackWrapper, member);
        submitToMember(task, member, executionCallback);
    }
}
Also used : Member(com.hazelcast.core.Member)

Example 43 with Member

use of com.hazelcast.core.Member in project hazelcast by hazelcast.

the class QueryDispatcher method dispatchFullQueryOnAllMembersOnQueryThread.

private List<Future<Result>> dispatchFullQueryOnAllMembersOnQueryThread(Query query) {
    Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
    List<Future<Result>> futures = new ArrayList<Future<Result>>(members.size());
    for (Member member : members) {
        Operation operation = new QueryOperation(query);
        Future<Result> future = operationService.invokeOnTarget(MapService.SERVICE_NAME, operation, member.getAddress());
        futures.add(future);
    }
    return futures;
}
Also used : ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) Operation(com.hazelcast.spi.Operation) Member(com.hazelcast.core.Member)

Example 44 with Member

use of com.hazelcast.core.Member in project hazelcast by hazelcast.

the class NodeQueryCacheEndToEndConstructor method createPublishersAndGetQueryResults.

private Collection<QueryResult> createPublishersAndGetQueryResults(AccumulatorInfo info) {
    InvokerWrapper invokerWrapper = context.getInvokerWrapper();
    Collection<Member> members = context.getMemberList();
    List<Future<QueryResult>> futures = new ArrayList<Future<QueryResult>>(members.size());
    for (Member member : members) {
        Address address = member.getAddress();
        Future future = invokerWrapper.invokeOnTarget(new PublisherCreateOperation(info), address);
        futures.add(future);
    }
    return returnWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
Also used : QueryResult(com.hazelcast.map.impl.query.QueryResult) Address(com.hazelcast.nio.Address) InvokerWrapper(com.hazelcast.map.impl.querycache.InvokerWrapper) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) Member(com.hazelcast.core.Member) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation)

Example 45 with Member

use of com.hazelcast.core.Member in project hazelcast by hazelcast.

the class NodeQueryCacheEndToEndConstructor method madePublishable.

private void madePublishable(String mapName, String cacheName) throws Exception {
    InvokerWrapper invokerWrapper = context.getInvokerWrapper();
    Collection<Member> memberList = context.getMemberList();
    List<Future> futures = new ArrayList<Future>(memberList.size());
    for (Member member : memberList) {
        Operation operation = new MadePublishableOperation(mapName, cacheName);
        Future future = invokerWrapper.invokeOnTarget(operation, member.getAddress());
        futures.add(future);
    }
    waitWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
Also used : MadePublishableOperation(com.hazelcast.map.impl.querycache.subscriber.operation.MadePublishableOperation) InvokerWrapper(com.hazelcast.map.impl.querycache.InvokerWrapper) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation) Operation(com.hazelcast.spi.Operation) MadePublishableOperation(com.hazelcast.map.impl.querycache.subscriber.operation.MadePublishableOperation) Member(com.hazelcast.core.Member)

Aggregations

Member (com.hazelcast.core.Member)330 Test (org.junit.Test)134 QuickTest (com.hazelcast.test.annotation.QuickTest)124 ParallelTest (com.hazelcast.test.annotation.ParallelTest)113 HazelcastInstance (com.hazelcast.core.HazelcastInstance)99 Address (com.hazelcast.nio.Address)60 IExecutorService (com.hazelcast.core.IExecutorService)57 Future (java.util.concurrent.Future)47 ArrayList (java.util.ArrayList)45 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)41 CountDownLatch (java.util.concurrent.CountDownLatch)37 Config (com.hazelcast.config.Config)35 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)26 HashMap (java.util.HashMap)26 IMap (com.hazelcast.core.IMap)24 HashSet (java.util.HashSet)21 LinkedList (java.util.LinkedList)20 OperationService (com.hazelcast.spi.OperationService)19 AssertTask (com.hazelcast.test.AssertTask)19 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)18