# ignite-26
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/724ba118 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/724ba118 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/724ba118 Branch: refs/heads/sprint-1 Commit: 724ba118f87aed5cab0af95afd4425c21688a223 Parents: 8ababa7 Author: sboikov <[email protected]> Authored: Sat Jan 31 17:01:10 2015 +0300 Committer: sboikov <[email protected]> Committed: Sat Jan 31 17:01:11 2015 +0300 ---------------------------------------------------------------------- .../ignite/client/router/GridRouterFactory.java | 7 ++- .../impl/GridRouterCommandLineStartup.java | 18 +++---- .../client/router/impl/GridTcpRouterImpl.java | 14 +++--- .../ignite/internal/GridJobSessionImpl.java | 4 +- .../apache/ignite/internal/GridLoggerProxy.java | 7 +-- .../managers/deployment/GridDeployment.java | 1 - .../processors/cache/CacheInvokeResult.java | 2 - .../processors/cache/GridCacheAdapter.java | 11 +++-- .../cache/GridCacheLoaderWriterStore.java | 4 +- .../processors/cache/GridCacheStoreManager.java | 23 +++++---- .../cache/GridCacheWriteBehindStore.java | 6 +-- .../GridCacheDataStructuresManager.java | 4 +- .../datastructures/GridCacheQueueAdapter.java | 2 +- .../dht/GridDhtTransactionalCacheAdapter.java | 7 +-- .../distributed/dht/GridDhtTxFinishFuture.java | 6 +-- .../cache/distributed/dht/GridDhtTxLocal.java | 23 ++++----- .../dht/atomic/GridDhtAtomicCache.java | 4 +- .../near/GridNearTransactionalCache.java | 3 +- .../near/GridNearTxFinishFuture.java | 6 +-- .../cache/distributed/near/GridNearTxLocal.java | 19 ++++---- .../near/GridNearTxPrepareFuture.java | 14 +++--- .../cache/local/GridLocalTxFuture.java | 16 +++--- .../local/atomic/GridLocalAtomicCache.java | 4 +- .../cache/transactions/IgniteTxAdapter.java | 4 +- .../cache/transactions/IgniteTxEx.java | 7 +-- .../cache/transactions/IgniteTxHandler.java | 20 ++++---- .../transactions/IgniteTxLocalAdapter.java | 19 ++++---- .../cache/transactions/IgniteTxManager.java | 15 +++--- .../cache/transactions/IgniteTxProxyImpl.java | 16 +++++- .../processors/task/GridTaskProcessor.java | 6 +-- .../processors/task/GridTaskWorker.java | 2 +- .../IgniteTxHeuristicCheckedException.java | 51 ++++++++++++++++++++ .../IgniteTxOptimisticCheckedException.java | 47 ++++++++++++++++++ .../IgniteTxRollbackCheckedException.java | 47 ++++++++++++++++++ .../IgniteTxTimeoutCheckedException.java | 47 ++++++++++++++++++ .../ignite/internal/util/IgniteUtils.java | 27 ++++++++--- .../util/future/GridCompoundFuture.java | 4 +- .../apache/ignite/lifecycle/LifecycleAware.java | 8 +-- .../window/StreamerBoundedSizeBatchWindow.java | 6 +-- .../StreamerBoundedSizeWindowAdapter.java | 4 +- .../window/StreamerBoundedTimeBatchWindow.java | 8 +-- .../window/StreamerBoundedTimeWindow.java | 6 +-- .../streamer/window/StreamerWindowAdapter.java | 6 +-- .../apache/ignite/transactions/IgniteTx.java | 4 +- .../IgniteTxHeuristicException.java | 24 +++------ .../IgniteTxOptimisticException.java | 24 +++------ .../transactions/IgniteTxRollbackException.java | 24 +++------ .../transactions/IgniteTxTimeoutException.java | 24 +++------ .../GridFailoverTaskWithPredicateSelfTest.java | 6 +-- .../internal/GridLifecycleAwareSelfTest.java | 8 +-- .../internal/GridTaskTimeoutSelfTest.java | 2 +- .../GridCacheGroupLockAbstractSelfTest.java | 1 + .../cache/GridCacheLifecycleAwareSelfTest.java | 4 +- .../processors/cache/GridCacheTestStore.java | 7 ++- .../GridCacheVariableTopologySelfTest.java | 3 +- .../processors/cache/IgniteTxAbstractTest.java | 5 +- .../IgniteTxExceptionAbstractSelfTest.java | 11 +++-- .../IgniteTxMultiThreadedAbstractTest.java | 3 +- .../IgniteTxStoreExceptionAbstractSelfTest.java | 15 +++--- .../GridCacheAbstractNodeRestartSelfTest.java | 3 +- .../GridCacheNodeFailureAbstractTest.java | 4 +- .../IgniteTxTimeoutAbstractTest.java | 3 +- .../near/GridCacheNearMultiGetSelfTest.java | 3 +- .../GridCacheReplicatedInvalidateSelfTest.java | 3 +- .../IgniteCacheLoaderWriterAbstractTest.java | 8 +-- .../local/GridCacheLocalTxTimeoutSelfTest.java | 5 +- .../closure/GridClosureProcessorSelfTest.java | 2 +- .../processors/fs/GridGgfsAbstractSelfTest.java | 4 +- .../processors/fs/GridGgfsModesSelfTest.java | 4 +- .../fs/GridGgfsProcessorSelfTest.java | 2 +- ...idHibernateL2CacheTransactionalSelfTest.java | 2 +- .../apache/ignite/cache/jta/CacheTmLookup.java | 4 +- .../cache/jta/jndi/CacheJndiTmLookup.java | 4 +- .../jta/reflect/CacheReflectionTmLookup.java | 8 +-- .../processors/cache/jta/CacheJtaManager.java | 10 +++- ...CacheJtaConfigurationValidationSelfTest.java | 3 +- .../processors/cache/GridCacheJtaSelfTest.java | 2 +- .../GridTmLookupLifecycleAwareSelfTest.java | 2 +- .../ignite/internal/GridFactorySelfTest.java | 2 +- .../resource/GridServiceInjectionSelfTest.java | 4 +- 80 files changed, 517 insertions(+), 285 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/client/router/GridRouterFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/client/router/GridRouterFactory.java b/modules/core/src/main/java/org/apache/ignite/client/router/GridRouterFactory.java index 4d44c2f..78b22a2 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/router/GridRouterFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/client/router/GridRouterFactory.java @@ -66,7 +66,12 @@ public final class GridRouterFactory { public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg) throws IgniteCheckedException { GridTcpRouterImpl router = new GridTcpRouterImpl(cfg); - router.start(); + try { + router.start(); + } + catch (Exception e) { + throw new IgniteCheckedException("Failed to start router: " + e, e); + } GridTcpRouterImpl old = tcpRouters.putIfAbsent(router.id(), router); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterCommandLineStartup.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterCommandLineStartup.java b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterCommandLineStartup.java index 255e563..549faeb 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterCommandLineStartup.java +++ b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridRouterCommandLineStartup.java @@ -64,15 +64,13 @@ public class GridRouterCommandLineStartup { else { tcpRouter = new GridTcpRouterImpl(tcpCfg); - if (tcpRouter != null) { - try { - tcpRouter.start(); - } - catch (IgniteCheckedException e) { - U.error(log, "Failed to start TCP router on port " + tcpCfg.getPort() + ": " + e.getMessage(), e); - - tcpRouter = null; - } + try { + tcpRouter.start(); + } + catch (Exception e) { + U.error(log, "Failed to start TCP router on port " + tcpCfg.getPort() + ": " + e.getMessage(), e); + + tcpRouter = null; } } } @@ -85,7 +83,7 @@ public class GridRouterCommandLineStartup { try { tcpRouter.stop(); } - catch (IgniteCheckedException e) { + catch (Exception e) { U.error(log, "Error while stopping the router.", e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterImpl.java b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterImpl.java index e0539b3..7150103 100644 --- a/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/client/router/impl/GridTcpRouterImpl.java @@ -86,14 +86,14 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif /** * Starts router. * - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - @Override public void start() throws IgniteCheckedException { + @Override public void start() throws IgniteException { try { client = createClient(cfg); } catch (GridClientException e) { - throw new IgniteCheckedException("Failed to initialise embedded client.", e); + throw new IgniteException("Failed to initialise embedded client.", e); } GridNioServerListener<GridClientMessage> lsnr; @@ -111,7 +111,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif lsnr = new GridTcpRouterNioListenerOsImpl(log, client); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { - throw new IgniteCheckedException("Failed to create NIO listener.", e); + throw new IgniteException("Failed to create NIO listener.", e); } parser = new GridTcpRouterNioParser(); @@ -122,7 +122,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif hostAddr = InetAddress.getByName(cfg.getHost()); } catch (UnknownHostException e) { - throw new IgniteCheckedException("Failed to resolve grid address for configured host: " + cfg.getHost(), e); + throw new IgniteException("Failed to resolve grid address for configured host: " + cfg.getHost(), e); } SSLContext sslCtx; @@ -133,7 +133,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif sslCtx = sslCtxFactory == null ? null : sslCtxFactory.createSslContext(); } catch (SSLException e) { - throw new IgniteCheckedException("Failed to create SSL context.", e); + throw new IgniteException("Failed to create SSL context.", e); } for (int port = cfg.getPort(), last = port + cfg.getPortRange(); port <= last; port++) { @@ -153,7 +153,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif } if (bindPort == 0) - throw new IgniteCheckedException("Failed to bind TCP router server (possibly all ports in range " + + throw new IgniteException("Failed to bind TCP router server (possibly all ports in range " + "are in use) [firstPort=" + cfg.getPort() + ", lastPort=" + (cfg.getPort() + cfg.getPortRange()) + ", addr=" + hostAddr + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/GridJobSessionImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSessionImpl.java index 5b7e590..ef90408 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSessionImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSessionImpl.java @@ -143,7 +143,7 @@ public class GridJobSessionImpl implements GridTaskSessionInternal { if (!ses.isFullSupport()) { // Need to fetch task session from task worker. - ComputeTaskFuture<Object> fut = ctx.task().taskFuture(ses.getId()); + ComputeTaskInternalFuture<Object> fut = ctx.task().taskFuture(ses.getId()); return fut.getTaskSession().getJobSiblings(); } @@ -160,7 +160,7 @@ public class GridJobSessionImpl implements GridTaskSessionInternal { assert !ses.isFullSupport(); // Need to fetch task session from task worker. - ComputeTaskFuture<Object> fut = ctx.task().taskFuture(ses.getId()); + ComputeTaskInternalFuture<Object> fut = ctx.task().taskFuture(ses.getId()); return fut.getTaskSession().getJobSiblings(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java index d12553c..42ddc8d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridLoggerProxy.java @@ -85,12 +85,13 @@ public class GridLoggerProxy implements IgniteLogger, LifecycleAware, Externaliz } /** {@inheritDoc} */ - @Override public void start() throws IgniteCheckedException { - U.startLifecycleAware(Collections.singleton(impl)); + @Override public void start() { + if (impl instanceof LifecycleAware) + ((LifecycleAware)impl).start(); } /** {@inheritDoc} */ - @Override public void stop() throws IgniteCheckedException { + @Override public void stop() { U.stopLifecycleAware(this, Collections.singleton(impl)); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeployment.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeployment.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeployment.java index 3e39c5f..6689e7c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeployment.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeployment.java @@ -359,7 +359,6 @@ public class GridDeployment extends GridMetadataAwareAdapter implements GridDepl */ @SuppressWarnings("unchecked") public boolean internalTask(@Nullable ComputeTask task, Class<?> taskCls) { - assert task != null; assert taskCls != null; Boolean res = internalTasks.get(taskCls); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java index d720f83..6e4b953 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java @@ -53,8 +53,6 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externaliz * @param res Computed result. */ public CacheInvokeResult(T res) { - assert res != null; - this.res = res; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java index cba4488..df03333 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java @@ -29,6 +29,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.compute.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.mxbean.*; @@ -2323,13 +2324,15 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, Map<K, EntryProcessorResult<T>> resMap = fut.get().value(); + EntryProcessorResult<T> res = null; + if (resMap != null) { assert resMap.isEmpty() || resMap.size() == 1 : resMap.size(); - return resMap.isEmpty() ? null : resMap.values().iterator().next(); + res = resMap.isEmpty() ? null : resMap.values().iterator().next(); } - return null; + return res != null ? res : new CacheInvokeResult<T>((T)null); } }); } @@ -4182,14 +4185,14 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, return t; } - catch (IgniteInterruptedCheckedException | IgniteTxHeuristicException | IgniteTxRollbackException e) { + catch (IgniteInterruptedCheckedException | IgniteTxHeuristicCheckedException | IgniteTxRollbackCheckedException e) { throw e; } catch (IgniteCheckedException e) { try { tx.rollback(); - e = new IgniteTxRollbackException("Transaction has been rolled back: " + + e = new IgniteTxRollbackCheckedException("Transaction has been rolled back: " + tx.xid(), e); } catch (IgniteCheckedException | AssertionError | RuntimeException e1) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java index 6f60520..b43828f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheLoaderWriterStore.java @@ -63,7 +63,7 @@ class GridCacheLoaderWriterStore<K, V> extends CacheStore<K, V> implements Lifec } /** {@inheritDoc} */ - @Override public void start() throws IgniteCheckedException { + @Override public void start() { if (ldr instanceof LifecycleAware) ((LifecycleAware)ldr).start(); @@ -72,7 +72,7 @@ class GridCacheLoaderWriterStore<K, V> extends CacheStore<K, V> implements Lifec } /** {@inheritDoc} */ - @Override public void stop() throws IgniteCheckedException { + @Override public void stop() { if (ldr instanceof LifecycleAware) ((LifecycleAware)ldr).stop(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java index 9cb78d7..467567f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java @@ -167,14 +167,19 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { /** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { if (store instanceof LifecycleAware) { - // Avoid second start() call on store in case when near cache is enabled. - if (cctx.config().isWriteBehindEnabled()) { - if (!cctx.isNear()) - ((LifecycleAware)store).start(); + try { + // Avoid second start() call on store in case when near cache is enabled. + if (cctx.config().isWriteBehindEnabled()) { + if (!cctx.isNear()) + ((LifecycleAware)store).start(); + } + else { + if (cctx.isNear() || !CU.isNearEnabled(cctx)) + ((LifecycleAware)store).start(); + } } - else { - if (cctx.isNear() || !CU.isNearEnabled(cctx)) - ((LifecycleAware)store).start(); + catch (Exception e) { + throw new IgniteCheckedException("Failed to start cache store: " + e, e); } } @@ -187,7 +192,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { this.convertPortable = convertPortable; } else if (convertPortable) - U.warn(log, "GridCacheConfiguration.isKeepPortableInStore() configuration property will " + + U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property will " + "be ignored because portable mode is not enabled for cache: " + cctx.namex()); } @@ -205,7 +210,7 @@ public class GridCacheStoreManager<K, V> extends GridCacheManagerAdapter<K, V> { ((LifecycleAware)store).stop(); } } - catch (IgniteCheckedException e) { + catch (Exception e) { U.error(log(), "Failed to stop cache store.", e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java index 8b44d3a..cd85280 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheWriteBehindStore.java @@ -262,7 +262,7 @@ public class GridCacheWriteBehindStore<K, V> extends CacheStore<K, V> implements * * @throws IgniteCheckedException If cache cannot be started due to some reasons. */ - @Override public void start() throws IgniteCheckedException { + @Override public void start() { assert cacheFlushFreq != 0 || cacheMaxSize != 0; if (stopping.compareAndSet(true, false)) { @@ -340,10 +340,8 @@ public class GridCacheWriteBehindStore<K, V> extends CacheStore<K, V> implements /** * Performs shutdown logic for store. No put, get and remove requests will be processed after * this method is called. - * - * @throws IgniteCheckedException If shutdown failed for some reason. */ - @Override public void stop() throws IgniteCheckedException { + @Override public void stop() { if (stopping.compareAndSet(false, true)) { if (log.isDebugEnabled()) log.debug("Stopping write-behind store for cache '" + cacheName + '\''); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheDataStructuresManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheDataStructuresManager.java index cab9a2f..593459f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheDataStructuresManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheDataStructuresManager.java @@ -24,10 +24,10 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.resources.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.query.continuous.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.processors.task.*; @@ -1332,7 +1332,7 @@ public final class GridCacheDataStructuresManager<K, V> extends GridCacheManager catch (ClusterGroupEmptyCheckedException e) { throw new IgniteException(e); } - catch (IgniteTxRollbackException | CachePartialUpdateCheckedException | ClusterTopologyCheckedException e) { + catch (IgniteTxRollbackCheckedException | CachePartialUpdateCheckedException | ClusterTopologyCheckedException e) { if (cnt++ == MAX_UPDATE_RETRIES) throw e; else { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueAdapter.java index 870d9b2..2565354 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueAdapter.java @@ -340,7 +340,7 @@ public abstract class GridCacheQueueAdapter<T> extends AbstractCollection<T> imp A.ensure(batchSize >= 0, "Batch size cannot be negative: " + batchSize); try { - IgniteBiTuple<Long, Long> t = (IgniteBiTuple<Long, Long>)cache.invoke(queueKey, new ClearProcessor(id)); + IgniteBiTuple<Long, Long> t = (IgniteBiTuple<Long, Long>)cache.invoke(queueKey, new ClearProcessor(id)).get(); if (t == null) return; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java index 5b0335d..c6474ed 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java @@ -25,6 +25,7 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; @@ -215,7 +216,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach tx = ctx.tm().onCreated(tx); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Failed to acquire lock (transaction " + + throw new IgniteTxRollbackCheckedException("Failed to acquire lock (transaction " + "has been completed) [ver=" + req.version() + ", tx=" + tx + ']'); } @@ -404,13 +405,13 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach } } } - catch (IgniteTxRollbackException e) { + catch (IgniteTxRollbackCheckedException e) { String err = "Failed processing DHT lock request (transaction has been completed): " + req; U.error(log, err, e); res = new GridDhtLockResponse<>(ctx.cacheId(), req.version(), req.futureId(), req.miniId(), - new IgniteTxRollbackException(err, e)); + new IgniteTxRollbackCheckedException(err, e)); fail = true; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java index c88604b..fbb2a69 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java @@ -24,8 +24,8 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -167,7 +167,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur if (err.compareAndSet(null, e)) { boolean marked = tx.setRollbackOnly(); - if (e instanceof IgniteTxRollbackException) { + if (e instanceof IgniteTxRollbackCheckedException) { if (marked) { try { tx.rollback(); @@ -183,7 +183,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur try { get(); } - catch (IgniteTxHeuristicException ignore) { + catch (IgniteTxHeuristicCheckedException ignore) { // Future should complete with GridCacheTxHeuristicException. } catch (IgniteCheckedException err) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java index 55b63a5..ec71035 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java @@ -23,6 +23,7 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; @@ -301,13 +302,13 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements if (!state(PREPARING)) { if (setRollbackOnly()) { if (timedOut()) - fut.onError(new IgniteTxTimeoutException("Transaction timed out and was rolled back: " + this)); + fut.onError(new IgniteTxTimeoutCheckedException("Transaction timed out and was rolled back: " + this)); else fut.onError(new IgniteCheckedException("Invalid transaction state for prepare [state=" + state() + ", tx=" + this + ']')); } else - fut.onError(new IgniteTxRollbackException("Invalid transaction state for prepare [state=" + state() + fut.onError(new IgniteTxRollbackCheckedException("Invalid transaction state for prepare [state=" + state() + ", tx=" + this + ']')); return fut; @@ -390,14 +391,14 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements fut.complete(); if (setRollbackOnly()) { if (timedOut()) - fut.onError(new IgniteTxTimeoutException("Transaction timed out and was rolled back: " + + fut.onError(new IgniteTxTimeoutCheckedException("Transaction timed out and was rolled back: " + this)); else fut.onError(new IgniteCheckedException("Invalid transaction state for prepare [state=" + state() + ", tx=" + this + ']')); } else - fut.onError(new IgniteTxRollbackException("Invalid transaction state for prepare [state=" + + fut.onError(new IgniteTxRollbackCheckedException("Invalid transaction state for prepare [state=" + state() + ", tx=" + this + ']')); return fut; @@ -423,18 +424,18 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements else fut.prepare(reads, writes, txNodes); } - catch (IgniteTxTimeoutException | IgniteTxOptimisticException e) { + catch (IgniteTxTimeoutCheckedException | IgniteTxOptimisticCheckedException e) { fut.onError(e); } catch (IgniteCheckedException e) { setRollbackOnly(); - fut.onError(new IgniteTxRollbackException("Failed to prepare transaction: " + this, e)); + fut.onError(new IgniteTxRollbackCheckedException("Failed to prepare transaction: " + this, e)); try { rollback(); } - catch (IgniteTxOptimisticException e1) { + catch (IgniteTxOptimisticCheckedException e1) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e1 + ']'); @@ -474,7 +475,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements else fut.onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(this))); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed to optimistically prepare transaction [tx=" + this + ", e=" + e + ']'); @@ -498,7 +499,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements fut.onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(GridDhtTxLocal.this))); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e + ']'); @@ -521,7 +522,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements else fut.onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(this))); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e + ']'); @@ -559,7 +560,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> implements else fut.onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(this))); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index 4fa079f..b2e6d5e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -617,7 +617,9 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { /** {@inheritDoc} */ @Override public <T> EntryProcessorResult<T> invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args) throws IgniteCheckedException { - return invokeAsync(key, entryProcessor, args).get(); + EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get(); + + return res != null ? res : new CacheInvokeResult<>((T)null); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java index d790ac3..518dd2d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java @@ -24,6 +24,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; import org.apache.ignite.transactions.*; @@ -309,7 +310,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V> tx = ctx.tm().onCreated(tx); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Failed to acquire lock " + + throw new IgniteTxRollbackCheckedException("Failed to acquire lock " + "(transaction has been completed): " + req.version()); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java index cc352f4..8b7d340 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java @@ -24,8 +24,8 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -171,7 +171,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu if (err.compareAndSet(null, e)) { boolean marked = tx.setRollbackOnly(); - if (e instanceof IgniteTxRollbackException) { + if (e instanceof IgniteTxRollbackCheckedException) { if (marked) { try { tx.rollback(); @@ -222,7 +222,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu Throwable th = this.err.get(); if (super.onDone(tx, th != null ? th : err)) { - if (error() instanceof IgniteTxHeuristicException) { + if (error() instanceof IgniteTxHeuristicCheckedException) { long topVer = this.tx.topologyVersion(); for (IgniteTxEntry<K, V> e : this.tx.writeMap().values()) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java index 95f7593..e39d67f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java @@ -23,6 +23,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.managers.discovery.*; @@ -719,14 +720,14 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { if (!state(PREPARING)) { if (setRollbackOnly()) { if (timedOut()) - pessimisticFut.onError(new IgniteTxTimeoutException("Transaction timed out and was " + + pessimisticFut.onError(new IgniteTxTimeoutCheckedException("Transaction timed out and was " + "rolled back: " + this)); else pessimisticFut.onError(new IgniteCheckedException("Invalid transaction state for prepare [state=" + state() + ", tx=" + this + ']')); } else - pessimisticFut.onError(new IgniteTxRollbackException("Invalid transaction state for prepare " + + pessimisticFut.onError(new IgniteTxRollbackCheckedException("Invalid transaction state for prepare " + "[state=" + state() + ", tx=" + this + ']')); return fut; @@ -898,7 +899,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { if (state() != PREPARING) { if (timedOut()) return new GridFinishedFuture<>(cctx.kernalContext(), - new IgniteTxTimeoutException("Transaction timed out: " + this)); + new IgniteTxTimeoutCheckedException("Transaction timed out: " + this)); setRollbackOnly(); @@ -926,18 +927,18 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { else fut.prepare(reads, writes, txNodes); } - catch (IgniteTxTimeoutException | IgniteTxOptimisticException e) { + catch (IgniteTxTimeoutCheckedException | IgniteTxOptimisticCheckedException e) { fut.onError(e); } catch (IgniteCheckedException e) { setRollbackOnly(); - fut.onError(new IgniteTxRollbackException("Failed to prepare transaction: " + this, e)); + fut.onError(new IgniteTxRollbackCheckedException("Failed to prepare transaction: " + this, e)); try { rollback(); } - catch (IgniteTxOptimisticException e1) { + catch (IgniteTxOptimisticCheckedException e1) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e1 + ']'); @@ -987,7 +988,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { fut.finish(); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e + ']'); @@ -1007,7 +1008,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { fut.finish(); } - catch (IgniteTxOptimisticException e) { + catch (IgniteTxOptimisticCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed optimistically to prepare transaction [tx=" + this + ", e=" + e + ']'); @@ -1274,7 +1275,7 @@ public class GridNearTxLocal<K, V> extends GridDhtTxLocalAdapter<K, V> { void onError(Throwable e) { boolean marked = tx.setRollbackOnly(); - if (e instanceof IgniteTxRollbackException) { + if (e instanceof IgniteTxRollbackCheckedException) { if (marked) { try { tx.rollback(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java index bb6ad9b..134a8ff 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java @@ -24,8 +24,8 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.transactions.*; @@ -190,12 +190,12 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut if (err.compareAndSet(null, e)) { boolean marked = tx.setRollbackOnly(); - if (e instanceof IgniteTxOptimisticException) { + if (e instanceof IgniteTxOptimisticCheckedException) { assert nodeId != null : "Missing node ID for optimistic failure exception: " + e; tx.removeKeysMapping(nodeId, mappings); } - if (e instanceof IgniteTxRollbackException) { + if (e instanceof IgniteTxRollbackCheckedException) { if (marked) { try { tx.rollback(); @@ -334,14 +334,14 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut if (!tx.state(PREPARING)) { if (tx.setRollbackOnly()) { if (tx.timedOut()) - onError(null, null, new IgniteTxTimeoutException("Transaction timed out and " + + onError(null, null, new IgniteTxTimeoutCheckedException("Transaction timed out and " + "was rolled back: " + this)); else onError(null, null, new IgniteCheckedException("Invalid transaction state for prepare " + "[state=" + tx.state() + ", tx=" + this + ']')); } else - onError(null, null, new IgniteTxRollbackException("Invalid transaction state for " + + onError(null, null, new IgniteTxRollbackCheckedException("Invalid transaction state for " + "prepare [state=" + tx.state() + ", tx=" + this + ']')); return; @@ -357,7 +357,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut prepare0(); } - catch (IgniteTxTimeoutException | IgniteTxOptimisticException e) { + catch (IgniteTxTimeoutCheckedException | IgniteTxOptimisticCheckedException e) { onError(cctx.localNodeId(), null, e); } catch (IgniteCheckedException e) { @@ -369,7 +369,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut tx.rollbackAsync(); - onError(null, null, new IgniteTxRollbackException(msg, e)); + onError(null, null, new IgniteTxRollbackCheckedException(msg, e)); } } else { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTxFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTxFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTxFuture.java index da35d9c..552e7c0 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTxFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalTxFuture.java @@ -21,8 +21,8 @@ import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.future.*; @@ -154,7 +154,7 @@ final class GridLocalTxFuture<K, V> extends GridFutureAdapter<IgniteTxEx<K, V>> * @param e Error. */ @SuppressWarnings({"TypeMayBeWeakened"}) - void onError(IgniteTxOptimisticException e) { + void onError(IgniteTxOptimisticCheckedException e) { if (err.compareAndSet(null, e)) { tx.setRollbackOnly(); @@ -166,7 +166,7 @@ final class GridLocalTxFuture<K, V> extends GridFutureAdapter<IgniteTxEx<K, V>> * @param e Error. */ @SuppressWarnings({"TypeMayBeWeakened"}) - void onError(IgniteTxRollbackException e) { + void onError(IgniteTxRollbackCheckedException e) { if (err.compareAndSet(null, e)) { // Attempt rollback. if (tx.setRollbackOnly()) { @@ -193,7 +193,7 @@ final class GridLocalTxFuture<K, V> extends GridFutureAdapter<IgniteTxEx<K, V>> GridCacheEntryEx<K, V> entry = txEntry.cached(); if (entry == null) { - onError(new IgniteTxRollbackException("Failed to find cache entry for " + + onError(new IgniteTxRollbackCheckedException("Failed to find cache entry for " + "transaction key (will rollback) [key=" + txEntry.key() + ", tx=" + tx + ']')); break; @@ -242,7 +242,7 @@ final class GridLocalTxFuture<K, V> extends GridFutureAdapter<IgniteTxEx<K, V>> GridCacheEntryEx<K,V> cached = txEntry.cached(); if (entry == null) { - onError(new IgniteTxRollbackException("Failed to find cache entry for " + + onError(new IgniteTxRollbackCheckedException("Failed to find cache entry for " + "transaction key (will rollback) [key=" + txEntry.key() + ", tx=" + tx + ']')); return true; @@ -285,17 +285,17 @@ final class GridLocalTxFuture<K, V> extends GridFutureAdapter<IgniteTxEx<K, V>> onComplete(); } - catch (IgniteTxTimeoutException e) { + catch (IgniteTxTimeoutCheckedException e) { onError(e); } catch (IgniteCheckedException e) { if (tx.state() == UNKNOWN) { - onError(new IgniteTxHeuristicException("Commit only partially succeeded " + + onError(new IgniteTxHeuristicCheckedException("Commit only partially succeeded " + "(entries will be invalidated on remote nodes once transaction timeout passes): " + tx, e)); } else { - onError(new IgniteTxRollbackException( + onError(new IgniteTxRollbackCheckedException( "Failed to commit transaction (will attempt rollback): " + tx, e)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java index 75f8ae8..80a3a37 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java @@ -663,7 +663,9 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> { @Override public <T> EntryProcessorResult<T> invoke(K key, EntryProcessor<K, V, T> entryProcessor, Object... args) throws IgniteCheckedException { - return invokeAsync(key, entryProcessor, args).get(); + EntryProcessorResult<T> res = invokeAsync(key, entryProcessor, args).get(); + + return res != null ? res : new CacheInvokeResult<>((T)null); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index 6b8c9ed..48baf09 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -22,6 +22,7 @@ import org.apache.ignite.cluster.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; @@ -204,6 +205,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter protected boolean storeEnabled = true; /** */ + @GridToStringExclude private IgniteTxProxyImpl proxy; /** @@ -1967,7 +1969,7 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter } /** {@inheritDoc} */ - @Override public long remainingTime() throws IgniteTxTimeoutException { + @Override public long remainingTime() throws IgniteTxTimeoutCheckedException { return 0; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java index 1bddf07..f9aab18 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEx.java @@ -22,6 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.timeout.*; @@ -126,7 +127,7 @@ public interface IgniteTxEx<K, V> extends AutoCloseable, GridTimeoutObject { /** * Gets timeout value in milliseconds for this transaction. If transaction times - * out prior to it's completion, {@link IgniteTxTimeoutException} will be thrown. + * out prior to it's completion, {@link org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException} will be thrown. * * @return Transaction timeout value. */ @@ -660,9 +661,9 @@ public interface IgniteTxEx<K, V> extends AutoCloseable, GridTimeoutObject { * Gets allowed remaining time for this transaction. * * @return Remaining time. - * @throws IgniteTxTimeoutException If transaction timed out. + * @throws org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException If transaction timed out. */ - public long remainingTime() throws IgniteTxTimeoutException; + public long remainingTime() throws IgniteTxTimeoutCheckedException; /** * @return Alternate transaction versions. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java index 07b8839..4cceb7f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java @@ -24,8 +24,8 @@ import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; -import org.apache.ignite.transactions.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.near.*; import org.apache.ignite.internal.util.future.*; @@ -204,7 +204,7 @@ public class IgniteTxHandler<K, V> { if (tx != null) tx.setRollbackOnly(); // Just in case. - if (!(e instanceof IgniteTxOptimisticException)) + if (!(e instanceof IgniteTxOptimisticCheckedException)) U.error(log, "Failed to prepare DHT transaction: " + tx, e); } @@ -308,7 +308,7 @@ public class IgniteTxHandler<K, V> { catch (IgniteCheckedException e) { tx0.setRollbackOnly(); // Just in case. - if (!(e instanceof IgniteTxOptimisticException)) + if (!(e instanceof IgniteTxOptimisticCheckedException)) U.error(log, "Failed to prepare DHT transaction: " + tx0, e); } } @@ -530,7 +530,7 @@ public class IgniteTxHandler<K, V> { req.taskNameHash())); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Attempt to start a completed transaction: " + req); + throw new IgniteTxRollbackCheckedException("Attempt to start a completed transaction: " + req); tx.topologyVersion(req.topologyVersion()); } @@ -666,9 +666,9 @@ public class IgniteTxHandler<K, V> { res.invalidPartitions(dhtTx.invalidPartitions()); } catch (IgniteCheckedException e) { - if (e instanceof IgniteTxRollbackException) + if (e instanceof IgniteTxRollbackCheckedException) U.error(log, "Transaction was rolled back before prepare completed: " + dhtTx, e); - else if (e instanceof IgniteTxOptimisticException) { + else if (e instanceof IgniteTxOptimisticCheckedException) { if (log.isDebugEnabled()) log.debug("Optimistic failure for remote transaction (will rollback): " + dhtTx); } @@ -745,7 +745,7 @@ public class IgniteTxHandler<K, V> { nearTx.syncRollback(req.syncRollback()); } } - catch (IgniteTxRollbackException e) { + catch (IgniteTxRollbackCheckedException e) { if (log.isDebugEnabled()) log.debug("Received finish request for completed transaction (will ignore) [req=" + req + ", err=" + e.getMessage() + ']'); @@ -1066,7 +1066,7 @@ public class IgniteTxHandler<K, V> { tx = ctx.tm().onCreated(tx); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Attempt to start a completed transaction: " + tx); + throw new IgniteTxRollbackCheckedException("Attempt to start a completed transaction: " + tx); } } else @@ -1155,7 +1155,7 @@ public class IgniteTxHandler<K, V> { tx = ctx.tm().onCreated(tx); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Failed to acquire lock " + + throw new IgniteTxRollbackCheckedException("Failed to acquire lock " + "(transaction has been completed): " + req.version()); } @@ -1302,7 +1302,7 @@ public class IgniteTxHandler<K, V> { tx = ctx.tm().onCreated(tx); if (tx == null || !ctx.tm().onStarted(tx)) - throw new IgniteTxRollbackException("Failed to acquire lock " + + throw new IgniteTxRollbackCheckedException("Failed to acquire lock " + "(transaction has been completed): " + req.version()); if (!marked) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java index 338a9d1..d110543 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java @@ -22,6 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.security.*; @@ -362,7 +363,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> public void userPrepare() throws IgniteCheckedException { if (state() != PREPARING) { if (timedOut()) - throw new IgniteTxTimeoutException("Transaction timed out: " + this); + throw new IgniteTxTimeoutCheckedException("Transaction timed out: " + this); IgniteTxState state = state(); @@ -630,7 +631,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> if (state != COMMITTING) { if (timedOut()) - throw new IgniteTxTimeoutException("Transaction timed out: " + this); + throw new IgniteTxTimeoutCheckedException("Transaction timed out: " + this); setRollbackOnly(); @@ -925,7 +926,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> throw ex; } else { - IgniteCheckedException err = new IgniteTxHeuristicException("Failed to locally write to cache " + + IgniteCheckedException err = new IgniteTxHeuristicCheckedException("Failed to locally write to cache " + "(all transaction entries will be invalidated, however there was a window when " + "entries for this transaction were visible to others): " + this, ex); @@ -3055,23 +3056,23 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> protected void checkValid() throws IgniteCheckedException { if (isRollbackOnly()) { if (timedOut()) - throw new IgniteTxTimeoutException("Cache transaction timed out: " + this); + throw new IgniteTxTimeoutCheckedException("Cache transaction timed out: " + this); IgniteTxState state = state(); if (state == ROLLING_BACK || state == ROLLED_BACK) - throw new IgniteTxRollbackException("Cache transaction is marked as rollback-only " + + throw new IgniteTxRollbackCheckedException("Cache transaction is marked as rollback-only " + "(will be rolled back automatically): " + this); if (state == UNKNOWN) - throw new IgniteTxHeuristicException("Cache transaction is in unknown state " + + throw new IgniteTxHeuristicCheckedException("Cache transaction is in unknown state " + "(remote transactions will be invalidated): " + this); throw new IgniteCheckedException("Cache transaction marked as rollback-only: " + this); } if (remainingTime() == 0 && setRollbackOnly()) - throw new IgniteTxTimeoutException("Cache transaction timed out " + + throw new IgniteTxTimeoutCheckedException("Cache transaction timed out " + "(was rolled back automatically): " + this); } @@ -3432,7 +3433,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> if (!locked) { setRollbackOnly(); - final GridClosureException ex = new GridClosureException(new IgniteTxTimeoutException("Failed to " + + final GridClosureException ex = new GridClosureException(new IgniteTxTimeoutCheckedException("Failed to " + "acquire lock within provided timeout for transaction [timeout=" + timeout() + ", tx=" + this + ']')); @@ -3512,7 +3513,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends IgniteTxAdapter<K, V> throw new GridClosureException(e); if (!locked) - throw new GridClosureException(new IgniteTxTimeoutException("Failed to acquire lock " + + throw new GridClosureException(new IgniteTxTimeoutCheckedException("Failed to acquire lock " + "within provided timeout for transaction [timeout=" + timeout() + ", tx=" + this + ']')); IgniteInternalFuture<T> fut = postLock(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 676327f..0e7c0ee 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -23,6 +23,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; @@ -223,7 +224,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { "crashed or left grid: " + CU.txString(tx)); } } - catch (IgniteTxOptimisticException ignore) { + catch (IgniteTxOptimisticCheckedException ignore) { if (log.isDebugEnabled()) log.debug("Optimistic failure while invalidating transaction (will rollback): " + tx.xidVersion()); @@ -741,7 +742,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { public void prepareTx(IgniteTxEx<K, V> tx) throws IgniteCheckedException { if (tx.state() == MARKED_ROLLBACK) { if (tx.timedOut()) - throw new IgniteTxTimeoutException("Transaction timed out: " + this); + throw new IgniteTxTimeoutCheckedException("Transaction timed out: " + this); throw new IgniteCheckedException("Transaction is marked for rollback: " + tx); } @@ -749,7 +750,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { if (tx.remainingTime() == 0) { tx.setRollbackOnly(); - throw new IgniteTxTimeoutException("Transaction timed out: " + this); + throw new IgniteTxTimeoutCheckedException("Transaction timed out: " + this); } boolean txSerializableEnabled = cctx.txConfig().isTxSerializableEnabled(); @@ -810,7 +811,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { if (GridFunc.intersects(committedTx.writeSet(), readSet)) { tx.setRollbackOnly(); - throw new IgniteTxOptimisticException("Failed to prepare transaction " + + throw new IgniteTxOptimisticCheckedException("Failed to prepare transaction " + "(committed vs. read-set conflict): " + tx); } } @@ -857,7 +858,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { tx.setRollbackOnly(); - throw new IgniteTxOptimisticException( + throw new IgniteTxOptimisticCheckedException( "Failed to prepare transaction (read-set/write-set conflict): " + tx); } } @@ -870,7 +871,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { if (!lockMultiple(tx, tx.optimisticLockEntries())) { tx.setRollbackOnly(); - throw new IgniteTxOptimisticException("Failed to prepare transaction (lock conflict): " + tx); + throw new IgniteTxOptimisticCheckedException("Failed to prepare transaction (lock conflict): " + tx); } } @@ -2209,7 +2210,7 @@ public class IgniteTxManager<K, V> extends GridCacheSharedManagerAdapter<K, V> { try { t.get(); } - catch (IgniteTxOptimisticException ignore) { + catch (IgniteTxOptimisticCheckedException ignore) { if (log.isDebugEnabled()) log.debug("Optimistic failure while committing prepared transaction (will rollback): " + tx); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java index 64c7e02..8d14acf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.transactions; import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; import org.apache.ignite.transactions.*; import org.apache.ignite.internal.util.future.*; @@ -236,7 +237,7 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable { IgniteInternalFuture<IgniteTxEx> commitFut = cctx.commitTxAsync(tx); if (async) - asyncRes = new IgniteFutureImpl(commitFut); + saveFuture(commitFut); else commitFut.get(); } @@ -307,6 +308,19 @@ public class IgniteTxProxyImpl<K, V> implements IgniteTxProxy, Externalizable { return tx.<V1>removeMeta(name); } + /** + * @param fut Internal future. + */ + private void saveFuture(IgniteInternalFuture<IgniteTxEx> fut) { + IgniteInternalFuture<IgniteTx> fut0 = fut.chain(new CX1<IgniteInternalFuture<IgniteTxEx>, IgniteTx>() { + @Override public IgniteTx applyx(IgniteInternalFuture<IgniteTxEx> fut) throws IgniteCheckedException { + return fut.get().proxy(); + } + }); + + asyncRes = new IgniteFutureImpl(fut0); + } + /** {@inheritDoc} */ @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(tx); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java index 13cc318..3e938d1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskProcessor.java @@ -616,12 +616,12 @@ public class GridTaskProcessor extends GridProcessorAdapter { /** * @param sesId Task's session id. - * @return A {@link org.apache.ignite.compute.ComputeTaskFuture} instance or {@code null} if no such task found. + * @return A {@link ComputeTaskInternalFuture} instance or {@code null} if no such task found. */ - @Nullable public <R> ComputeTaskFuture<R> taskFuture(IgniteUuid sesId) { + @Nullable public <R> ComputeTaskInternalFuture<R> taskFuture(IgniteUuid sesId) { GridTaskWorker<?, ?> taskWorker = tasks.get(sesId); - return taskWorker != null ? (ComputeTaskFuture<R>)taskWorker.getTaskFuture() : null; + return taskWorker != null ? (ComputeTaskInternalFuture<R>)taskWorker.getTaskFuture() : null; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java index 4d75ece..7fe0204 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/task/GridTaskWorker.java @@ -1172,7 +1172,7 @@ class GridTaskWorker<T, R> extends GridWorker implements GridTimeoutObject { fakeRes.setFakeException(new ClusterTopologyException("Failed to send job due to node failure: " + node, e)); else - fakeRes.setFakeException(new IgniteException(e)); + fakeRes.setFakeException(U.convertException(e)); onResponse(fakeRes); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxHeuristicCheckedException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxHeuristicCheckedException.java b/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxHeuristicCheckedException.java new file mode 100644 index 0000000..d624381 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxHeuristicCheckedException.java @@ -0,0 +1,51 @@ +/* + * 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.transactions; + +import org.apache.ignite.*; + +/** + * Exception thrown whenever grid transaction enters an unknown state. + * This exception is usually thrown whenever commit partially succeeds. + * Cache will still resolve this situation automatically to ensure data + * integrity, by invalidating all values participating in this transaction + * on remote nodes. + */ +public class IgniteTxHeuristicCheckedException extends IgniteCheckedException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new heuristic exception with given error message. + * + * @param msg Error message. + */ + public IgniteTxHeuristicCheckedException(String msg) { + super(msg); + } + + /** + * Creates new heuristic exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public IgniteTxHeuristicCheckedException(String msg, Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/724ba118/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxOptimisticCheckedException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxOptimisticCheckedException.java b/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxOptimisticCheckedException.java new file mode 100644 index 0000000..34b9eb3 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/transactions/IgniteTxOptimisticCheckedException.java @@ -0,0 +1,47 @@ +/* + * 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.transactions; + +import org.apache.ignite.*; + +/** + * Exception thrown whenever grid transactions fail optimistically. + */ +public class IgniteTxOptimisticCheckedException extends IgniteCheckedException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new optimistic exception with given error message. + * + * @param msg Error message. + */ + public IgniteTxOptimisticCheckedException(String msg) { + super(msg); + } + + /** + * Creates new optimistic exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public IgniteTxOptimisticCheckedException(String msg, Throwable cause) { + super(msg, cause); + } +}
