ignite-44
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b0fe66c3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b0fe66c3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b0fe66c3 Branch: refs/heads/ignite-54 Commit: b0fe66c3817963ba59ec4dee9a23ad7980a1cbee Parents: 0da9afa Author: sboikov <sboi...@gridgain.com> Authored: Mon Dec 29 11:49:23 2014 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Mon Dec 29 11:49:23 2014 +0300 ---------------------------------------------------------------------- .../GridTransactionalCacheQueueImpl.java | 81 ++++++++++++-------- 1 file changed, 49 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b0fe66c3/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridTransactionalCacheQueueImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridTransactionalCacheQueueImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridTransactionalCacheQueueImpl.java index f038339..c9ad46e 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridTransactionalCacheQueueImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/datastructures/GridTransactionalCacheQueueImpl.java @@ -17,6 +17,7 @@ import org.gridgain.grid.kernal.processors.cache.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; +import javax.cache.*; import java.util.*; import static org.apache.ignite.transactions.IgniteTxConcurrency.*; @@ -70,17 +71,21 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> break; } } - catch (ClusterGroupEmptyException e) { - throw e; - } - catch (ClusterTopologyException e) { - if (cnt++ == MAX_UPDATE_RETRIES) + catch (CacheException e) { + if (e.getCause() instanceof ClusterGroupEmptyException) throw e; - else { - U.warn(log, "Failed to add item, will retry [err=" + e + ']'); - U.sleep(RETRY_DELAY); + if (e.getCause() instanceof ClusterTopologyException) { + if (cnt++ == MAX_UPDATE_RETRIES) + throw e; + else { + U.warn(log, "Failed to add item, will retry [err=" + e + ']'); + + U.sleep(RETRY_DELAY); + } } + else + throw e; } } @@ -117,17 +122,21 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> break; } - catch (ClusterGroupEmptyException e) { - throw e; - } - catch(ClusterTopologyException e) { - if (cnt++ == MAX_UPDATE_RETRIES) + catch (CacheException e) { + if (e.getCause() instanceof ClusterGroupEmptyException) throw e; - else { - U.warn(log, "Failed to poll, will retry [err=" + e + ']'); - U.sleep(RETRY_DELAY); + if (e.getCause() instanceof ClusterTopologyException) { + if (cnt++ == MAX_UPDATE_RETRIES) + throw e; + else { + U.warn(log, "Failed to add item, will retry [err=" + e + ']'); + + U.sleep(RETRY_DELAY); + } } + else + throw e; } } @@ -174,17 +183,21 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> break; } - catch (ClusterGroupEmptyException e) { - throw e; - } - catch(ClusterTopologyException e) { - if (cnt++ == MAX_UPDATE_RETRIES) + catch (CacheException e) { + if (e.getCause() instanceof ClusterGroupEmptyException) throw e; - else { - U.warn(log, "Failed to addAll, will retry [err=" + e + ']'); - U.sleep(RETRY_DELAY); + if (e.getCause() instanceof ClusterTopologyException) { + if (cnt++ == MAX_UPDATE_RETRIES) + throw e; + else { + U.warn(log, "Failed to add item, will retry [err=" + e + ']'); + + U.sleep(RETRY_DELAY); + } } + else + throw e; } } @@ -217,17 +230,21 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> break; } - catch (ClusterGroupEmptyException e) { - throw e; - } - catch(ClusterTopologyException e) { - if (cnt++ == MAX_UPDATE_RETRIES) + catch (CacheException e) { + if (e.getCause() instanceof ClusterGroupEmptyException) throw e; - else { - U.warn(log, "Failed to remove item, will retry [err=" + e + ", idx=" + rmvIdx + ']'); - U.sleep(RETRY_DELAY); + if (e.getCause() instanceof ClusterTopologyException) { + if (cnt++ == MAX_UPDATE_RETRIES) + throw e; + else { + U.warn(log, "Failed to add item, will retry [err=" + e + ']'); + + U.sleep(RETRY_DELAY); + } } + else + throw e; } } }