Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5F44B1817F for ; Mon, 22 Jun 2015 13:02:44 +0000 (UTC) Received: (qmail 66045 invoked by uid 500); 22 Jun 2015 13:02:44 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 66010 invoked by uid 500); 22 Jun 2015 13:02:44 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 65999 invoked by uid 99); 22 Jun 2015 13:02:44 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2015 13:02:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C2E7ACF73D for ; Mon, 22 Jun 2015 13:02:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.372 X-Spam-Level: X-Spam-Status: No, score=0.372 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.429, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ar3QEp7E8Nne for ; Mon, 22 Jun 2015 13:02:29 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 39C952D7CC for ; Mon, 22 Jun 2015 13:02:22 +0000 (UTC) Received: (qmail 63421 invoked by uid 99); 22 Jun 2015 13:02:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jun 2015 13:02:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A27F9E03D2; Mon, 22 Jun 2015 13:02:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Mon, 22 Jun 2015 13:02:43 -0000 Message-Id: In-Reply-To: <3dd10a50246e47a69deabd5c2bda87e9@git.apache.org> References: <3dd10a50246e47a69deabd5c2bda87e9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [26/27] incubator-ignite git commit: #IGNITE Added message on init stop. #IGNITE Added message on init stop. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/16059962 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/16059962 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/16059962 Branch: refs/heads/ignite-sprint-7 Commit: 16059962e303f7580c6524b1e0f93c2dcce9eaa4 Parents: de0930d Author: nikolay_tikhonov Authored: Mon Jun 22 15:30:48 2015 +0300 Committer: nikolay_tikhonov Committed: Mon Jun 22 15:30:48 2015 +0300 ---------------------------------------------------------------------- .../ignite/internal/MarshallerContextImpl.java | 12 +- .../cache/GridCacheDaemonNodeStopSelfTest.java | 119 +++++++++++++++++++ .../testsuites/IgniteCacheTestSuite3.java | 1 + 3 files changed, 130 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java index 48f24ac..9f7c983 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java @@ -124,10 +124,18 @@ public class MarshallerContextImpl extends MarshallerContextAdapter { /** {@inheritDoc} */ @Override protected String className(int id) throws IgniteCheckedException { - if (cache == null) + GridCacheAdapter cache0 = cache; + + if (cache0 == null) { U.awaitQuiet(latch); - String clsName = cache.get(id); + cache0 = cache; + + if (cache0 == null) + throw new IllegalStateException("Failed to initialize marshaller context (grid is stopping)."); + } + + String clsName = cache0.get(id); if (clsName == null) { File file = new File(workDir, id + ".classname"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java new file mode 100644 index 0000000..c56ad1c --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeStopSelfTest.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache; + +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.spi.discovery.tcp.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.*; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.common.*; + +import java.util.concurrent.*; + +import static org.apache.ignite.cache.CacheAtomicityMode.*; +import static org.apache.ignite.cache.CacheMode.*; + +/** + * Test cache operations with daemon node. + */ +public class GridCacheDaemonNodeStopSelfTest extends GridCommonAbstractTest { + /** */ + private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true); + + /** Daemon flag. */ + protected boolean daemon; + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + super.beforeTest(); + + daemon = false; + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration c = super.getConfiguration(gridName); + + c.setDaemon(daemon); + + TcpDiscoverySpi disco = new TcpDiscoverySpi(); + + disco.setIpFinder(ipFinder); + + c.setDiscoverySpi(disco); + + c.setConnectorConfiguration(null); + + CacheConfiguration cc = defaultCacheConfiguration(); + + cc.setCacheMode(LOCAL); + cc.setAtomicityMode(ATOMIC); + + TransactionConfiguration cfg = new TransactionConfiguration(); + + c.setTransactionConfiguration(cfg); + + c.setCacheConfiguration(cc); + + return c; + } + + /** + * @throws Exception If failed. + */ + public void testStartStop() throws Exception { + try { + daemon = true; + + final IgniteEx daemonNode = startGrid(0); + + final IgniteInternalFuture f = GridTestUtils.runAsync(new Callable() { + @Override public Object call() throws Exception { + daemonNode.context().marshallerContext().getClass(1, + GridCacheDaemonNodeStopSelfTest.class.getClassLoader()); + + return null; + } + }); + + GridTestUtils.assertThrowsWithCause(new Callable() { + @Override public Object call() throws Exception { + f.get(300); + + return null; + } + }, IgniteFutureTimeoutCheckedException.class); + + // Stop grid. + stopGrid(0); + + GridTestUtils.assertThrowsWithCause(new Callable() { + @Override public Object call() throws Exception { + f.get(5, TimeUnit.SECONDS); + + return null; + } + }, IllegalStateException.class); + } + finally { + stopAllGrids(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/16059962/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java index 5947d33..b83f50f 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java @@ -100,6 +100,7 @@ public class IgniteCacheTestSuite3 extends TestSuite { suite.addTestSuite(GridCacheDaemonNodeLocalSelfTest.class); suite.addTestSuite(GridCacheDaemonNodePartitionedSelfTest.class); suite.addTestSuite(GridCacheDaemonNodeReplicatedSelfTest.class); + suite.addTestSuite(GridCacheDaemonNodeStopSelfTest.class); // Write-behind. suite.addTest(IgniteCacheWriteBehindTestSuite.suite());