Search in sources :

Example 46 with IgniteException

use of org.apache.ignite.IgniteException in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartThreeNodes.

/**
 * @throws Exception If failed.
 */
public void testStartThreeNodes() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, DFLT_TIMEOUT, 1);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert joinedCnt.get() == 3;
    assert leftCnt.get() == 0;
    assert ignite.cluster().nodes().size() == 3;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 47 with IgniteException

use of org.apache.ignite.IgniteException in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodeById.

/**
 * @throws Exception If failed.
 */
public void testStopNodeById() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    leftLatch = new CountDownLatch(1);
    ignite.cluster().stopNodes(Collections.singleton(F.first(ignite.cluster().forRemotes().nodes()).id()));
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 2;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 48 with IgniteException

use of org.apache.ignite.IgniteException in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStopNodesByIds.

/**
 * @throws Exception If failed.
 */
public void testStopNodesByIds() throws Exception {
    joinedLatch = new CountDownLatch(3);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 3;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 3;
    leftLatch = new CountDownLatch(2);
    Iterator<ClusterNode> it = ignite.cluster().nodes().iterator();
    Collection<UUID> ids = new HashSet<>();
    ids.add(it.next().id());
    ids.add(it.next().id());
    ignite.cluster().stopNodes(ids);
    assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert ignite.cluster().nodes().size() == 1;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult) UUID(java.util.UUID) HashSet(java.util.HashSet)

Example 49 with IgniteException

use of org.apache.ignite.IgniteException in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartOneNode.

/**
 * @throws Exception If failed.
 */
public void testStartOneNode() throws Exception {
    joinedLatch = new CountDownLatch(1);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16);
    assert res.size() == 1;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert joinedCnt.get() == 1;
    assert leftCnt.get() == 0;
    assert ignite.cluster().nodes().size() == 1;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Example 50 with IgniteException

use of org.apache.ignite.IgniteException in project ignite by apache.

the class IgniteProjectionStartStopRestartSelfTest method testStartFiveWithTwoSpecs.

/**
 * @throws Exception If failed.
 */
public void testStartFiveWithTwoSpecs() throws Exception {
    joinedLatch = new CountDownLatch(5);
    Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), F.asList(map(HOST, SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_NO_ATTR, null), map(HOST, SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null)), null, false, 0, 16);
    assert res.size() == 5;
    F.forEach(res, new CI1<ClusterStartNodeResult>() {

        @Override
        public void apply(ClusterStartNodeResult t) {
            assert t.getHostName().equals(HOST);
            if (!t.isSuccess())
                throw new IgniteException(t.getError());
        }
    });
    assert joinedLatch.await(WAIT_TIMEOUT, MILLISECONDS);
    assert joinedCnt.get() == 5;
    assert leftCnt.get() == 0;
    assert ignite.cluster().nodes().size() == 5;
}
Also used : IgniteException(org.apache.ignite.IgniteException) CountDownLatch(java.util.concurrent.CountDownLatch) ClusterStartNodeResult(org.apache.ignite.cluster.ClusterStartNodeResult)

Aggregations

IgniteException (org.apache.ignite.IgniteException)498 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)160 Ignite (org.apache.ignite.Ignite)97 ClusterNode (org.apache.ignite.cluster.ClusterNode)54 ArrayList (java.util.ArrayList)52 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)45 CountDownLatch (java.util.concurrent.CountDownLatch)44 UUID (java.util.UUID)43 IOException (java.io.IOException)39 CacheException (javax.cache.CacheException)35 HashMap (java.util.HashMap)34 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)34 Transaction (org.apache.ignite.transactions.Transaction)34 List (java.util.List)24 CyclicBarrier (java.util.concurrent.CyclicBarrier)21 Map (java.util.Map)20 Collection (java.util.Collection)18 ClusterStartNodeResult (org.apache.ignite.cluster.ClusterStartNodeResult)18 ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)18 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)17