Search in sources :

Example 6 with TargetNotMemberException

use of com.hazelcast.spi.exception.TargetNotMemberException in project hazelcast by hazelcast.

the class MigrationManager method logMigrationCommitFailure.

private void logMigrationCommitFailure(MigrationInfo migration, Throwable t) {
    boolean memberLeft = t instanceof MemberLeftException || t.getCause() instanceof TargetNotMemberException || t.getCause() instanceof HazelcastInstanceNotActiveException;
    PartitionReplica destination = migration.getDestination();
    if (memberLeft) {
        if (destination.isIdentical(node.getLocalMember())) {
            logger.fine("Migration commit failed for " + migration + " since this node is shutting down.");
            return;
        }
        logger.warning("Migration commit failed for " + migration + " since destination " + destination + " left the cluster");
    } else {
        logger.severe("Migration commit to " + destination + " failed for " + migration, t);
    }
}
Also used : HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) PartitionReplica(com.hazelcast.internal.partition.PartitionReplica) MemberLeftException(com.hazelcast.core.MemberLeftException)

Example 7 with TargetNotMemberException

use of com.hazelcast.spi.exception.TargetNotMemberException in project hazelcast by hazelcast.

the class FrozenPartitionTableTest method partitionTable_shouldBeFixed_whenMemberRestarts_usingUuidOfAnotherMissingMember.

@Test
public void partitionTable_shouldBeFixed_whenMemberRestarts_usingUuidOfAnotherMissingMember() {
    ruleStaleJoinPreventionDuration.setOrClearProperty("5");
    TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
    HazelcastInstance hz1 = factory.newHazelcastInstance();
    HazelcastInstance hz2 = factory.newHazelcastInstance();
    HazelcastInstance hz3 = factory.newHazelcastInstance();
    HazelcastInstance hz4 = factory.newHazelcastInstance();
    assertClusterSizeEventually(4, hz2, hz3);
    warmUpPartitions(hz1, hz2, hz3, hz4);
    changeClusterStateEventually(hz4, ClusterState.FROZEN);
    int member3PartitionId = getPartitionId(hz3);
    int member4PartitionId = getPartitionId(hz4);
    MemberImpl member3 = getNode(hz3).getLocalMember();
    MemberImpl member4 = getNode(hz4).getLocalMember();
    hz3.shutdown();
    hz4.shutdown();
    assertClusterSizeEventually(2, hz1, hz2);
    newHazelcastInstance(initOrCreateConfig(new Config()), randomName(), new StaticMemberNodeContext(factory, member4.getUuid(), member3.getAddress()));
    assertClusterSizeEventually(3, hz1, hz2);
    waitAllForSafeState(hz1, hz2);
    OperationServiceImpl operationService = getOperationService(hz1);
    operationService.invokeOnPartition(null, new NonRetryablePartitionOperation(), member3PartitionId).join();
    try {
        operationService.invokeOnPartition(null, new NonRetryablePartitionOperation(), member4PartitionId).joinInternal();
        fail("Invocation to missing member should have failed!");
    } catch (TargetNotMemberException ignored) {
    }
}
Also used : TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) HazelcastInstance(com.hazelcast.core.HazelcastInstance) HazelcastInstanceFactory.newHazelcastInstance(com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance) StaticMemberNodeContext(com.hazelcast.instance.StaticMemberNodeContext) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) Config(com.hazelcast.config.Config) TestHazelcastInstanceFactory.initOrCreateConfig(com.hazelcast.test.TestHazelcastInstanceFactory.initOrCreateConfig) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with TargetNotMemberException

use of com.hazelcast.spi.exception.TargetNotMemberException in project hazelcast by hazelcast.

the class ChainingFutureTest method testTopologyChangesExceptionsAreIgnored.

@Test
public void testTopologyChangesExceptionsAreIgnored() {
    InternalCompletableFuture<Object> future1 = newFuture();
    InternalCompletableFuture<Object> future2 = newFuture();
    InternalCompletableFuture<Object> future3 = newFuture();
    CountingIterator<InternalCompletableFuture<Object>> iterator = toIterator(future1, future2, future3);
    ChainingFuture.ExceptionHandler handler = repairingIterator;
    ChainingFuture<Object> future = new ChainingFuture<>(iterator, handler);
    assertEquals(1, iterator.getHasNextCounter());
    assertEquals(1, iterator.getNextCounter());
    assertFalse(future.isDone());
    future1.complete(new MemberLeftException("this should be ignored"));
    assertEquals(2, iterator.getHasNextCounter());
    assertEquals(2, iterator.getNextCounter());
    assertFalse(future.isDone());
    future2.complete(new TargetNotMemberException("this should be ignored"));
    assertEquals(3, iterator.getHasNextCounter());
    assertEquals(3, iterator.getNextCounter());
    assertFalse(future.isDone());
    future3.complete("foo");
    assertTrue(future.isDone());
    assertEquals(4, iterator.getHasNextCounter());
    assertEquals(3, iterator.getNextCounter());
}
Also used : TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) InternalCompletableFuture(com.hazelcast.spi.impl.InternalCompletableFuture) MemberLeftException(com.hazelcast.core.MemberLeftException) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with TargetNotMemberException

use of com.hazelcast.spi.exception.TargetNotMemberException in project hazelcast by hazelcast.

the class ClientSmartInvocationServiceImpl method invokeOnTarget.

@Override
public void invokeOnTarget(ClientInvocation invocation, Address target) throws IOException {
    if (target == null) {
        throw new NullPointerException("Target can not be null");
    }
    if (!isMember(target)) {
        throw new TargetNotMemberException("Target :  " + target + " is not member. ");
    }
    final Connection connection = getOrTriggerConnect(target);
    invokeOnConnection(invocation, (ClientConnection) connection);
}
Also used : TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) ClientConnection(com.hazelcast.client.connection.nio.ClientConnection) Connection(com.hazelcast.nio.Connection)

Example 10 with TargetNotMemberException

use of com.hazelcast.spi.exception.TargetNotMemberException in project hazelcast by hazelcast.

the class AbstractTargetMessageTask method processInternal.

@Override
protected CompletableFuture<Object> processInternal() {
    Operation op = prepareOperation();
    op.setCallerUuid(endpoint.getUuid());
    MemberImpl member = nodeEngine.getClusterService().getMember(getTargetUuid());
    if (member == null) {
        throw new TargetNotMemberException(String.format("Member with uuid(%s) is not in member list ", getTargetUuid()));
    }
    return nodeEngine.getOperationService().createInvocationBuilder(getServiceName(), op, member.getAddress()).setResultDeserialized(false).invoke();
}
Also used : TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) Operation(com.hazelcast.spi.impl.operationservice.Operation)

Aggregations

TargetNotMemberException (com.hazelcast.spi.exception.TargetNotMemberException)14 MemberLeftException (com.hazelcast.core.MemberLeftException)8 Member (com.hazelcast.cluster.Member)5 Address (com.hazelcast.cluster.Address)4 MemberImpl (com.hazelcast.cluster.impl.MemberImpl)3 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 PartitionReplica (com.hazelcast.internal.partition.PartitionReplica)2 Transaction (com.hazelcast.transaction.impl.Transaction)2 TransactionManagerServiceImpl (com.hazelcast.transaction.impl.TransactionManagerServiceImpl)2 HashMap (java.util.HashMap)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ClientConnection (com.hazelcast.client.connection.nio.ClientConnection)1 ClusterState (com.hazelcast.cluster.ClusterState)1 Config (com.hazelcast.config.Config)1 StaticMemberNodeContext (com.hazelcast.instance.StaticMemberNodeContext)1