Repository: incubator-ignite Updated Branches: refs/heads/ignite-6 b1b7cfd8e -> 06d8f2c4c
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java index 7d1a151..29a647d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicReferenceImpl.java @@ -117,24 +117,39 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef } /** {@inheritDoc} */ - @Override public T get() throws IgniteCheckedException { + @Override public T get() { checkRemoved(); - return CU.outTx(getCall, ctx); + try { + return CU.outTx(getCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public void set(T val) throws IgniteCheckedException { + @Override public void set(T val) { checkRemoved(); - CU.outTx(internalSet(val), ctx); + try { + CU.outTx(internalSet(val), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public boolean compareAndSet(T expVal, T newVal) throws IgniteCheckedException { + @Override public boolean compareAndSet(T expVal, T newVal) { checkRemoved(); - return CU.outTx(internalCompareAndSet(wrapperPredicate(expVal), wrapperClosure(newVal)), ctx); + try { + return CU.outTx(internalCompareAndSet(wrapperPredicate(expVal), wrapperClosure(newVal)), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ @@ -166,7 +181,7 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef ctx.kernalContext().dataStructures().removeAtomicReference(name); } catch (IgniteCheckedException e) { - throw new IgniteException(e); + throw U.convertException(e); } } @@ -276,9 +291,9 @@ public final class GridCacheAtomicReferenceImpl<T> implements GridCacheAtomicRef /** * Check removed status. * - * @throws IgniteCheckedException If removed. + * @throws DataStructureRemovedException If removed. */ - private void checkRemoved() throws IgniteCheckedException { + private void checkRemoved() throws DataStructureRemovedException { if (rmvd) throw new DataStructureRemovedException("Atomic reference was removed from cache: " + name); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java index 4001c21..0d0c4cc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicSequenceImpl.java @@ -143,7 +143,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc } /** {@inheritDoc} */ - @Override public long get() throws IgniteCheckedException { + @Override public long get() { checkRemoved(); lock.lock(); @@ -157,27 +157,47 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc } /** {@inheritDoc} */ - @Override public long incrementAndGet() throws IgniteCheckedException { - return internalUpdate(1, incAndGetCall, true); + @Override public long incrementAndGet() { + try { + return internalUpdate(1, incAndGetCall, true); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndIncrement() throws IgniteCheckedException { - return internalUpdate(1, getAndIncCall, false); + @Override public long getAndIncrement() { + try { + return internalUpdate(1, getAndIncCall, false); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long addAndGet(long l) throws IgniteCheckedException { + @Override public long addAndGet(long l) { A.ensure(l > 0, " Parameter mustn't be less then 1: " + l); - return internalUpdate(l, null, true); + try { + return internalUpdate(l, null, true); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndAdd(long l) throws IgniteCheckedException { + @Override public long getAndAdd(long l) { A.ensure(l > 0, " Parameter mustn't be less then 1: " + l); - return internalUpdate(l, null, false); + try { + return internalUpdate(l, null, false); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** @@ -368,9 +388,9 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc /** * Check removed status. * - * @throws IgniteCheckedException If removed. + * @throws DataStructureRemovedException If removed. */ - private void checkRemoved() throws IgniteCheckedException { + private void checkRemoved() throws DataStructureRemovedException { if (rmvd) throw new DataStructureRemovedException("Sequence was removed from cache: " + name); } @@ -404,7 +424,7 @@ public final class GridCacheAtomicSequenceImpl implements GridCacheAtomicSequenc ctx.kernalContext().dataStructures().removeSequence(name); } catch (IgniteCheckedException e) { - throw new IgniteException(e); + throw U.convertException(e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java index a8e4967..318efe7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicStampedImpl.java @@ -141,39 +141,64 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt } /** {@inheritDoc} */ - @Override public IgniteBiTuple<T, S> get() throws IgniteCheckedException { + @Override public IgniteBiTuple<T, S> get() { checkRemoved(); - return CU.outTx(getCall, ctx); + try { + return CU.outTx(getCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public void set(T val, S stamp) throws IgniteCheckedException { + @Override public void set(T val, S stamp) { checkRemoved(); - CU.outTx(internalSet(val, stamp), ctx); + try { + CU.outTx(internalSet(val, stamp), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public boolean compareAndSet(T expVal, T newVal, S expStamp, S newStamp) throws IgniteCheckedException { + @Override public boolean compareAndSet(T expVal, T newVal, S expStamp, S newStamp) { checkRemoved(); - return CU.outTx(internalCompareAndSet(F0.equalTo(expVal), wrapperClosure(newVal), - F0.equalTo(expStamp), wrapperClosure(newStamp)), ctx); + try { + return CU.outTx(internalCompareAndSet(F0.equalTo(expVal), wrapperClosure(newVal), + F0.equalTo(expStamp), wrapperClosure(newStamp)), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public S stamp() throws IgniteCheckedException { + @Override public S stamp() { checkRemoved(); - return CU.outTx(stampCall, ctx); + try { + return CU.outTx(stampCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public T value() throws IgniteCheckedException { + @Override public T value() { checkRemoved(); - return CU.outTx(valCall, ctx); + try { + return CU.outTx(valCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ @@ -205,7 +230,7 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt ctx.kernalContext().dataStructures().removeAtomicStamped(name); } catch (IgniteCheckedException e) { - throw new IgniteException(e); + throw U.convertException(e); } } @@ -341,9 +366,9 @@ public final class GridCacheAtomicStampedImpl<T, S> implements GridCacheAtomicSt /** * Check removed status. * - * @throws IgniteCheckedException If removed. + * @throws DataStructureRemovedException If removed. */ - private void checkRemoved() throws IgniteCheckedException { + private void checkRemoved() throws DataStructureRemovedException { if (rmvd) throw new DataStructureRemovedException("Atomic stamped was removed from cache: " + name); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java index 2add962..187b165 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheCountDownLatchImpl.java @@ -150,39 +150,64 @@ public final class GridCacheCountDownLatchImpl implements GridCacheCountDownLatc } /** {@inheritDoc} */ - @Override public void await() throws IgniteCheckedException { - initializeLatch(); + @Override public void await() { + try { + initializeLatch(); - U.await(internalLatch); + U.await(internalLatch); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public boolean await(long timeout, TimeUnit unit) throws IgniteCheckedException { - initializeLatch(); + @Override public boolean await(long timeout, TimeUnit unit) { + try { + initializeLatch(); - return U.await(internalLatch, timeout, unit); + return U.await(internalLatch, timeout, unit); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public boolean await(long timeout) throws IgniteCheckedException { + @Override public boolean await(long timeout) { return await(timeout, TimeUnit.MILLISECONDS); } /** {@inheritDoc} */ - @Override public int countDown() throws IgniteCheckedException { - return CU.outTx(new CountDownCallable(1), ctx); + @Override public int countDown() { + try { + return CU.outTx(new CountDownCallable(1), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public int countDown(int val) throws IgniteCheckedException { + @Override public int countDown(int val) { A.ensure(val > 0, "val should be positive"); - return CU.outTx(new CountDownCallable(val), ctx); + try { + return CU.outTx(new CountDownCallable(val), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc}*/ - @Override public void countDownAll() throws IgniteCheckedException { - CU.outTx(new CountDownCallable(0), ctx); + @Override public void countDownAll() { + try { + CU.outTx(new CountDownCallable(0), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ @@ -271,7 +296,7 @@ public final class GridCacheCountDownLatchImpl implements GridCacheCountDownLatc ctx.kernalContext().dataStructures().removeCountDownLatch(name); } catch (IgniteCheckedException e) { - throw new IgniteException(e); + throw U.convertException(e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java index 4c9e330..8e22196 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java @@ -419,7 +419,7 @@ public abstract class GridCacheQueueAdapter<T> extends AbstractCollection<T> imp } /** - * Checks result of closure modifying queue header, throws {@link org.apache.ignite.datastructures.DataStructureRemovedException} + * Checks result of closure modifying queue header, throws {@link DataStructureRemovedException} * if queue was removed. * * @param idx Result of closure execution. @@ -430,7 +430,7 @@ public abstract class GridCacheQueueAdapter<T> extends AbstractCollection<T> imp } /** - * Checks queue state, throws {@link org.apache.ignite.datastructures.DataStructureRemovedException} if queue was removed. + * Checks queue state, throws {@link DataStructureRemovedException} if queue was removed. * * @param hdr Queue hdr. */ @@ -442,7 +442,7 @@ public abstract class GridCacheQueueAdapter<T> extends AbstractCollection<T> imp /** * Marks queue as removed. * - * @param throw0 If {@code true} then throws {@link org.apache.ignite.datastructures.DataStructureRemovedException}. + * @param throw0 If {@code true} then throws {@link DataStructureRemovedException}. */ public void onRemoved(boolean throw0) { rmvd = true; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java index a52f8e4..feecc97 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheSetImpl.java @@ -459,7 +459,7 @@ public class GridCacheSetImpl<T> extends AbstractCollection<T> implements Ignite } /** - * Throws {@link org.apache.ignite.datastructures.DataStructureRemovedException} if set was removed. + * Throws {@link DataStructureRemovedException} if set was removed. */ private void checkRemoved() { if (rmvd) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java index fce6332..934d9f2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java @@ -54,12 +54,6 @@ public enum GridRestCommand { /** Replace cache value only if there is currently a mapping for it. */ CACHE_REPLACE("rep"), - /** Increment. */ - CACHE_INCREMENT("incr"), - - /** Decrement. */ - CACHE_DECREMENT("decr"), - /** Compare and set. */ CACHE_CAS("cas"), @@ -72,6 +66,12 @@ public enum GridRestCommand { /** Cache metrics. */ CACHE_METRICS("cache"), + /** Increment. */ + ATOMIC_INCREMENT("incr"), + + /** Decrement. */ + ATOMIC_DECREMENT("decr"), + /** Grid topology. */ TOPOLOGY("top"), http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java index 21e5a38..3d5a882 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java @@ -20,17 +20,13 @@ package org.apache.ignite.internal.processors.rest; import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.*; -import org.apache.ignite.internal.processors.rest.handlers.datastructures.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.plugin.security.*; -import org.apache.ignite.spi.authentication.*; import org.apache.ignite.internal.managers.securesession.*; import org.apache.ignite.internal.managers.security.*; +import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.rest.client.message.*; import org.apache.ignite.internal.processors.rest.handlers.*; import org.apache.ignite.internal.processors.rest.handlers.cache.*; +import org.apache.ignite.internal.processors.rest.handlers.datastructures.*; import org.apache.ignite.internal.processors.rest.handlers.log.*; import org.apache.ignite.internal.processors.rest.handlers.metadata.*; import org.apache.ignite.internal.processors.rest.handlers.task.*; @@ -38,10 +34,14 @@ import org.apache.ignite.internal.processors.rest.handlers.top.*; import org.apache.ignite.internal.processors.rest.handlers.version.*; import org.apache.ignite.internal.processors.rest.protocols.tcp.*; import org.apache.ignite.internal.processors.rest.request.*; +import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.internal.util.worker.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.plugin.security.*; +import org.apache.ignite.spi.authentication.*; import org.jdk8.backport.*; import java.lang.reflect.*; @@ -398,8 +398,8 @@ public class GridRestProcessor extends GridProcessorAdapter { case CACHE_REMOVE: case CACHE_REMOVE_ALL: case CACHE_REPLACE: - case CACHE_INCREMENT: - case CACHE_DECREMENT: + case ATOMIC_INCREMENT: + case ATOMIC_DECREMENT: case CACHE_CAS: case CACHE_APPEND: case CACHE_PREPEND: @@ -563,8 +563,8 @@ public class GridRestProcessor extends GridProcessorAdapter { break; // TODO IGNITE-6. - case CACHE_INCREMENT: - case CACHE_DECREMENT: + case ATOMIC_INCREMENT: + case ATOMIC_DECREMENT: perm = GridSecurityPermission.CACHE_PUT; break; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 7933b28..34034cf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -76,8 +76,8 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { CACHE_ADD, CACHE_REMOVE, CACHE_REPLACE, - CACHE_INCREMENT, - CACHE_DECREMENT, + ATOMIC_INCREMENT, + ATOMIC_DECREMENT, CACHE_CAS, CACHE_APPEND, CACHE_PREPEND http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/datastructures/DataStructuresCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/datastructures/DataStructuresCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/datastructures/DataStructuresCommandHandler.java index 53491c4..c45f2c7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/datastructures/DataStructuresCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/datastructures/DataStructuresCommandHandler.java @@ -25,7 +25,6 @@ import org.apache.ignite.internal.processors.rest.request.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; import java.util.*; import java.util.concurrent.*; @@ -38,8 +37,8 @@ import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; public class DataStructuresCommandHandler extends GridRestCommandHandlerAdapter { /** Supported commands. */ private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList( - CACHE_INCREMENT, - CACHE_DECREMENT + ATOMIC_INCREMENT, + ATOMIC_DECREMENT ); /** @@ -58,15 +57,17 @@ public class DataStructuresCommandHandler extends GridRestCommandHandlerAdapter @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) { assert SUPPORTED_COMMANDS.contains(req.command()) : req.command(); - return incrementOrDecrement((DataStructuresRequest)req).chain(new CX1<IgniteInternalFuture<?>, GridRestResponse>() { - @Override public GridRestResponse applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException { - GridRestResponse res = new GridRestResponse(); + return incrementOrDecrement((DataStructuresRequest)req).chain( + new CX1<IgniteInternalFuture<?>, GridRestResponse>() { + @Override public GridRestResponse applyx(IgniteInternalFuture<?> fut) throws IgniteCheckedException { + GridRestResponse res = new GridRestResponse(); - res.setResponse(fut.get()); + res.setResponse(fut.get()); - return res; + return res; + } } - }); + ); } /** * Handles increment and decrement commands. @@ -76,7 +77,7 @@ public class DataStructuresCommandHandler extends GridRestCommandHandlerAdapter */ private IgniteInternalFuture<?> incrementOrDecrement(final DataStructuresRequest req) { assert req != null; - assert req.command() == CACHE_INCREMENT || req.command() == CACHE_DECREMENT : req.command(); + assert req.command() == ATOMIC_INCREMENT || req.command() == ATOMIC_DECREMENT : req.command(); if (req.key() == null) { IgniteCheckedException err = @@ -96,7 +97,7 @@ public class DataStructuresCommandHandler extends GridRestCommandHandlerAdapter Long init = req.initial(); Long delta = req.delta(); - boolean decr = req.command() == CACHE_DECREMENT; + boolean decr = req.command() == ATOMIC_DECREMENT; String key = (String)req.key(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java index d960283..c12bceb 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java @@ -269,7 +269,7 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<Gr private GridRestRequest createRestRequest(GridMemcachedMessage req, GridRestCommand cmd) { assert req != null; - if (cmd == CACHE_INCREMENT || cmd == CACHE_DECREMENT) { + if (cmd == ATOMIC_INCREMENT || cmd == ATOMIC_DECREMENT) { DataStructuresRequest restReq = new DataStructuresRequest(); restReq.command(cmd); @@ -343,11 +343,11 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<Gr break; case 0x05: - cmd = CACHE_INCREMENT; + cmd = ATOMIC_INCREMENT; break; case 0x06: - cmd = CACHE_DECREMENT; + cmd = ATOMIC_DECREMENT; break; case 0x07: @@ -413,12 +413,12 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<Gr break; case 0x15: - cmd = CACHE_INCREMENT; + cmd = ATOMIC_INCREMENT; quiet = true; break; case 0x16: - cmd = CACHE_DECREMENT; + cmd = ATOMIC_DECREMENT; quiet = true; break; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureUniqueNameTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureUniqueNameTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureUniqueNameTest.java index fb40cfc..83053eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureUniqueNameTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteDataStructureUniqueNameTest.java @@ -220,52 +220,90 @@ public class IgniteDataStructureUniqueNameTest extends IgniteCollectionAbstractT private void testUniqueName(final boolean singleGrid) throws Exception { final String name = IgniteUuid.randomUuid().toString(); - final int THREADS = 10; + final int DS_TYPES = 7; - for (int iter = 0; iter < 10; iter++) { + final int THREADS = DS_TYPES * 3; + + for (int iter = 0; iter < 20; iter++) { log.info("Iteration: " + iter); List<IgniteInternalFuture<Object>> futs = new ArrayList<>(THREADS); + final CyclicBarrier barrier = new CyclicBarrier(THREADS); + for (int i = 0; i < THREADS; i++) { final int idx = i; IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() { @Override public Object call() throws Exception { try { + Thread.currentThread().setName("test thread-" + idx); + + barrier.await(); + Ignite ignite = singleGrid ? ignite(0) : ignite(idx % gridCount()); - switch (idx % 5) { + Object res; + + switch (idx % DS_TYPES) { case 0: log.info("Create atomic long, grid: " + ignite.name()); - return ignite.atomicLong(name, 0, true); + res = ignite.atomicLong(name, 0, true); + + break; case 1: log.info("Create atomic sequence, grid: " + ignite.name()); - return ignite.atomicSequence(name, 0, true); + res = ignite.atomicSequence(name, 0, true); + + break; case 2: log.info("Create atomic stamped, grid: " + ignite.name()); - return ignite.atomicStamped(name, 0, true, true); + res = ignite.atomicStamped(name, 0, true, true); + + break; case 3: log.info("Create atomic latch, grid: " + ignite.name()); - return ignite.countDownLatch(name, 0, true, true); + res = ignite.countDownLatch(name, 0, true, true); + + break; case 4: log.info("Create atomic reference, grid: " + ignite.name()); - return ignite.atomicReference(name, null, true); + res = ignite.atomicReference(name, null, true); + + break; + + case 5: + log.info("Create queue, grid: " + ignite.name()); + + res = ignite.queue(name, config(false), 0, true); + + break; + + case 6: + log.info("Create set, grid: " + ignite.name()); + + res = ignite.set(name, config(false), true); + + break; default: fail(); return null; } + + log.info("Thread created: " + res); + + return res; } catch (IgniteException e) { log.info("Failed: " + e); @@ -280,6 +318,8 @@ public class IgniteDataStructureUniqueNameTest extends IgniteCollectionAbstractT Closeable dataStructure = null; + int createdCnt = 0; + for (IgniteInternalFuture<Object> fut : futs) { Object res = fut.get(); @@ -291,19 +331,24 @@ public class IgniteDataStructureUniqueNameTest extends IgniteCollectionAbstractT res instanceof IgniteAtomicSequence || res instanceof IgniteAtomicReference || res instanceof IgniteAtomicStamped || - res instanceof IgniteCountDownLatch); + res instanceof IgniteCountDownLatch || + res instanceof IgniteQueue || + res instanceof IgniteSet); - if (dataStructure != null) { - log.info("Data structure created: " + dataStructure); + log.info("Data structure created: " + dataStructure); + createdCnt++; + + if (dataStructure != null) assertEquals(dataStructure.getClass(), res.getClass()); - } else dataStructure = (Closeable)res; } assertNotNull(dataStructure); + assertEquals(3, createdCnt); + dataStructure.close(); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java ---------------------------------------------------------------------- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index a9986f9..62437e0 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -302,8 +302,8 @@ public class GridJettyRestHandler extends AbstractHandler { GridRestRequest restReq; switch (cmd) { - case CACHE_DECREMENT: - case CACHE_INCREMENT: { + case ATOMIC_DECREMENT: + case ATOMIC_INCREMENT: { DataStructuresRequest restReq0 = new DataStructuresRequest(); restReq0.key(params.get("key"));