use of com.hazelcast.spi.impl.operationservice.InvocationBuilder in project hazelcast by hazelcast.
the class MasterSplitTest method test_migrationFailsOnMasterMismatch_onSource.
@Test
public void test_migrationFailsOnMasterMismatch_onSource() throws InterruptedException {
HazelcastInstance member1 = factory.newHazelcastInstance();
HazelcastInstance member2 = factory.newHazelcastInstance();
warmUpPartitions(member1, member2);
MigrationInfo migration = createMigrationInfo(member1, member2);
Operation op = new MigrationRequestOperation(migration, Collections.emptyList(), 0, true, chunkedMigrationEnabled, Integer.MAX_VALUE);
InvocationBuilder invocationBuilder = getOperationService(member1).createInvocationBuilder(SERVICE_NAME, op, getAddress(member2)).setCallTimeout(TimeUnit.MINUTES.toMillis(1));
Future future = invocationBuilder.invoke();
try {
future.get();
fail();
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof IllegalStateException);
}
}
use of com.hazelcast.spi.impl.operationservice.InvocationBuilder in project hazelcast by hazelcast.
the class MapPublisherCreateMessageTask method createInvocations.
private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
final OperationServiceImpl operationService = nodeEngine.getOperationService();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.toAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, false, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
}
use of com.hazelcast.spi.impl.operationservice.InvocationBuilder in project hazelcast by hazelcast.
the class CancellableDelegatingFuture method invokeCancelOperation.
private Future<Boolean> invokeCancelOperation(boolean mayInterruptIfRunning) {
CancellationOperation op = new CancellationOperation(uuid, mayInterruptIfRunning);
OperationService opService = nodeEngine.getOperationService();
InvocationBuilder builder;
if (partitionId > -1) {
builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, partitionId);
} else {
builder = opService.createInvocationBuilder(DistributedExecutorService.SERVICE_NAME, op, target);
}
builder.setTryCount(CANCEL_TRY_COUNT).setTryPauseMillis(CANCEL_TRY_PAUSE_MILLIS);
return builder.invoke();
}
use of com.hazelcast.spi.impl.operationservice.InvocationBuilder in project hazelcast by hazelcast.
the class MasterSplitTest method test_migrationFailsOnMasterMismatch_onDestination.
@Test
public void test_migrationFailsOnMasterMismatch_onDestination() throws InterruptedException {
HazelcastInstance member1 = factory.newHazelcastInstance();
HazelcastInstance member2 = factory.newHazelcastInstance();
warmUpPartitions(member1, member2);
MigrationInfo migration = createMigrationInfo(member1, member2);
ReplicaFragmentMigrationState migrationState = new ReplicaFragmentMigrationState(Collections.emptyMap(), Collections.emptySet(), Collections.emptySet(), chunkedMigrationEnabled, (int) MemoryUnit.MEGABYTES.toBytes(50), Logger.getLogger(getClass()), 1);
Operation op = new MigrationOperation(migration, Collections.emptyList(), 0, migrationState, true, true);
InvocationBuilder invocationBuilder = getOperationService(member1).createInvocationBuilder(SERVICE_NAME, op, getAddress(member2)).setCallTimeout(TimeUnit.MINUTES.toMillis(1));
Future future = invocationBuilder.invoke();
try {
future.get();
fail();
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof IllegalStateException);
}
}
use of com.hazelcast.spi.impl.operationservice.InvocationBuilder in project hazelcast by hazelcast.
the class OperationServiceImpl_BasicTest method testPropagateSerializationErrorOnResponseToCallerGithubIssue2559.
@Test(expected = ExecutionException.class)
public void testPropagateSerializationErrorOnResponseToCallerGithubIssue2559() throws Exception {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance hz1 = factory.newHazelcastInstance();
HazelcastInstance hz2 = factory.newHazelcastInstance();
Field original = HazelcastInstanceProxy.class.getDeclaredField("original");
original.setAccessible(true);
HazelcastInstanceImpl impl = (HazelcastInstanceImpl) original.get(hz1);
OperationService operationService = impl.node.nodeEngine.getOperationService();
Address address = hz2.getCluster().getLocalMember().getAddress();
Operation operation = new GithubIssue2559Operation();
String serviceName = DistributedExecutorService.SERVICE_NAME;
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(serviceName, operation, address);
invocationBuilder.invoke().get();
}
Aggregations