http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessor.java index 9d3bf70..9e0042a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoaderProcessor.java @@ -79,7 +79,7 @@ public class GridDataLoaderProcessor<K, V> extends GridProcessorAdapter { return; flusher = new IgniteThread(new GridWorker(ctx.gridName(), "grid-data-loader-flusher", log) { - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { while (!isCancelled()) { IgniteDataLoaderImpl<K, V> ldr = flushQ.take(); @@ -126,7 +126,7 @@ public class GridDataLoaderProcessor<K, V> extends GridProcessorAdapter { try { ldr.close(cancel); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { U.warn(log, "Interrupted while waiting for completion of the data loader: " + ldr, e); } catch (IgniteCheckedException e) {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java index 3e8abd8..d0ed816 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/IgniteDataLoaderImpl.java @@ -530,7 +530,7 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay try { f = buf.update(entriesForNode, lsnr); } - catch (IgniteInterruptedException e1) { + catch (IgniteInterruptedCheckedException e1) { resFut.onDone(e1); return; @@ -655,7 +655,7 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay * Does not wait for result and does not fail on errors assuming that this method * should be called periodically. */ - @Override public void tryFlush() throws IgniteInterruptedException { + @Override public void tryFlush() throws IgniteInterruptedCheckedException { if (!busyLock.enterBusy()) return; @@ -805,11 +805,11 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay /** * @param newEntries Infos. * @param lsnr Listener for the operation future. - * @throws org.apache.ignite.IgniteInterruptedException If failed. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If failed. * @return Future for operation. */ @Nullable GridFutureAdapter<?> update(Iterable<Map.Entry<K, V>> newEntries, - IgniteInClosure<IgniteInternalFuture<?>> lsnr) throws IgniteInterruptedException { + IgniteInClosure<IgniteInternalFuture<?>> lsnr) throws IgniteInterruptedCheckedException { List<Map.Entry<K, V>> entries0 = null; GridFutureAdapter<Object> curFut0; @@ -850,10 +850,10 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay /** * @return Future if any submitted. * - * @throws org.apache.ignite.IgniteInterruptedException If thread has been interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread has been interrupted. */ @Nullable - IgniteInternalFuture<?> flush() throws IgniteInterruptedException { + IgniteInternalFuture<?> flush() throws IgniteInterruptedCheckedException { List<Map.Entry<K, V>> entries0 = null; GridFutureAdapter<Object> curFut0 = null; @@ -897,9 +897,9 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay /** * Increments active tasks count. * - * @throws org.apache.ignite.IgniteInterruptedException If thread has been interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread has been interrupted. */ - private void incrementActiveTasks() throws IgniteInterruptedException { + private void incrementActiveTasks() throws IgniteInterruptedCheckedException { U.acquire(sem); } @@ -915,10 +915,10 @@ public class IgniteDataLoaderImpl<K, V> implements IgniteDataLoader<K, V>, Delay /** * @param entries Entries to submit. * @param curFut Current future. - * @throws org.apache.ignite.IgniteInterruptedException If interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If interrupted. */ private void submit(final Collection<Map.Entry<K, V>> entries, final GridFutureAdapter<Object> curFut) - throws IgniteInterruptedException { + throws IgniteInterruptedCheckedException { assert entries != null; assert !entries.isEmpty(); assert curFut != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java index 71c018a..55e4af9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDataManager.java @@ -238,7 +238,7 @@ public class GridGgfsDataManager extends GridGgfsManager { // Always wait thread exit. U.join(delWorker); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { log.warning("Got interrupter while waiting for delete worker to stop (will continue stopping).", e); } @@ -1083,7 +1083,7 @@ public class GridGgfsDataManager extends GridGgfsManager { try { ggfs.awaitDeletesAsync().get(trashPurgeTimeout); } - catch (IgniteFutureTimeoutException ignore) { + catch (IgniteFutureTimeoutCheckedException ignore) { // Ignore. } @@ -1250,7 +1250,7 @@ public class GridGgfsDataManager extends GridGgfsManager { try { ggfs.awaitDeletesAsync().get(trashPurgeTimeout); } - catch (IgniteFutureTimeoutException ignore) { + catch (IgniteFutureTimeoutCheckedException ignore) { // Ignore. } @@ -1690,7 +1690,7 @@ public class GridGgfsDataManager extends GridGgfsManager { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { while (!isCancelled()) { IgniteBiTuple<GridFutureAdapter<Object>, GridGgfsFileInfo> req = delReqs.take(); @@ -1721,7 +1721,7 @@ public class GridGgfsDataManager extends GridGgfsManager { block)); } } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { // Ignore interruption during shutdown. } catch (IgniteCheckedException e) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteWorker.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteWorker.java index 0398235..ba33b2a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsDeleteWorker.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.managers.communication.*; import org.apache.ignite.internal.managers.eventstorage.*; @@ -178,7 +179,7 @@ public class GridGgfsDeleteWorker extends GridGgfsThread { else break; } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { // Ignore this exception while stopping. } catch (IgniteCheckedException e) { @@ -303,7 +304,7 @@ public class GridGgfsDeleteWorker extends GridGgfsThread { try { fut.get(); } - catch (IgniteFutureCancelledException ignore) { + catch (IgniteFutureCancelledCheckedException ignore) { // This future can be cancelled only due to GGFS shutdown. cancelled = true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileWorkerBatch.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileWorkerBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileWorkerBatch.java index 6bfe1c6..93a3f6e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileWorkerBatch.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFileWorkerBatch.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; import org.apache.ignite.fs.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.internal.*; import java.io.*; @@ -166,7 +167,7 @@ public class GridGgfsFileWorkerBatch { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } IgniteCheckedException err0 = err; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerManager.java index e647641..5a6eae5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsFragmentizerManager.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.fs; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.thread.*; @@ -391,7 +392,7 @@ public class GridGgfsFragmentizerManager extends GridGgfsManager { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { // Wait for all previous fragmentizer tasks to complete. syncStart(); @@ -409,7 +410,7 @@ public class GridGgfsFragmentizerManager extends GridGgfsManager { } } catch (IgniteCheckedException | IgniteException e) { - if (!X.hasCause(e, InterruptedException.class) && !X.hasCause(e, IgniteInterruptedException.class)) + if (!X.hasCause(e, InterruptedException.class) && !X.hasCause(e, IgniteInterruptedCheckedException.class)) LT.warn(log, e, "Failed to get fragmentizer file info (will retry)."); else { if (log.isDebugEnabled()) @@ -725,7 +726,7 @@ public class GridGgfsFragmentizerManager extends GridGgfsManager { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { while (!isCancelled()) { IgniteBiTuple<UUID, GridGgfsCommunicationMessage> req = msgs.take(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java index d63f25a..1f1407e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java @@ -137,7 +137,7 @@ public class GridGgfsMetaManager extends GridGgfsManager { try { U.join(delWorker0); } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { // No-op. } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java index 4ce2d47..b5e7983 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsServer.java @@ -227,7 +227,7 @@ public class GridGgfsServer { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { GridGgfsDataInputStream dis = new GridGgfsDataInputStream(endpoint.inputStream()); @@ -388,7 +388,7 @@ public class GridGgfsServer { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { while (!Thread.currentThread().isInterrupted()) { GridIpcEndpoint client = srvEndpoint.accept(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java ---------------------------------------------------------------------- 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 8ed6319..f9ecb10 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 @@ -489,7 +489,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject { } } catch (IgniteCheckedException e) { - if (sysStopping && e.hasCause(IgniteInterruptedException.class, InterruptedException.class)) { + if (sysStopping && e.hasCause(IgniteInterruptedCheckedException.class, InterruptedException.class)) { ex = handleThrowable(e); assert ex != null; @@ -560,7 +560,7 @@ public class GridJobWorker extends GridWorker implements GridTimeoutObject { ex = new ComputeUserUndeclaredException(msg, e); } - else if (sysStopping && X.hasCause(e, InterruptedException.class, IgniteInterruptedException.class)) { + else if (sysStopping && X.hasCause(e, InterruptedException.class, IgniteInterruptedCheckedException.class)) { msg = "Job got interrupted due to system stop (will attempt failover)."; ex = new ComputeExecutionRejectedException(e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java index b094250..57f0e46 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java @@ -1339,9 +1339,9 @@ public class GridQueryProcessor extends GridProcessorAdapter { /** * @return Waits for initialization. - * @throws org.apache.ignite.IgniteInterruptedException If thread is interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted. */ - boolean await() throws IgniteInterruptedException { + boolean await() throws IgniteInterruptedCheckedException { return initializer.await(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java index 8db40b9..168ec86 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java @@ -815,14 +815,14 @@ public class GridServiceProcessor extends GridProcessorAdapter { try { cp.execute(svcCtx); } - catch (InterruptedException | IgniteInterruptedException ignore) { + catch (InterruptedException | IgniteInterruptedCheckedException ignore) { if (log.isDebugEnabled()) log.debug("Service thread was interrupted [name=" + svcCtx.name() + ", execId=" + svcCtx.executionId() + ']'); } catch (IgniteException e) { if (e.hasCause(InterruptedException.class) || - e.hasCause(IgniteInterruptedException.class)) { + e.hasCause(IgniteInterruptedCheckedException.class)) { if (log.isDebugEnabled()) log.debug("Service thread was interrupted [name=" + svcCtx.name() + ", execId=" + svcCtx.executionId() + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java index 760cf12..3b4db5c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/IgniteStreamerImpl.java @@ -359,7 +359,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { execFut.get(); } catch (IgniteCheckedException e) { - if (!e.hasCause(IgniteInterruptedException.class)) + if (!e.hasCause(IgniteInterruptedCheckedException.class)) U.warn(log, "Failed to wait for batch execution future completion (will ignore) " + "[execFut=" + execFut + ", e=" + e + ']'); } @@ -569,7 +569,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { * @param stageName Stage name. * @param evts Events. * @return Future. - * @throws org.apache.ignite.IgniteInterruptedException If failed. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If failed. */ private GridStreamerStageExecutionFuture addEvents0( @Nullable IgniteUuid execId, @@ -579,7 +579,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { @Nullable Collection<UUID> execNodeIds, String stageName, Collection<?> evts - ) throws IgniteInterruptedException { + ) throws IgniteInterruptedCheckedException { assert !F.isEmpty(evts); assert !F.isEmpty(stageName); @@ -610,7 +610,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -895,7 +895,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { addEvents0(null, fut.failoverAttemptCount() + 1, 0, null, Collections.singleton(ctx.localNodeId()), fut.stageName(), fut.events()); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { e.printStackTrace(); assert false : "Failover submit should never attempt to acquire semaphore: " + fut + ']'; @@ -1277,7 +1277,7 @@ public class IgniteStreamerImpl implements IgniteStreamerEx, Externalizable { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { long start = U.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/GridAtomicInitializer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridAtomicInitializer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridAtomicInitializer.java index 0f46efc..b2dd61e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridAtomicInitializer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridAtomicInitializer.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.util; import org.apache.ignite.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.internal.*; import java.util.concurrent.*; @@ -92,9 +93,9 @@ public class GridAtomicInitializer<T> { * Await for completion. * * @return {@code true} If initialization was completed successfully. - * @throws org.apache.ignite.IgniteInterruptedException If thread was interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread was interrupted. */ - public boolean await() throws IgniteInterruptedException { + public boolean await() throws IgniteInterruptedCheckedException { if (!finished) { synchronized (mux) { while (!finished) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java index f384437..a861948 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridUtils.java @@ -5644,17 +5644,17 @@ public abstract class GridUtils { * Converts {@link InterruptedException} to {@link IgniteCheckedException}. * * @param mux Mux to wait on. - * @throws org.apache.ignite.IgniteInterruptedException If interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If interrupted. */ @SuppressWarnings({"WaitNotInLoop", "WaitWhileNotSynced"}) - public static void wait(Object mux) throws IgniteInterruptedException { + public static void wait(Object mux) throws IgniteInterruptedCheckedException { try { mux.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -6873,16 +6873,16 @@ public abstract class GridUtils { * Awaits for condition. * * @param cond Condition to await for. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException} + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException} */ - public static void await(Condition cond) throws IgniteInterruptedException { + public static void await(Condition cond) throws IgniteInterruptedCheckedException { try { cond.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -6893,16 +6893,16 @@ public abstract class GridUtils { * @param time The maximum time to wait, * @param unit The unit of the {@code time} argument. * @return {@code false} if the waiting time detectably elapsed before return from the method, else {@code true} - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException} + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException} */ - public static boolean await(Condition cond, long time, TimeUnit unit) throws IgniteInterruptedException { + public static boolean await(Condition cond, long time, TimeUnit unit) throws IgniteInterruptedCheckedException { try { return cond.await(time, unit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -6910,9 +6910,9 @@ public abstract class GridUtils { * Awaits for the latch. * * @param latch Latch to wait for. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ - public static void await(CountDownLatch latch) throws IgniteInterruptedException { + public static void await(CountDownLatch latch) throws IgniteInterruptedCheckedException { try { if (latch.getCount() > 0) latch.await(); @@ -6920,7 +6920,7 @@ public abstract class GridUtils { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -6932,17 +6932,17 @@ public abstract class GridUtils { * @param unit Time unit for timeout. * @return {@code True} if the count reached zero and {@code false} * if the waiting time elapsed before the count reached zero. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ public static boolean await(CountDownLatch latch, long timeout, TimeUnit unit) - throws IgniteInterruptedException { + throws IgniteInterruptedCheckedException { try { return latch.await(timeout, unit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -7006,16 +7006,16 @@ public abstract class GridUtils { * Sleeps for given number of milliseconds. * * @param ms Time to sleep. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ - public static void sleep(long ms) throws IgniteInterruptedException { + public static void sleep(long ms) throws IgniteInterruptedCheckedException { try { Thread.sleep(ms); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -7023,9 +7023,9 @@ public abstract class GridUtils { * Joins worker. * * @param w Worker. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ - public static void join(GridWorker w) throws IgniteInterruptedException { + public static void join(GridWorker w) throws IgniteInterruptedCheckedException { try { if (w != null) w.join(); @@ -7033,7 +7033,7 @@ public abstract class GridUtils { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -7054,7 +7054,7 @@ public abstract class GridUtils { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } catch (CancellationException e) { throw new IgniteCheckedException(e); @@ -7065,16 +7065,16 @@ public abstract class GridUtils { * Joins thread. * * @param t Thread. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ - public static void join(Thread t) throws IgniteInterruptedException { + public static void join(Thread t) throws IgniteInterruptedCheckedException { try { t.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -7082,16 +7082,16 @@ public abstract class GridUtils { * Acquires a permit from provided semaphore. * * @param sem Semaphore. - * @throws org.apache.ignite.IgniteInterruptedException Wrapped {@link InterruptedException}. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */ - public static void acquire(Semaphore sem) throws IgniteInterruptedException { + public static void acquire(Semaphore sem) throws IgniteInterruptedCheckedException { try { sem.acquire(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -9097,4 +9097,21 @@ public abstract class GridUtils { return list; } + + /** + * @param e Ingite checked exception. + * @return Ignite runtime exception. + */ + public static IgniteException convertException(IgniteCheckedException e) { + if (e instanceof IgniteInterruptedCheckedException) + return new IgniteInterruptedException(e.getMessage(), (InterruptedException)e.getCause()); + else if (e instanceof IgniteFutureCancelledCheckedException) + return new IgniteFutureCancelledException(e.getMessage(), e.getCause()); + else if (e instanceof IgniteFutureTimeoutCheckedException) + return new IgniteFutureTimeoutException(e.getMessage(), e.getCause()); + else if (e.getCause() instanceof IgniteException) + return (IgniteException)e.getCause(); + + return new IgniteException(e); + } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java index db16ae8..5d6efa9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java @@ -344,7 +344,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> { err.compareAndSet(null, e); } - catch (IgniteFutureCancelledException e) { + catch (IgniteFutureCancelledCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed to execute compound future reducer [lsnr=" + this + ", e=" + e + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java index 9a8a439..79bfde0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java @@ -201,7 +201,7 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements acquireSharedInterruptibly(0); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); @@ -211,7 +211,7 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -234,7 +234,7 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException("Got interrupted while waiting for future to complete.", e); + throw new IgniteInterruptedCheckedException("Got interrupted while waiting for future to complete.", e); } } @@ -242,15 +242,15 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements * @param nanosTimeout Timeout (nanoseconds). * @return Result. * @throws InterruptedException If interrupted. - * @throws org.apache.ignite.lang.IgniteFutureTimeoutException If timeout reached before computation completed. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException If timeout reached before computation completed. * @throws IgniteCheckedException If error occurred. */ @Nullable protected R get0(long nanosTimeout) throws InterruptedException, IgniteCheckedException { if (endTime == 0 && !tryAcquireSharedNanos(0, nanosTimeout)) - throw new IgniteFutureTimeoutException("Timeout was reached before computation completed."); + throw new IgniteFutureTimeoutCheckedException("Timeout was reached before computation completed."); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); @@ -333,7 +333,7 @@ public class GridFutureAdapter<R> extends AbstractQueuedSynchronizer implements synchronized (mux) { lsnrs0 = lsnrs; - if (lsnrs0 == null) + if (lsnrs0 == null || lsnrs0.isEmpty()) return; lsnrs = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapterEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapterEx.java index 6d60b92..dcd7e56 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapterEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapterEx.java @@ -151,7 +151,7 @@ public class GridFutureAdapterEx<R> extends AbstractQueuedSynchronizer implement acquireSharedInterruptibly(0); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); @@ -161,7 +161,7 @@ public class GridFutureAdapterEx<R> extends AbstractQueuedSynchronizer implement catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -184,7 +184,7 @@ public class GridFutureAdapterEx<R> extends AbstractQueuedSynchronizer implement catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException("Got interrupted while waiting for future to complete.", e); + throw new IgniteInterruptedCheckedException("Got interrupted while waiting for future to complete.", e); } } @@ -192,15 +192,15 @@ public class GridFutureAdapterEx<R> extends AbstractQueuedSynchronizer implement * @param nanosTimeout Timeout (nanoseconds). * @return Result. * @throws InterruptedException If interrupted. - * @throws org.apache.ignite.lang.IgniteFutureTimeoutException If timeout reached before computation completed. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException If timeout reached before computation completed. * @throws IgniteCheckedException If error occurred. */ @Nullable protected R get0(long nanosTimeout) throws InterruptedException, IgniteCheckedException { if (endTime == 0 && !tryAcquireSharedNanos(0, nanosTimeout)) - throw new IgniteFutureTimeoutException("Timeout was reached before computation completed."); + throw new IgniteFutureTimeoutCheckedException("Timeout was reached before computation completed."); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java new file mode 100644 index 0000000..86e373c --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/IgniteFutureImpl.java @@ -0,0 +1,202 @@ +/* + * 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.util.future; + +import org.apache.ignite.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.internal.util.lang.*; +import org.apache.ignite.internal.util.typedef.*; +import org.apache.ignite.internal.util.typedef.internal.*; +import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; + +import java.util.concurrent.*; + +/** + * Implementation of public API future. + */ +public class IgniteFutureImpl<V> implements IgniteFuture<V> { + /** */ + private final IgniteInternalFuture<V> fut; + + /** + * @param fut Future. + */ + public IgniteFutureImpl(IgniteInternalFuture<V> fut) { + assert fut != null; + + this.fut = fut; + } + + /** {@inheritDoc} */ + @Override public long startTime() { + return fut.startTime(); + } + + /** {@inheritDoc} */ + @Override public long duration() { + return fut.duration(); + } + + /** {@inheritDoc} */ + @Override public void syncNotify(boolean syncNotify) { + fut.syncNotify(syncNotify); + } + + /** {@inheritDoc} */ + @Override public boolean syncNotify() { + return fut.syncNotify(); + } + + /** {@inheritDoc} */ + @Override public void concurrentNotify(boolean concurNotify) { + fut.concurrentNotify(concurNotify); + } + + /** {@inheritDoc} */ + @Override public boolean concurrentNotify() { + return fut.concurrentNotify(); + } + + /** {@inheritDoc} */ + @Override public boolean isCancelled() { + return fut.isCancelled(); + } + + /** {@inheritDoc} */ + @Override public boolean isDone() { + return fut.isDone(); + } + + /** {@inheritDoc} */ + @Override public void listenAsync(@Nullable final IgniteInClosure<? super IgniteFuture<V>> lsnr) { + if (lsnr != null) + fut.listenAsync(new InternalFutureListener(lsnr)); + } + + /** {@inheritDoc} */ + @Override public void stopListenAsync(IgniteInClosure<? super IgniteFuture<V>>... lsnrs) { + for (IgniteInClosure<? super IgniteFuture<V>> lsnr : lsnrs) { + if (lsnr != null) + fut.stopListenAsync(new InternalFutureListener(lsnr)); + } + } + + /** {@inheritDoc} */ + @Override public <T> IgniteFuture<T> chain(final IgniteClosure<? super IgniteFuture<V>, T> doneCb) { + IgniteInternalFuture<T> fut0 = fut.chain(new C1<IgniteInternalFuture<V>, T>() { + @Override public T apply(IgniteInternalFuture<V> fut) { + assert IgniteFutureImpl.this.fut == fut; + + try { + return doneCb.apply(IgniteFutureImpl.this); + } + catch (Exception e) { + throw new GridClosureException(e); + } + } + }); + + return new IgniteFutureImpl<>(fut0); + } + + /** {@inheritDoc} */ + @Override public boolean cancel() throws IgniteException { + try { + return fut.cancel(); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @Override public boolean cancel(boolean mayInterruptIfRunning) { + return mayInterruptIfRunning && cancel(); + } + + /** {@inheritDoc} */ + @Override public V get() { + try { + return fut.get(); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @Override public V get(long timeout, TimeUnit unit) { + try { + return fut.get(timeout, unit); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } + } + + /** {@inheritDoc} */ + @Override public String toString() { + return "IgniteFuture [orig=" + fut + ']'; + } + + /** + * + */ + private class InternalFutureListener implements IgniteInClosure<IgniteInternalFuture<V>> { + /** */ + private final IgniteInClosure<? super IgniteFuture<V>> lsnr; + + /** + * @param lsnr Wrapped listener. + */ + private InternalFutureListener(IgniteInClosure<? super IgniteFuture<V>> lsnr) { + assert lsnr != null; + + this.lsnr = lsnr; + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return lsnr.hashCode(); + } + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override public boolean equals(Object obj) { + if (obj == null || !obj.getClass().equals(InternalFutureListener.class)) + return false; + + InternalFutureListener lsnr0 = (InternalFutureListener)obj; + + return lsnr.equals(lsnr0.lsnr); + } + + /** {@inheritDoc} */ + @Override public void apply(IgniteInternalFuture<V> fut) { + assert IgniteFutureImpl.this.fut == fut; + + lsnr.apply(IgniteFutureImpl.this); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return lsnr.toString(); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java index 78fab34..d64880d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/shmem/GridIpcSharedMemoryServerEndpoint.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.util.ipc.shmem; import org.apache.ignite.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.resources.*; import org.apache.ignite.thread.*; @@ -318,7 +319,7 @@ public class GridIpcSharedMemoryServerEndpoint implements GridIpcServerEndpoint } } // while - throw new IgniteInterruptedException("Socket accept was interrupted."); + throw new IgniteInterruptedCheckedException("Socket accept was interrupted."); } /** @@ -448,7 +449,7 @@ public class GridIpcSharedMemoryServerEndpoint implements GridIpcServerEndpoint try { U.join(gcWorker); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { U.warn(log, "Interrupted when stopping GC worker.", e); } finally { @@ -519,7 +520,7 @@ public class GridIpcSharedMemoryServerEndpoint implements GridIpcServerEndpoint } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { if (log.isDebugEnabled()) log.debug("GC worker started."); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java index c21bf5f..c4bd2f1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java @@ -2777,10 +2777,10 @@ public class GridFunc { try { return fut.get(); } - catch (IgniteFutureCancelledException ignore) { + catch (IgniteFutureCancelledCheckedException ignore) { throw new CancellationException("The computation was cancelled."); } - catch (IgniteInterruptedException ignore) { + catch (IgniteInterruptedCheckedException ignore) { throw new InterruptedException("The computation was interrupted."); } catch (IgniteCheckedException e) { @@ -2793,13 +2793,13 @@ public class GridFunc { try { return fut.get(timeout, unit); } - catch (IgniteFutureCancelledException ignore) { + catch (IgniteFutureCancelledCheckedException ignore) { throw new CancellationException("The computation was cancelled."); } - catch (IgniteInterruptedException ignore) { + catch (IgniteInterruptedCheckedException ignore) { throw new InterruptedException("The computation was interrupted."); } - catch (IgniteFutureTimeoutException e) { + catch (IgniteFutureTimeoutCheckedException e) { throw new TimeoutException("The computation timed out: " + e.getMessage()); } catch (IgniteCheckedException e) { @@ -8499,7 +8499,7 @@ public class GridFunc { long left = end - U.currentTimeMillis(); if (left <= 0 && !fut.isDone()) - throw new IgniteFutureTimeoutException("Timed out waiting for all futures: " + futs); + throw new IgniteFutureTimeoutCheckedException("Timed out waiting for all futures: " + futs); if (fut.isDone() && left < 0) left = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFuture.java index 468109b..e75d74e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFuture.java @@ -40,7 +40,7 @@ public interface GridPlainFuture<R> { * @param unit Timeout interval unit to wait future completes. * @return Completed future result. * @throws IgniteCheckedException In case of error. - * @throws org.apache.ignite.lang.IgniteFutureTimeoutException If timed out before future finishes. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException If timed out before future finishes. */ public R get(long timeout, TimeUnit unit) throws IgniteCheckedException; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFutureAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFutureAdapter.java index 6b22237..8475a5f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFutureAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridPlainFutureAdapter.java @@ -18,7 +18,7 @@ package org.apache.ignite.internal.util.lang; import org.apache.ignite.*; -import org.apache.ignite.lang.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.internal.*; import java.util.*; @@ -90,7 +90,7 @@ public class GridPlainFutureAdapter<R> implements GridPlainFuture<R> { try { if (doneLatch.getCount() > 0 && !doneLatch.await(timeout, unit)) - throw new IgniteFutureTimeoutException("Failed to get future result due to waiting timed out."); + throw new IgniteFutureTimeoutCheckedException("Failed to get future result due to waiting timed out."); } catch (InterruptedException e) { Thread.currentThread().interrupt(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFuture.java index bdd4383..7baf2e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFuture.java @@ -35,8 +35,8 @@ public interface GridNioFuture<R> { * returns operation result. * * @return Operation result. - * @throws org.apache.ignite.IgniteInterruptedException Subclass of {@link GridException} thrown if the wait was interrupted. - * @throws IgniteFutureCancelledException Subclass of {@link GridException} throws if operation was cancelled. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Subclass of {@link GridException} thrown if the wait was interrupted. + * @throws org.apache.ignite.internal.IgniteFutureCancelledCheckedException Subclass of {@link GridException} throws if operation was cancelled. * @throws IgniteCheckedException If operation failed. * @throws IOException If IOException occurred while performing operation. */ @@ -49,9 +49,9 @@ public interface GridNioFuture<R> { * * @param timeout The maximum time to wait in milliseconds. * @return Operation result. - * @throws org.apache.ignite.IgniteInterruptedException Subclass of {@link GridException} thrown if the wait was interrupted. - * @throws IgniteFutureTimeoutException Subclass of {@link GridException} thrown if the wait was timed out. - * @throws IgniteFutureCancelledException Subclass of {@link GridException} throws if operation was cancelled. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Subclass of {@link GridException} thrown if the wait was interrupted. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException Subclass of {@link GridException} thrown if the wait was timed out. + * @throws org.apache.ignite.internal.IgniteFutureCancelledCheckedException Subclass of {@link GridException} throws if operation was cancelled. * @throws IgniteCheckedException If operation failed. * @throws IOException If IOException occurred while performing operation. */ @@ -64,9 +64,9 @@ public interface GridNioFuture<R> { * @param timeout The maximum time to wait. * @param unit The time unit of the {@code timeout} argument. * @return Operation result. - * @throws org.apache.ignite.IgniteInterruptedException Subclass of {@link GridException} thrown if the wait was interrupted. - * @throws IgniteFutureTimeoutException Subclass of {@link GridException} thrown if the wait was timed out. - * @throws IgniteFutureCancelledException Subclass of {@link GridException} throws if operation was cancelled. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Subclass of {@link GridException} thrown if the wait was interrupted. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException Subclass of {@link GridException} thrown if the wait was timed out. + * @throws org.apache.ignite.internal.IgniteFutureCancelledCheckedException Subclass of {@link GridException} throws if operation was cancelled. * @throws IgniteCheckedException If operation failed. * @throws IOException If IOException occurred while performing operation. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFutureImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFutureImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFutureImpl.java index a5a80f5..a1987e5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFutureImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioFutureImpl.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; +import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -87,7 +88,7 @@ public class GridNioFutureImpl<R> extends AbstractQueuedSynchronizer implements acquireSharedInterruptibly(0); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); @@ -97,7 +98,7 @@ public class GridNioFutureImpl<R> extends AbstractQueuedSynchronizer implements catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException(e); + throw new IgniteInterruptedCheckedException(e); } } @@ -118,7 +119,7 @@ public class GridNioFutureImpl<R> extends AbstractQueuedSynchronizer implements catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new IgniteInterruptedException("Got interrupted while waiting for future to complete.", e); + throw new IgniteInterruptedCheckedException("Got interrupted while waiting for future to complete.", e); } } @@ -126,15 +127,15 @@ public class GridNioFutureImpl<R> extends AbstractQueuedSynchronizer implements * @param nanosTimeout Timeout (nanoseconds). * @return Result. * @throws InterruptedException If interrupted. - * @throws IgniteFutureTimeoutException If timeout reached before computation completed. + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException If timeout reached before computation completed. * @throws IgniteCheckedException If error occurred. */ @Nullable protected R get0(long nanosTimeout) throws InterruptedException, IgniteCheckedException { if (endTime == 0 && !tryAcquireSharedNanos(0, nanosTimeout)) - throw new IgniteFutureTimeoutException("Timeout was reached before computation completed."); + throw new IgniteFutureTimeoutCheckedException("Timeout was reached before computation completed."); if (getState() == CANCELLED) - throw new IgniteFutureCancelledException("Future was cancelled: " + this); + throw new IgniteFutureCancelledCheckedException("Future was cancelled: " + this); if (err != null) throw U.cast(err); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java index 5a137a9..666fcea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.util.nio; import org.apache.ignite.*; import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.thread.*; @@ -718,7 +719,7 @@ public class GridNioServer<T> { try { U.sleep(50); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { throw new IOException("Thread has been interrupted.", e); } } @@ -942,7 +943,7 @@ public class GridNioServer<T> { try { U.sleep(50); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { throw new IOException("Thread has been interrupted.", e); } } @@ -1076,7 +1077,7 @@ public class GridNioServer<T> { try { U.sleep(50); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { throw new IOException("Thread has been interrupted.", e); } } @@ -1124,7 +1125,7 @@ public class GridNioServer<T> { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { boolean reset = false; while (!closed) { @@ -1584,7 +1585,7 @@ public class GridNioServer<T> { } /** {@inheritDoc} */ - @Override protected void body() throws InterruptedException, IgniteInterruptedException { + @Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException { try { boolean reset = false; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java index d0e6177..526e30a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/util/worker/GridWorker.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.util.worker; import org.apache.ignite.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -143,7 +144,7 @@ public abstract class GridWorker implements Runnable { body(); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { if (log.isDebugEnabled()) log.debug("Caught interrupted exception: " + e); } @@ -192,9 +193,9 @@ public abstract class GridWorker implements Runnable { * The implementation should provide the execution body for this runnable. * * @throws InterruptedException Thrown in case of interruption. - * @throws org.apache.ignite.IgniteInterruptedException If interrupted. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If interrupted. */ - protected abstract void body() throws InterruptedException, IgniteInterruptedException; + protected abstract void body() throws InterruptedException, IgniteInterruptedCheckedException; /** * Optional method that will be called after runnable is finished. Default http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..a240caa --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFuture.java @@ -0,0 +1,141 @@ +/* + * 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.lang; + +import org.apache.ignite.*; +import org.jetbrains.annotations.*; + +import java.util.concurrent.*; + +/** + * Extension for standard {@link Future} interface. It adds simplified exception handling, + * functional programming support and ability to listen for future completion via functional + * callback. + * @param <V> Type of the result for the future. + */ +public interface IgniteFuture<V> extends Future<V> { + @Override public V get() throws IgniteException, IgniteInterruptedException; + + @Override public V get(long timeout, TimeUnit unit)throws IgniteException, IgniteInterruptedException; + + /** + * Cancels this future. + * + * @return {@code True} if future was canceled (i.e. was not finished prior to this call). + * @throws IgniteException If cancellation failed. + */ + public boolean cancel() throws IgniteException; + + /** + * Gets start time for this future. + * + * @return Start time for this future. + */ + public long startTime(); + + /** + * Gets duration in milliseconds between start of the future and current time if future + * is not finished, or between start and finish of this future. + * + * @return Time in milliseconds this future has taken to execute. + */ + public long duration(); + + /** + * Flag to turn on or off synchronous listener notification. If this flag is {@code true}, then + * upon future completion the notification may happen in the same thread that created + * the future. This becomes especially important when adding listener to a future that + * is already {@code done} - if this flag is {@code true}, then listener will be + * immediately notified within the same thread. + * <p> + * Default value is {@code false}. To change the default, set + * {@link IgniteSystemProperties#GG_FUT_SYNC_NOTIFICATION} system property to {@code true}. + * + * @param syncNotify Flag to turn on or off synchronous listener notification. + */ + public void syncNotify(boolean syncNotify); + + /** + * Gets value of synchronous listener notification flag. If this flag is {@code true}, then + * upon future completion the notification may happen in the same thread that created + * the future. This becomes especially important when adding listener to a future that + * is already {@code done} - if this flag is {@code true}, then listener will be + * immediately notified within the same thread. + * <p> + * Default value is {@code false}. To change the default, set + * {@link IgniteSystemProperties#GG_FUT_SYNC_NOTIFICATION} system property to {@code true}. + * + * @return Synchronous listener notification flag. + */ + public boolean syncNotify(); + + /** + * Flag to turn on or off concurrent listener notification. This flag comes into play only + * when a future has more than one listener subscribed to it. If this flag is {@code true}, + * then all listeners will be notified concurrently by different threads; otherwise, + * listeners will be notified one after another within one thread (depending on + * {@link #syncNotify()} flag, these notifications may happen either in the same thread which + * started the future, or in a different thread). + * <p> + * Default value is {@code false}. To change the default, set + * {@link IgniteSystemProperties#GG_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. + * + * @param concurNotify Flag to turn on or off concurrent listener notification. + */ + public void concurrentNotify(boolean concurNotify); + + /** + * Gets value concurrent listener notification flag. This flag comes into play only + * when a future has more than one listener subscribed to it. If this flag is {@code true}, + * then all listeners will be notified concurrently by different threads; otherwise, + * listeners will be notified one after another within one thread (depending on + * {@link #syncNotify()} flag, these notifications may happen either in the same thread which + * started the future, or in a different thread). + * <p> + * Default value is {@code false}. To change the default, set + * {@link IgniteSystemProperties#GG_FUT_CONCURRENT_NOTIFICATION} system property to {@code true}. + * + * @return Concurrent listener notification flag + */ + public boolean concurrentNotify(); + + /** + * Registers listener closure to be asynchronously notified whenever future completes. + * + * @param lsnr Listener closure to register. If not provided - this method is no-op. + */ + public void listenAsync(@Nullable IgniteInClosure<? super IgniteFuture<V>> lsnr); + + /** + * Removes given listeners from the future. If no listener is passed in, then all listeners + * will be removed. + * + * @param lsnr Listeners to remove. + */ + public void stopListenAsync(@Nullable IgniteInClosure<? super IgniteFuture<V>>... lsnr); + + /** + * Make a chained future to convert result of this future (when complete) into a new format. + * It is guaranteed that done callback will be called only ONCE. + * + * @param doneCb Done callback that is applied to this future when it finishes to produce chained future result. + * @return Chained future that finishes after this future completes and done callback is called. + */ + public <T> IgniteFuture<T> chain(IgniteClosure<? super IgniteFuture<V>, T> doneCb); + +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java index d87be00..f0c01a2 100644 --- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java +++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureCancelledException.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.*; /** * Future computation cannot be retrieved because it was cancelled. */ -public class IgniteFutureCancelledException extends IgniteCheckedException { +public class IgniteFutureCancelledException extends IgniteException { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java index ef9efa4..c2f8945 100644 --- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java +++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteFutureTimeoutException.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.*; /** * Future computation completion is timed out. */ -public class IgniteFutureTimeoutException extends IgniteCheckedException { +public class IgniteFutureTimeoutException extends IgniteException { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectStreamRegistry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectStreamRegistry.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectStreamRegistry.java index f61da12..16b68d7 100644 --- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectStreamRegistry.java +++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/IgniteOptimizedObjectStreamRegistry.java @@ -18,6 +18,7 @@ package org.apache.ignite.marshaller.optimized; import org.apache.ignite.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.io.*; @@ -64,9 +65,9 @@ class IgniteOptimizedObjectStreamRegistry { * Gets output stream. * * @return Object output stream. - * @throws org.apache.ignite.IgniteInterruptedException If thread is interrupted while trying to take holder from pool. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool. */ - static IgniteOptimizedObjectOutputStream out() throws IgniteInterruptedException { + static IgniteOptimizedObjectOutputStream out() throws IgniteInterruptedCheckedException { return holder().acquireOut(); } @@ -74,9 +75,9 @@ class IgniteOptimizedObjectStreamRegistry { * Gets input stream. * * @return Object input stream. - * @throws org.apache.ignite.IgniteInterruptedException If thread is interrupted while trying to take holder from pool. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool. */ - static IgniteOptimizedObjectInputStream in() throws IgniteInterruptedException { + static IgniteOptimizedObjectInputStream in() throws IgniteInterruptedCheckedException { return holder().acquireIn(); } @@ -127,9 +128,9 @@ class IgniteOptimizedObjectStreamRegistry { * Gets holder from pool or thread local. * * @return Stream holder. - * @throws org.apache.ignite.IgniteInterruptedException If thread is interrupted while trying to take holder from pool. + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool. */ - private static StreamHolder holder() throws IgniteInterruptedException { + private static StreamHolder holder() throws IgniteInterruptedCheckedException { StreamHolder holder = holders.get(); if (holder == null) { @@ -137,7 +138,7 @@ class IgniteOptimizedObjectStreamRegistry { holders.set(holder = pool != null ? pool.take() : new StreamHolder()); } catch (InterruptedException e) { - throw new IgniteInterruptedException("Failed to take object stream from pool (thread interrupted).", e); + throw new IgniteInterruptedCheckedException("Failed to take object stream from pool (thread interrupted).", e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/scheduler/SchedulerFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/scheduler/SchedulerFuture.java b/modules/core/src/main/java/org/apache/ignite/scheduler/SchedulerFuture.java index c064197..591f3a7 100644 --- a/modules/core/src/main/java/org/apache/ignite/scheduler/SchedulerFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/scheduler/SchedulerFuture.java @@ -133,7 +133,7 @@ public interface SchedulerFuture<R> extends IgniteInternalFuture<R> { * * @return Result of the next execution. * @throws CancellationException {@inheritDoc} - * @throws org.apache.ignite.IgniteInterruptedException {@inheritDoc} + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException {@inheritDoc} * @throws IgniteCheckedException {@inheritDoc} */ @Override public R get() throws IgniteCheckedException; @@ -146,8 +146,8 @@ public interface SchedulerFuture<R> extends IgniteInternalFuture<R> { * @param timeout {@inheritDoc} * @return The computed result of the next execution. * @throws CancellationException {@inheritDoc} - * @throws org.apache.ignite.IgniteInterruptedException {@inheritDoc} - * @throws org.apache.ignite.lang.IgniteFutureTimeoutException {@inheritDoc} + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException {@inheritDoc} + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException {@inheritDoc} * @throws IgniteCheckedException {@inheritDoc} */ @Override public R get(long timeout) throws IgniteCheckedException; @@ -160,8 +160,8 @@ public interface SchedulerFuture<R> extends IgniteInternalFuture<R> { * @param unit {@inheritDoc} * @return The computed result of the next execution. * @throws CancellationException {@inheritDoc} - * @throws org.apache.ignite.IgniteInterruptedException {@inheritDoc} - * @throws org.apache.ignite.lang.IgniteFutureTimeoutException {@inheritDoc} + * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException {@inheritDoc} + * @throws org.apache.ignite.internal.IgniteFutureTimeoutCheckedException {@inheritDoc} * @throws IgniteCheckedException {@inheritDoc} */ @Override public R get(long timeout, TimeUnit unit) throws IgniteCheckedException; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java index 4e9369a..7bbcd18 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; @@ -1534,7 +1535,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter if (log.isDebugEnabled()) log.debug("Context has been initialized."); } - catch (IgniteInterruptedException e) { + catch (IgniteInterruptedCheckedException e) { U.warn(log, "Thread has been interrupted while waiting for SPI context initialization.", e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/52440dfb/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java index 5fc0dd8..c4f71ad 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java @@ -20,6 +20,7 @@ package org.apache.ignite.spi.discovery.tcp; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; +import org.apache.ignite.internal.*; import org.apache.ignite.lang.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; @@ -495,7 +496,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp U.closeQuiet(sock); } } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { if (log.isDebugEnabled()) log.debug("Joining thread was interrupted."); @@ -518,7 +519,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp U.sleep(2000); } } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { if (log.isDebugEnabled()) log.debug("Joining thread was interrupted."); } @@ -617,7 +618,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp } } } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { if (log.isDebugEnabled()) log.debug("Disconnect handler was interrupted."); @@ -663,7 +664,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp sockRdr.addMessage(msg); } } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { if (log.isDebugEnabled()) log.debug("Heartbeat sender was interrupted."); } @@ -785,7 +786,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp try { U.join(msgWrk); } - catch (IgniteInterruptedException ignored) { + catch (IgniteInterruptedCheckedException ignored) { // No-op. }