diff --git a/modules/core/src/main/java/org/apache/ignite/dataload/IgniteDataLoadCacheUpdater.java b/modules/core/src/main/java/org/apache/ignite/dataload/IgniteDataLoadCacheUpdater.java index 468c066ccb6f4..ac6148f52b4b2 100644 --- a/modules/core/src/main/java/org/apache/ignite/dataload/IgniteDataLoadCacheUpdater.java +++ b/modules/core/src/main/java/org/apache/ignite/dataload/IgniteDataLoadCacheUpdater.java @@ -36,7 +36,7 @@ public interface IgniteDataLoadCacheUpdater extends Serializable { * * @param cache Cache. * @param entries Collection of entries. - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - public void update(IgniteCache cache, Collection> entries) throws IgniteCheckedException; + public void update(IgniteCache cache, Collection> entries) throws IgniteException; } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index 3d52051ce9d76..827f2c959eaca 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -519,10 +519,17 @@ private void add(Map attrs, String name, @Nullable Serializable */ @SuppressWarnings({"CatchGenericClass"}) private void notifyLifecycleBeans(LifecycleEventType evt) throws IgniteCheckedException { - if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null) + if (!cfg.isDaemon() && cfg.getLifecycleBeans() != null) { for (LifecycleBean bean : cfg.getLifecycleBeans()) - if (bean != null) - bean.onLifecycleEvent(evt); + if (bean != null) { + try { + bean.onLifecycleEvent(evt); + } + catch (Exception e) { + throw new IgniteCheckedException(e); + } + } + } } /** @@ -986,7 +993,7 @@ else if (X.hasCause(e, InterruptedException.class, IgniteInterruptedCheckedExcep nodes = nodes0.size(); cpus = metrics.getTotalCpus(); } - catch (IgniteCheckedException ignore) { + catch (IgniteException ignore) { // No-op. } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java index 3599fcbf0aebe..79432945b9808 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java @@ -1066,7 +1066,7 @@ public IgniteCache flagOn(CacheFlag flag) { * @return Cache exception. */ private CacheException cacheException(IgniteCheckedException e) { - return U.convertCacheException(e); + return U.convertToCacheException(e); } /** diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadCacheUpdaters.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadCacheUpdaters.java index 34f0b88b00d23..392658fbe00e7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadCacheUpdaters.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadCacheUpdaters.java @@ -98,10 +98,10 @@ public static IgniteDataLoadCacheUpdater groupLocked() { * @param cache Cache. * @param rmvCol Keys to remove. * @param putMap Entries to put. - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ protected static void updateAll(IgniteCache cache, @Nullable Collection rmvCol, - Map putMap) throws IgniteCheckedException { + Map putMap) { assert rmvCol != null || putMap != null; // Here we assume that there are no key duplicates, so the following calls are valid. @@ -120,8 +120,7 @@ private static class Individual implements IgniteDataLoadCacheUpdater cache, Collection> entries) - throws IgniteCheckedException { + @Override public void update(IgniteCache cache, Collection> entries) { assert cache != null; assert !F.isEmpty(entries); @@ -148,8 +147,7 @@ private static class Batched implements IgniteDataLoadCacheUpdater { private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override public void update(IgniteCache cache, Collection> entries) - throws IgniteCheckedException { + @Override public void update(IgniteCache cache, Collection> entries) { assert cache != null; assert !F.isEmpty(entries); @@ -189,8 +187,7 @@ private static class BatchedSorted implements IgniteDataLoadCacheUpdater cache, Collection> entries) - throws IgniteCheckedException { + @Override public void update(IgniteCache cache, Collection> entries) { assert cache != null; assert !F.isEmpty(entries); @@ -230,8 +227,7 @@ private static class GroupLocked implements IgniteDataLoadCacheUpdater cache, Collection> entries) - throws IgniteCheckedException { + @Override public void update(IgniteCache cache, Collection> entries) { assert cache != null; assert !F.isEmpty(entries); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/GridDrDataLoadCacheUpdater.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/GridDrDataLoadCacheUpdater.java index 6e7e3855fae70..4ef5e33f8d165 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/GridDrDataLoadCacheUpdater.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dr/GridDrDataLoadCacheUpdater.java @@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.processors.cache.dr.*; import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; import java.util.*; @@ -36,42 +37,46 @@ public class GridDrDataLoadCacheUpdater implements IgniteDataLoadCacheUpda private static final long serialVersionUID = 0L; /** {@inheritDoc} */ - @Override public void update(IgniteCache cache0, Collection> col) - throws IgniteCheckedException { - String cacheName = cache0.getConfiguration(CacheConfiguration.class).getName(); + @Override public void update(IgniteCache cache0, Collection> col) { + try { + String cacheName = cache0.getConfiguration(CacheConfiguration.class).getName(); - GridKernalContext ctx = ((IgniteKernal)cache0.unwrap(Ignite.class)).context(); - IgniteLogger log = ctx.log(GridDrDataLoadCacheUpdater.class); - GridCacheAdapter cache = ctx.cache().internalCache(cacheName); + GridKernalContext ctx = ((IgniteKernal)cache0.unwrap(Ignite.class)).context(); + IgniteLogger log = ctx.log(GridDrDataLoadCacheUpdater.class); + GridCacheAdapter cache = ctx.cache().internalCache(cacheName); - assert !F.isEmpty(col); + assert !F.isEmpty(col); - if (log.isDebugEnabled()) - log.debug("Running DR put job [nodeId=" + ctx.localNodeId() + ", cacheName=" + cacheName + ']'); + if (log.isDebugEnabled()) + log.debug("Running DR put job [nodeId=" + ctx.localNodeId() + ", cacheName=" + cacheName + ']'); - IgniteInternalFuture f = cache.context().preloader().startFuture(); + IgniteInternalFuture f = cache.context().preloader().startFuture(); - if (!f.isDone()) - f.get(); + if (!f.isDone()) + f.get(); - for (Map.Entry entry0 : col) { - GridCacheRawVersionedEntry entry = (GridCacheRawVersionedEntry)entry0; + for (Map.Entry entry0 : col) { + GridCacheRawVersionedEntry entry = (GridCacheRawVersionedEntry)entry0; - entry.unmarshal(ctx.config().getMarshaller()); + entry.unmarshal(ctx.config().getMarshaller()); - K key = entry.key(); + K key = entry.key(); - GridCacheDrInfo val = entry.value() != null ? entry.expireTime() != 0 ? - new GridCacheDrExpirationInfo<>(entry.value(), entry.version(), entry.ttl(), entry.expireTime()) : - new GridCacheDrInfo<>(entry.value(), entry.version()) : null; + GridCacheDrInfo val = entry.value() != null ? entry.expireTime() != 0 ? + new GridCacheDrExpirationInfo<>(entry.value(), entry.version(), entry.ttl(), entry.expireTime()) : + new GridCacheDrInfo<>(entry.value(), entry.version()) : null; - if (val == null) - cache.removeAllDr(Collections.singletonMap(key, entry.version())); - else - cache.putAllDr(Collections.singletonMap(key, val)); - } + if (val == null) + cache.removeAllDr(Collections.singletonMap(key, entry.version())); + else + cache.putAllDr(Collections.singletonMap(key, val)); + } - if (log.isDebugEnabled()) - log.debug("DR put job finished [nodeId=" + ctx.localNodeId() + ", cacheName=" + cacheName + ']'); + if (log.isDebugEnabled()) + log.debug("DR put job finished [nodeId=" + ctx.localNodeId() + ", cacheName=" + cacheName + ']'); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java index 3bfdf8945fb35..632364db83a02 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java @@ -815,7 +815,7 @@ boolean onMasterNodeLeft() { log.debug("Successfully executed GridComputeJobMasterLeaveAware.onMasterNodeLeft() callback " + "[nodeId=" + taskNode.id() + ", jobId=" + ses.getJobId() + ", job=" + job + ']'); } - catch (IgniteException e) { + catch (Exception e) { U.error(log, "Failed to execute GridComputeJobMasterLeaveAware.onMasterNodeLeft() callback " + "[nodeId=" + taskNode.id() + ", jobId=" + ses.getJobId() + ", job=" + job + ']', e); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java index 9a79a57c21b99..185e20dcbf27c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java @@ -655,7 +655,7 @@ public static IgniteException convertException(IgniteCheckedException e) { * @param e Ignite checked exception. * @return Ignite runtime exception. */ - @Nullable public static CacheException convertCacheException(IgniteCheckedException e) { + @Nullable public static CacheException convertToCacheException(IgniteCheckedException e) { if (e instanceof CachePartialUpdateCheckedException) return new CachePartialUpdateException((CachePartialUpdateCheckedException)e); diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java index bc742032f94b7..740acdde75151 100644 --- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java @@ -30,21 +30,43 @@ */ public interface IgniteFuture extends Future { /** - * @throws IgniteException - * @throws IgniteInterruptedException + * Synchronously waits for completion of the computation and + * returns computation result. + * + * @return Computation result. + * @throws IgniteInterruptedException Subclass of {@link IgniteException} thrown if the wait was interrupted. + * @throws IgniteFutureCancelledException Subclass of {@link IgniteException} throws if computation was cancelled. + * @throws IgniteException If computation failed. */ - @Override public V get() throws IgniteException, IgniteInterruptedException; + @Override public V get() throws IgniteException; - public V get(long timeout); + /** + * Synchronously waits for completion of the computation for + * up to the timeout specified and returns computation result. + * This method is equivalent to calling {@link #get(long, TimeUnit) get(long, TimeUnit.MILLISECONDS)}. + * + * @param timeout The maximum time to wait in milliseconds. + * @return Computation result. + * @throws IgniteInterruptedException Subclass of {@link IgniteException} thrown if the wait was interrupted. + * @throws IgniteFutureCancelledException Subclass of {@link IgniteException} throws if computation was cancelled. + * @throws org.apache.ignite.lang.IgniteFutureTimeoutException Subclass of {@link IgniteException} thrown if the wait was timed out. + * @throws IgniteException If computation failed. + */ + public V get(long timeout)throws IgniteException; /** - * @param timeout - * @param unit - * @return - * @throws IgniteException - * @throws IgniteInterruptedException + * Synchronously waits for completion of the computation for + * up to the timeout specified and returns computation result. + * + * @param timeout The maximum time to wait. + * @param unit The time unit of the {@code timeout} argument. + * @return Computation result. + * @throws IgniteInterruptedException Subclass of {@link IgniteException} thrown if the wait was interrupted. + * @throws IgniteFutureCancelledException Subclass of {@link IgniteException} throws if computation was cancelled. + * @throws org.apache.ignite.lang.IgniteFutureTimeoutException Subclass of {@link IgniteException} thrown if the wait was timed out. + * @throws IgniteException If computation failed. */ - @Override public V get(long timeout, TimeUnit unit) throws IgniteException, IgniteInterruptedException, IgniteFutureTimeoutException; + @Override public V get(long timeout, TimeUnit unit) throws IgniteException; /** * Cancels this future. @@ -77,7 +99,7 @@ public interface IgniteFuture extends Future { * immediately notified within the same thread. *

* Default value is {@code false}. To change the default, set - * {@link IgniteSystemProperties#GG_FUT_SYNC_NOTIFICATION} system property to {@code true}. + * {@link IgniteSystemProperties#IGNITE_FUT_SYNC_NOTIFICATION} system property to {@code true}. * * @param syncNotify Flag to turn on or off synchronous listener notification. */ @@ -91,7 +113,7 @@ public interface IgniteFuture extends Future { * immediately notified within the same thread. *

* Default value is {@code false}. To change the default, set - * {@link IgniteSystemProperties#GG_FUT_SYNC_NOTIFICATION} system property to {@code true}. + * {@link IgniteSystemProperties#IGNITE_FUT_SYNC_NOTIFICATION} system property to {@code true}. * * @return Synchronous listener notification flag. */ @@ -106,7 +128,7 @@ public interface IgniteFuture extends Future { * started the future, or in a different thread). *

* Default value is {@code false}. To change the default, set - * {@link IgniteSystemProperties#GG_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. + * {@link IgniteSystemProperties#IGNITE_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. * * @param concurNotify Flag to turn on or off concurrent listener notification. */ @@ -121,7 +143,7 @@ public interface IgniteFuture extends Future { * started the future, or in a different thread). *

* Default value is {@code false}. To change the default, set - * {@link IgniteSystemProperties#GG_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. + * {@link IgniteSystemProperties#IGNITE_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. * * @return Concurrent listener notification flag */ diff --git a/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java b/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java index 00956613ef043..71a005c234a5b 100644 --- a/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java +++ b/modules/core/src/main/java/org/apache/ignite/lifecycle/LifecycleBean.java @@ -101,7 +101,7 @@ public interface LifecycleBean { * This method is called when lifecycle event occurs. * * @param evt Lifecycle event. - * @throws IgniteCheckedException Thrown in case of any errors. + * @throws IgniteException Thrown in case of any errors. */ - public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException; + public void onLifecycleEvent(LifecycleEventType evt) throws IgniteException; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterMetricsSelfTest.java index 6a08035454c1e..34044290e9abd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterMetricsSelfTest.java @@ -73,7 +73,7 @@ public void testEmptyProjection() throws Exception { assert false; } - catch (ClusterGroupEmptyCheckedException e) { + catch (ClusterGroupEmptyException e) { info("Caught expected exception: " + e); } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java index e627193b4896a..e89104c435da6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java @@ -94,7 +94,7 @@ private static class TestLifecycleBean extends TestLifecycleAware implements Lif } /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { // No-op. } } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleBeanSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleBeanSelfTest.java index b177610942a38..5007feebb7116 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleBeanSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleBeanSelfTest.java @@ -250,7 +250,7 @@ private LifeCycleBaseBean() { } /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { callsCntr.get(evt).incrementAndGet(); } @@ -282,10 +282,10 @@ private LifeCycleExceptionBean(LifecycleEventType errType, boolean gridErr) { } /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { if (evt == errType) { if (gridErr) - throw new IgniteCheckedException("Expected exception for event: " + evt) { + throw new IgniteException("Expected exception for event: " + evt) { @Override public void printStackTrace(PrintStream s) { // No-op. } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java index 9295a054f16c9..8a94c8855bd19 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java @@ -128,7 +128,7 @@ public void testLargeObjects() throws Exception { int cnt = 10000; - populate(grid(0).cache(null), cnt, KBSIZE); + populate(grid(0).jcache(null), cnt, KBSIZE); int gridCnt = 3; @@ -165,11 +165,11 @@ public void testLargeObjectsWithLifeCycleBean() throws Exception { @IgniteInstanceResource private Ignite ignite; - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { if (evt == LifecycleEventType.AFTER_GRID_START) { - GridCache c = ignite.cache(null); + IgniteCache c = ignite.jcache(null); - if (c.putxIfAbsent(-1, new byte[1])) { + if (c.putIfAbsent(-1, new byte[1])) { populate(c, cnt, KBSIZE); info(">>> POPULATED GRID <<<"); @@ -208,7 +208,7 @@ public void testLargeObjectsWithLifeCycleBean() throws Exception { * @param kbSize Size in KB. * @throws IgniteCheckedException If failed. */ - private void populate(GridCache c, int cnt, int kbSize) throws IgniteCheckedException { + private void populate(IgniteCache c, int cnt, int kbSize) { for (int i = 0; i < cnt; i++) c.put(i, value(kbSize)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java index b8818b0400fc4..49f11d29ea17f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java @@ -125,7 +125,7 @@ public void testUnloadZeroBackupsTwoNodes() throws Exception { int cnt = 1000; - populate(grid(0).cache(null), cnt); + populate(grid(0).jcache(null), cnt); int gridCnt = 2; @@ -152,7 +152,7 @@ public void testUnloadOneBackupTwoNodes() throws Exception { int cnt = 1000; - populate(grid(0).cache(null), cnt); + populate(grid(0).jcache(null), cnt); int gridCnt = 2; @@ -231,7 +231,7 @@ public void testUnloadOneBackupThreeNodes() throws Exception { int cnt = 1000; - populate(grid(0).cache(null), cnt); + populate(grid(0).jcache(null), cnt); int gridCnt = 3; @@ -263,12 +263,12 @@ public void testUnloadOneBackThreeNodesWithLifeCycleBean() throws Exception { @IgniteInstanceResource private Ignite ignite; - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { if (evt == LifecycleEventType.AFTER_GRID_START) { - GridCache c = ignite.cache(null); + IgniteCache c = ignite.jcache(null); - if (c.putxIfAbsent(-1, "true")) { - populate(ignite.cache(null), cnt); + if (c.putIfAbsent(-1, "true")) { + populate(ignite.jcache(null), cnt); info(">>> POPULATED GRID <<<"); } @@ -301,7 +301,7 @@ public void testUnloadOneBackThreeNodesWithLifeCycleBean() throws Exception { * @param cnt Key count. * @throws IgniteCheckedException If failed. */ - private void populate(GridCache c, int cnt) throws IgniteCheckedException { + private void populate(IgniteCache c, int cnt) { for (int i = 0; i < cnt; i++) c.put(i, value(1024)); } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java index 7f68b6de608a7..eaa8a0ca2d53a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedPreloadLifecycleSelfTest.java @@ -81,51 +81,56 @@ private LifecycleBean lifecycleBean(final Object[] keys) { @IgniteInstanceResource private Ignite ignite; - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { - switch (evt) { - case AFTER_GRID_START: { - GridCache c1 = ignite.cache("one"); - GridCache c2 = ignite.cache("two"); + @Override public void onLifecycleEvent(LifecycleEventType evt) { + try { + switch (evt) { + case AFTER_GRID_START: { + GridCache c1 = ignite.cache("one"); + GridCache c2 = ignite.cache("two"); - if (!ignite.name().contains("Test0")) { - info("Keys already in cache:"); + if (!ignite.name().contains("Test0")) { + info("Keys already in cache:"); - for (Object k : c1.keySet()) - info("Cache1: " + k.toString()); + for (Object k : c1.keySet()) + info("Cache1: " + k.toString()); - for (Object k : c2.keySet()) - info("Cache2: " + k.toString()); + for (Object k : c2.keySet()) + info("Cache2: " + k.toString()); - return; - } + return; + } - info("Populating cache data..."); + info("Populating cache data..."); - int i = 0; + int i = 0; - for (Object key : keys) { - c1.put(key, new MyValue(value(key))); + for (Object key : keys) { + c1.put(key, new MyValue(value(key))); - if (i++ % 2 == 0) - c2.put(key, new MyValue(value(key))); - } + if (i++ % 2 == 0) + c2.put(key, new MyValue(value(key))); + } - assert c1.size() == keys.length : "Invalid cache1 size [size=" + c1.size() + - ", entries=" + c1.entrySet() + ']'; - assert c2.size() == keys.length / 2 : "Invalid cache2 size [size=" + c2.size() + - ", entries=" + c2.entrySet() + ']'; + assert c1.size() == keys.length : "Invalid cache1 size [size=" + c1.size() + + ", entries=" + c1.entrySet() + ']'; + assert c2.size() == keys.length / 2 : "Invalid cache2 size [size=" + c2.size() + + ", entries=" + c2.entrySet() + ']'; - break; - } + break; + } - case BEFORE_GRID_START: - case BEFORE_GRID_STOP: - case AFTER_GRID_STOP: { - info("Lifecycle event: " + evt); + case BEFORE_GRID_START: + case BEFORE_GRID_STOP: + case AFTER_GRID_STOP: { + info("Lifecycle event: " + evt); - break; + break; + } } } + catch (IgniteCheckedException e) { + throw new IgniteException(e); + } } }; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java index 266ba56f6e362..4696ed823be47 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadLifecycleSelfTest.java @@ -82,53 +82,58 @@ private LifecycleBean lifecycleBean(final Object[] keys) { @IgniteInstanceResource private Ignite ignite; - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { - switch (evt) { - case AFTER_GRID_START: { - GridCache c1 = ignite.cache("one"); - GridCache c2 = ignite.cache("two"); + @Override public void onLifecycleEvent(LifecycleEventType evt) { + try { + switch (evt) { + case AFTER_GRID_START: { + GridCache c1 = ignite.cache("one"); + GridCache c2 = ignite.cache("two"); - if (!ignite.name().contains("Test0")) { - if (!quiet) { - info("Keys already in cache:"); + if (!ignite.name().contains("Test0")) { + if (!quiet) { + info("Keys already in cache:"); - for (Object k : c1.keySet()) - info("Cache1: " + k.toString()); + for (Object k : c1.keySet()) + info("Cache1: " + k.toString()); - for (Object k : c2.keySet()) - info("Cache2: " + k.toString()); - } + for (Object k : c2.keySet()) + info("Cache2: " + k.toString()); + } - return; - } + return; + } - info("Populating cache data..."); + info("Populating cache data..."); - int i = 0; + int i = 0; - for (Object key : keys) { - c1.put(key, new MyValue(value(key))); + for (Object key : keys) { + c1.put(key, new MyValue(value(key))); - if (i++ % 2 == 0) - c2.put(key, new MyValue(value(key))); - } + if (i++ % 2 == 0) + c2.put(key, new MyValue(value(key))); + } - assert c1.size() == keys.length : "Invalid cache1 size [size=" + c1.size() + - ", entries=" + c1.entrySet() + ']'; - assert c2.size() == keys.length / 2 : "Invalid cache2 size [size=" + c2.size() + - ", entries=" + c2.entrySet() + ']'; + assert c1.size() == keys.length : "Invalid cache1 size [size=" + c1.size() + + ", entries=" + c1.entrySet() + ']'; + assert c2.size() == keys.length / 2 : "Invalid cache2 size [size=" + c2.size() + + ", entries=" + c2.entrySet() + ']'; - break; - } + break; + } - case BEFORE_GRID_START: - case BEFORE_GRID_STOP: - case AFTER_GRID_STOP: { - info("Lifecycle event: " + evt); + case BEFORE_GRID_START: + case BEFORE_GRID_STOP: + case AFTER_GRID_STOP: { + info("Lifecycle event: " + evt); - break; + break; + } } } + catch (IgniteCheckedException e) { + throw new IgniteException(e); + } } }; } diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java index 5b198d1e5b8d3..90a6eb7342b12 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/clock/GridTimeSyncProcessorSelfTest.java @@ -195,7 +195,7 @@ private TimeShiftLifecycleBean(int delta) { } /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType evt) { if (evt == LifecycleEventType.BEFORE_GRID_START) ((GridKernalContextImpl)((IgniteKernal)g).context()).timeSource(new TimeShiftClockSource(delta)); } diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java index bd011f4eb1fdd..ee584518a6f9d 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/GridTestLifecycleBean.java @@ -26,12 +26,13 @@ * Lifecycle bean. */ public class GridTestLifecycleBean implements LifecycleBean { + /** */ @IgniteInstanceResource private Ignite g; - @Override public void onLifecycleEvent(LifecycleEventType type) throws IgniteCheckedException { + @Override public void onLifecycleEvent(LifecycleEventType type) { if (type == LifecycleEventType.AFTER_GRID_START) { - GridCache cache = g.cache("partitioned"); + IgniteCache cache = g.jcache("partitioned"); assert cache != null; diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiLifecycleBean.java b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiLifecycleBean.java index b12c94d36d54b..ed54a86ae3657 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiLifecycleBean.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/dsi/GridDsiLifecycleBean.java @@ -40,20 +40,26 @@ public class GridDsiLifecycleBean implements LifecycleBean { private ApplicationContext springCtx; /** {@inheritDoc} */ - @Override public void onLifecycleEvent(LifecycleEventType evt) throws IgniteCheckedException { - switch (evt) { - case BEFORE_GRID_START: - break; + @Override public void onLifecycleEvent(LifecycleEventType evt) { + try { + switch (evt) { + case BEFORE_GRID_START: + break; - case AFTER_GRID_START: - ignite.cache("PARTITIONED_CACHE").dataStructures().atomicSequence("ID", 0, true); - break; + case AFTER_GRID_START: + ignite.cache("PARTITIONED_CACHE").dataStructures().atomicSequence("ID", 0, true); - case BEFORE_GRID_STOP: - break; + break; - case AFTER_GRID_STOP: - break; + case BEFORE_GRID_STOP: + break; + + case AFTER_GRID_STOP: + break; + } + } + catch (Exception e) { + throw new IgniteException(e); } } } diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java index acfe2479d1f2a..4e6390c509c93 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java @@ -170,8 +170,7 @@ private static class IncrementingUpdater implements IgniteDataLoadCacheUpdater cache, - Collection> entries) throws IgniteCheckedException { + @Override public void update(IgniteCache cache, Collection> entries) { for (Map.Entry entry : entries) cache.invoke(entry.getKey(), INC); }