# ignite-6
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/06d8f2c4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/06d8f2c4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/06d8f2c4 Branch: refs/heads/ignite-6 Commit: 06d8f2c4c43434d72ea1c93ab6bccd25d8a2788d Parents: b1b7cfd Author: sboikov <sboi...@gridgain.com> Authored: Wed Feb 4 11:23:51 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Wed Feb 4 12:13:38 2015 +0300 ---------------------------------------------------------------------- .../datastructures/CacheAtomicLongExample.java | 6 +- .../CacheAtomicReferenceExample.java | 15 +- .../CacheAtomicSequenceExample.java | 30 +- .../CacheAtomicStampedExample.java | 17 +- .../CacheCountDownLatchExample.java | 11 +- .../org/apache/ignite/IgniteAtomicLong.java | 38 +- .../apache/ignite/IgniteAtomicReference.java | 14 +- .../org/apache/ignite/IgniteAtomicSequence.java | 22 +- .../org/apache/ignite/IgniteAtomicStamped.java | 22 +- .../org/apache/ignite/IgniteCountDownLatch.java | 32 +- .../java/org/apache/ignite/IgniteQueue.java | 1 - .../IgniteCollectionConfiguration.java | 4 +- .../configuration/IgniteConfiguration.java | 4 +- .../processors/cache/GridCacheAdapter.java | 113 +++--- .../processors/cache/GridCacheProcessor.java | 7 - .../CacheDataStructuresManager.java | 25 +- .../cache/query/GridCacheQueryManager.java | 9 +- .../CacheDataStructuresProcessor.java | 344 ++++++------------- .../datastructures/GridCacheAtomicLongImpl.java | 88 +++-- .../GridCacheAtomicReferenceImpl.java | 33 +- .../GridCacheAtomicSequenceImpl.java | 44 ++- .../GridCacheAtomicStampedImpl.java | 53 ++- .../GridCacheCountDownLatchImpl.java | 53 ++- .../datastructures/GridCacheQueueAdapter.java | 6 +- .../datastructures/GridCacheSetImpl.java | 2 +- .../processors/rest/GridRestCommand.java | 12 +- .../processors/rest/GridRestProcessor.java | 20 +- .../handlers/cache/GridCacheCommandHandler.java | 4 +- .../DataStructuresCommandHandler.java | 23 +- .../tcp/GridTcpMemcachedNioListener.java | 10 +- .../IgniteDataStructureUniqueNameTest.java | 69 +++- .../http/jetty/GridJettyRestHandler.java | 4 +- 32 files changed, 544 insertions(+), 591 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java index 1bd28ea..d70edc5 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicLongExample.java @@ -40,9 +40,9 @@ public final class CacheAtomicLongExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite g = Ignition.start("examples/config/example-cache.xml")) { System.out.println(); System.out.println(">>> Atomic long example started."); @@ -59,7 +59,7 @@ public final class CacheAtomicLongExample { // Try increment atomic long from all grid nodes. // Note that this node is also part of the grid. g.compute().broadcast(new IgniteCallable<Object>() { - @Override public Object call() throws Exception { + @Override public Object call() { for (int i = 0; i < RETRIES; i++) System.out.println("AtomicLong value has been incremented: " + atomicLong.incrementAndGet()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java index 8aa10c5..e2b8602 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicReferenceExample.java @@ -37,9 +37,9 @@ public final class CacheAtomicReferenceExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite g = Ignition.start("examples/config/example-cache.xml")) { System.out.println(); System.out.println(">>> Atomic reference example started."); @@ -102,14 +102,9 @@ public final class CacheAtomicReferenceExample { /** {@inheritDoc} */ @Override public void run() { - try { - IgniteAtomicReference<String> ref = Ignition.ignite().atomicReference(refName, null, true); - - System.out.println("Atomic reference value is " + ref.get() + '.'); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } + IgniteAtomicReference<String> ref = Ignition.ignite().atomicReference(refName, null, true); + + System.out.println("Atomic reference value is " + ref.get() + '.'); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java index f35ef75..71c131f 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicSequenceExample.java @@ -33,9 +33,6 @@ import java.util.*; * start GridGain node with {@code examples/config/example-cache.xml} configuration. */ public final class CacheAtomicSequenceExample { - /** Cache name. */ - private static final String CACHE_NAME = "partitioned_tx"; - /** Number of retries */ private static final int RETRIES = 20; @@ -43,9 +40,9 @@ public final class CacheAtomicSequenceExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite g = Ignition.start("examples/config/example-cache.xml")) { System.out.println(); System.out.println(">>> Cache atomic sequence example started."); @@ -62,7 +59,7 @@ public final class CacheAtomicSequenceExample { System.out.println("Sequence initial value: " + firstVal); // Try increment atomic sequence on all grid nodes. Note that this node is also part of the grid. - g.compute().run(new SequenceClosure(CACHE_NAME, seqName)); + g.compute().run(new SequenceClosure(seqName)); System.out.println("Sequence after incrementing [expected=" + (firstVal + RETRIES) + ", actual=" + seq.get() + ']'); @@ -77,34 +74,23 @@ public final class CacheAtomicSequenceExample { * Obtains atomic sequence. */ private static class SequenceClosure implements IgniteRunnable { - /** Cache name. */ - private final String cacheName; - /** Sequence name. */ private final String seqName; /** - * @param cacheName Cache name. * @param seqName Sequence name. */ - SequenceClosure(String cacheName, String seqName) { - this.cacheName = cacheName; + SequenceClosure(String seqName) { this.seqName = seqName; } /** {@inheritDoc} */ @Override public void run() { - try { - IgniteAtomicSequence seq = Ignition.ignite().atomicSequence(seqName, 0, true); - - for (int i = 0; i < RETRIES; i++) - System.out.println("Sequence [currentValue=" + seq.get() + ", afterIncrement=" + - seq.incrementAndGet() + ']'); + IgniteAtomicSequence seq = Ignition.ignite().atomicSequence(seqName, 0, true); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } + for (int i = 0; i < RETRIES; i++) + System.out.println("Sequence [currentValue=" + seq.get() + ", afterIncrement=" + + seq.incrementAndGet() + ']'); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java index b8f678e..b2031e0 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheAtomicStampedExample.java @@ -37,9 +37,9 @@ public final class CacheAtomicStampedExample { * Executes example. * * @param args Command line arguments, none required. - * @throws IgniteCheckedException If example execution failed. + * @throws Exception If example execution failed. */ - public static void main(String[] args) throws IgniteCheckedException { + public static void main(String[] args) throws Exception { try (Ignite g = Ignition.start("examples/config/example-cache.xml")) { System.out.println(); System.out.println(">>> Atomic stamped example started."); @@ -108,15 +108,10 @@ public final class CacheAtomicStampedExample { /** {@inheritDoc} */ @Override public void run() { - try { - IgniteAtomicStamped<String, String> stamped = Ignition.ignite(). - atomicStamped(stampedName, null, null, true); - - System.out.println("Atomic stamped [value=" + stamped.value() + ", stamp=" + stamped.stamp() + ']'); - } - catch (IgniteCheckedException e) { - throw new IgniteException(e); - } + IgniteAtomicStamped<String, String> stamped = Ignition.ignite(). + atomicStamped(stampedName, null, null, true); + + System.out.println("Atomic stamped [value=" + stamped.value() + ", stamp=" + stamped.stamp() + ']'); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java index 8719401..c255f87 100644 --- a/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java +++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/datastructures/CacheCountDownLatchExample.java @@ -86,16 +86,11 @@ public class CacheCountDownLatchExample { /** {@inheritDoc} */ @Override public void run() { - try { - IgniteCountDownLatch latch = Ignition.ignite().countDownLatch(latchName, 1, false, true); + IgniteCountDownLatch latch = Ignition.ignite().countDownLatch(latchName, 1, false, true); - int newCnt = latch.countDown(); + int newCnt = latch.countDown(); - System.out.println("Counted down [newCnt=" + newCnt + ", nodeId=" + Ignition.ignite().cluster().localNode().id() + ']'); - } - catch (IgniteCheckedException e) { - throw new RuntimeException(e); - } + System.out.println("Counted down [newCnt=" + newCnt + ", nodeId=" + Ignition.ignite().cluster().localNode().id() + ']'); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java index 7bf2295..b749ef5 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicLong.java @@ -73,68 +73,68 @@ public interface IgniteAtomicLong extends Closeable { * Gets current value of atomic long. * * @return Current value of atomic long. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long get() throws IgniteCheckedException; + public long get() throws IgniteException; /** * Increments and gets current value of atomic long. * * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long incrementAndGet() throws IgniteCheckedException; + public long incrementAndGet() throws IgniteException; /** * Gets and increments current value of atomic long. * * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndIncrement() throws IgniteCheckedException; + public long getAndIncrement() throws IgniteException; /** * Adds {@code l} and gets current value of atomic long. * * @param l Number which will be added. * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long addAndGet(long l) throws IgniteCheckedException; + public long addAndGet(long l) throws IgniteException; /** * Gets current value of atomic long and adds {@code l}. * * @param l Number which will be added. * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndAdd(long l) throws IgniteCheckedException; + public long getAndAdd(long l) throws IgniteException; /** * Decrements and gets current value of atomic long. * * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long decrementAndGet() throws IgniteCheckedException; + public long decrementAndGet() throws IgniteException; /** * Gets and decrements current value of atomic long. * * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndDecrement() throws IgniteCheckedException; + public long getAndDecrement() throws IgniteException; /** * Gets current value of atomic long and sets new value {@code l} of atomic long. * * @param l New value of atomic long. * @return Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndSet(long l) throws IgniteCheckedException; + public long getAndSet(long l) throws IgniteException; /** * Atomically compares current value to the expected value, and if they are equal, sets current value @@ -143,9 +143,9 @@ public interface IgniteAtomicLong extends Closeable { * @param expVal Expected atomic long's value. * @param newVal New atomic long's value to set if current value equal to expected value. * @return {@code True} if comparison succeeded, {@code false} otherwise. - * @throws IgniteCheckedException If failed. + * @throws IgniteException If failed. */ - public boolean compareAndSet(long expVal, long newVal) throws IgniteCheckedException; + public boolean compareAndSet(long expVal, long newVal) throws IgniteException; /** * Gets status of atomic. @@ -156,6 +156,8 @@ public interface IgniteAtomicLong extends Closeable { /** * Removes this atomic long. + * + * @throws IgniteException If operation failed. */ @Override public void close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java index 1f58073..bc8a987 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicReference.java @@ -60,17 +60,17 @@ public interface IgniteAtomicReference<T> extends Closeable { * Gets current value of an atomic reference. * * @return current value of an atomic reference. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public T get() throws IgniteCheckedException; + public T get() throws IgniteException; /** * Unconditionally sets the value. * * @param val Value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public void set(T val) throws IgniteCheckedException; + public void set(T val) throws IgniteException; /** * Conditionally sets the new value. That will be set if {@code expVal} is equal @@ -79,9 +79,9 @@ public interface IgniteAtomicReference<T> extends Closeable { * @param expVal Expected value. * @param newVal New value. * @return Result of operation execution. If {@code true} than value have been updated. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public boolean compareAndSet(T expVal, T newVal) throws IgniteCheckedException; + public boolean compareAndSet(T expVal, T newVal) throws IgniteException; /** * Gets status of atomic. @@ -92,6 +92,8 @@ public interface IgniteAtomicReference<T> extends Closeable { /** * Removes this atomic reference. + * + * @throws IgniteException If operation failed. */ @Override public void close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java index 00415fb..afb6c42 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicSequence.java @@ -68,43 +68,43 @@ public interface IgniteAtomicSequence extends Closeable { * Gets current value of atomic sequence. * * @return Value of atomic sequence. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long get() throws IgniteCheckedException; + public long get() throws IgniteException; /** * Increments and returns the value of atomic sequence. * * @return Value of atomic sequence after increment. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long incrementAndGet() throws IgniteCheckedException; + public long incrementAndGet() throws IgniteException; /** * Gets and increments current value of atomic sequence. * * @return Value of atomic sequence before increment. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndIncrement() throws IgniteCheckedException; + public long getAndIncrement() throws IgniteException; /** * Adds {@code l} elements to atomic sequence and gets value of atomic sequence. * * @param l Number of added elements. * @return Value of atomic sequence. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long addAndGet(long l) throws IgniteCheckedException; + public long addAndGet(long l) throws IgniteException; /** * Gets current value of atomic sequence and adds {@code l} elements. * * @param l Number of added elements. * @return Value of atomic sequence. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public long getAndAdd(long l) throws IgniteCheckedException; + public long getAndAdd(long l) throws IgniteException; /** * Gets local batch size for this atomic sequence. @@ -129,6 +129,8 @@ public interface IgniteAtomicSequence extends Closeable { /** * Removes this atomic sequence. + * + * @throws IgniteException If operation failed. */ @Override public void close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java index 5c9fb65..a5e989a 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteAtomicStamped.java @@ -70,18 +70,18 @@ public interface IgniteAtomicStamped<T, S> extends Closeable { * Gets both current value and current stamp of atomic stamped. * * @return both current value and current stamp of atomic stamped. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public IgniteBiTuple<T, S> get() throws IgniteCheckedException; + public IgniteBiTuple<T, S> get() throws IgniteException; /** * Unconditionally sets the value and the stamp. * * @param val Value. * @param stamp Stamp. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public void set(T val, S stamp) throws IgniteCheckedException; + public void set(T val, S stamp) throws IgniteException; /** * Conditionally sets the new value and new stamp. They will be set if {@code expVal} @@ -92,25 +92,25 @@ public interface IgniteAtomicStamped<T, S> extends Closeable { * @param expStamp Expected stamp. * @param newStamp New stamp. * @return Result of operation execution. If {@code true} than value and stamp will be updated. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public boolean compareAndSet(T expVal, T newVal, S expStamp, S newStamp) throws IgniteCheckedException; + public boolean compareAndSet(T expVal, T newVal, S expStamp, S newStamp) throws IgniteException; /** * Gets current stamp. * * @return Current stamp. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public S stamp() throws IgniteCheckedException; + public S stamp() throws IgniteException; /** * Gets current value. * * @return Current value. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public T value() throws IgniteCheckedException; + public T value() throws IgniteException; /** * Gets status of atomic. @@ -121,6 +121,8 @@ public interface IgniteAtomicStamped<T, S> extends Closeable { /** * Removes this atomic stamped. + * + * @throws IgniteException If operation failed. */ @Override public void close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java b/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java index 75bc5ce..ba35448 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteCountDownLatch.java @@ -86,11 +86,11 @@ public interface IgniteCountDownLatch extends Closeable { * then {@link org.apache.ignite.internal.IgniteInterruptedCheckedException} is thrown and the current thread's * interrupted status is cleared. * - * @throws IgniteCheckedException If operation failed. - * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException if the current thread is interrupted + * @throws IgniteException If operation failed. + * @throws org.apache.ignite.IgniteInterruptedException if the current thread is interrupted * while waiting */ - public void await() throws IgniteCheckedException; + public void await() throws IgniteException; /** * Causes the current thread to wait until the latch has counted down to @@ -127,11 +127,11 @@ public interface IgniteCountDownLatch extends Closeable { * @param timeout The maximum time to wait in milliseconds. * @return {@code True} if the count reached zero and {@code false} * if the waiting time elapsed before the count reached zero. - * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If the current thread is interrupted + * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted * while waiting. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public boolean await(long timeout) throws IgniteCheckedException; + public boolean await(long timeout) throws IgniteException; /** * Causes the current thread to wait until the latch has counted down to @@ -170,11 +170,11 @@ public interface IgniteCountDownLatch extends Closeable { * @param unit The time unit of the {@code timeout} argument. * @return {@code True} if the count reached zero and {@code false} * if the waiting time elapsed before the count reached zero. - * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If the current thread is interrupted + * @throws org.apache.ignite.IgniteInterruptedException If the current thread is interrupted * while waiting. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public boolean await(long timeout, TimeUnit unit) throws IgniteCheckedException; + public boolean await(long timeout, TimeUnit unit) throws IgniteException; /** * Decrements the count of the latch, releasing all waiting threads @@ -187,9 +187,9 @@ public interface IgniteCountDownLatch extends Closeable { * If the current count equals zero then nothing happens. * * @return Count after decrement. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public int countDown() throws IgniteCheckedException; + public int countDown() throws IgniteException; /** * Decreases the count of the latch using passed in value, @@ -203,18 +203,18 @@ public interface IgniteCountDownLatch extends Closeable { * * @param val Value to decrease counter on. * @return Count after decreasing. - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public int countDown(int val) throws IgniteCheckedException; + public int countDown(int val) throws IgniteException; /** * Counts down this latch to zero, releasing all waiting threads on all nodes. * <p> * If the current count equals zero then nothing happens. * - * @throws IgniteCheckedException If operation failed. + * @throws IgniteException If operation failed. */ - public void countDownAll() throws IgniteCheckedException; + public void countDownAll() throws IgniteException; /** * Gets {@code removed} status of the latch. @@ -225,6 +225,8 @@ public interface IgniteCountDownLatch extends Closeable { /** * Removes this count down latch. + * + * @throws IgniteException If operation failed. */ @Override public void close(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/IgniteQueue.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteQueue.java b/modules/core/src/main/java/org/apache/ignite/IgniteQueue.java index 82eae91..ea7a2e9 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteQueue.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteQueue.java @@ -18,7 +18,6 @@ package org.apache.ignite; import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; import org.jetbrains.annotations.*; import java.io.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/configuration/IgniteCollectionConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteCollectionConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteCollectionConfiguration.java index dbdfc7f..3a212e9 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteCollectionConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteCollectionConfiguration.java @@ -20,13 +20,13 @@ package org.apache.ignite.configuration; import org.apache.ignite.cache.*; /** - * + * Configuration for Ignite collections. */ public class IgniteCollectionConfiguration { /** Cache name. */ private String cacheName; - /** */ + /** Collocated flag. */ private boolean collocated; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java index 36d2a97..b3e4f90 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java @@ -3161,14 +3161,14 @@ public class IgniteConfiguration { } /** - * @return Atomic configuration. + * @return Atomic data structures configuration. */ public IgniteAtomicConfiguration getAtomicConfiguration() { return atomicCfg; } /** - * @param atomicCfg Atomic configuration. + * @param atomicCfg Atomic data structures configuration. */ public void setAtomicConfiguration(IgniteAtomicConfiguration atomicCfg) { this.atomicCfg = atomicCfg; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/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 311ba60..6818385 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 @@ -816,7 +816,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, @Nullable protected GridTuple<V> peek0(boolean failFast, K key, @Nullable Collection<GridCachePeekMode> modes, IgniteInternalTx<K, V> tx) throws IgniteCheckedException, GridCacheFilterFailedException { if (F.isEmpty(modes)) - return F.t(peek(key, (IgnitePredicate<CacheEntry<K, V>>) null)); + return F.t(peek(key, (IgnitePredicate<CacheEntry<K, V>>)null)); assert modes != null; @@ -1080,7 +1080,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, /** {@inheritDoc} */ @Override public Set<CacheEntry<K, V>> entrySet() { - return entrySet((IgnitePredicate<CacheEntry<K, V>>[]) null); + return entrySet((IgnitePredicate<CacheEntry<K, V>>[])null); } @@ -1101,22 +1101,22 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, /** {@inheritDoc} */ @Override public Set<CacheEntry<K, V>> primaryEntrySet() { - return primaryEntrySet((IgnitePredicate<CacheEntry<K, V>>[]) null); + return primaryEntrySet((IgnitePredicate<CacheEntry<K, V>>[])null); } /** {@inheritDoc} */ @Override public Set<K> keySet() { - return keySet((IgnitePredicate<CacheEntry<K, V>>[]) null); + return keySet((IgnitePredicate<CacheEntry<K, V>>[])null); } /** {@inheritDoc} */ @Override public Set<K> primaryKeySet() { - return primaryKeySet((IgnitePredicate<CacheEntry<K, V>>[]) null); + return primaryKeySet((IgnitePredicate<CacheEntry<K, V>>[])null); } /** {@inheritDoc} */ @Override public Collection<V> values() { - return values((IgnitePredicate<CacheEntry<K, V>>[]) null); + return values((IgnitePredicate<CacheEntry<K, V>>[])null); } /** {@inheritDoc} */ @@ -1390,8 +1390,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, return getAllAsync(Collections.singletonList(key), /*force primary*/true, /*skip tx*/false, null, null, taskName, true).chain(new CX1<IgniteInternalFuture<Map<K, V>>, V>() { - @Override - public V applyx(IgniteInternalFuture<Map<K, V>> e) throws IgniteCheckedException { + @Override public V applyx(IgniteInternalFuture<Map<K, V>> e) throws IgniteCheckedException { return e.get().get(key); } }); @@ -1418,7 +1417,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, /** {@inheritDoc} */ @Override public IgniteInternalFuture<V> reloadAsync(K key) { - return reloadAsync(key, (IgnitePredicate<CacheEntry<K, V>>[]) null); + return reloadAsync(key, (IgnitePredicate<CacheEntry<K, V>>[])null); } /** {@inheritDoc} */ @@ -1442,7 +1441,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, @Override public IgniteInternalFuture<?> reloadAllAsync() { ctx.denyOnFlags(F.asList(LOCAL, READ)); - return reloadAllAsync(keySet(), (IgnitePredicate<CacheEntry<K, V>>[]) null); + return reloadAllAsync(keySet(), (IgnitePredicate<CacheEntry<K, V>>[])null); } /** @@ -2137,13 +2136,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); V prevValue = ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) { - @Override - public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { return tx.putAllAsync(ctx, F.t(key, val), true, cached, ttl, filter).get().value(); } - @Override - public String toString() { + @Override public String toString() { return "put [key=" + key + ", val=" + val + ", filter=" + Arrays.toString(filter) + ']'; } })); @@ -2283,13 +2280,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return asyncOp(new AsyncInOp(drMap.keySet()) { - @Override - public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter<K, V> tx) { + @Override public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter<K, V> tx) { return tx.putAllDrAsync(ctx, drMap); } - @Override - public String toString() { + @Override public String toString() { return "putAllDrAsync [drMap=" + drMap + ']'; } }); @@ -2308,12 +2303,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return syncOp(new SyncOp<EntryProcessorResult<T>>(true) { - @Nullable - @Override - public EntryProcessorResult<T> op(IgniteTxLocalAdapter<K, V> tx) + @Nullable @Override public EntryProcessorResult<T> op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = - Collections.singletonMap(key, (EntryProcessor<K, V, Object>) entryProcessor); + Collections.singletonMap(key, (EntryProcessor<K, V, Object>)entryProcessor); IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>> fut = tx.invokeAsync(ctx, invokeMap, args); @@ -2328,7 +2321,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, res = resMap.isEmpty() ? null : resMap.values().iterator().next(); } - return res != null ? res : new CacheInvokeResult<T>((T) null); + return res != null ? res : new CacheInvokeResult<T>((T)null); } }); } @@ -2345,13 +2338,10 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return syncOp(new SyncOp<Map<K, EntryProcessorResult<T>>>(keys.size() == 1) { - @Nullable - @Override - public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx) + @Nullable @Override public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx) throws IgniteCheckedException { Map<? extends K, EntryProcessor<K, V, Object>> invokeMap = F.viewAsMap(keys, new C1<K, EntryProcessor<K, V, Object>>() { - @Override - public EntryProcessor apply(K k) { + @Override public EntryProcessor apply(K k) { return entryProcessor; } }); @@ -2445,8 +2435,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, (IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>>)fut; return fut0.chain(new CX1<IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>>, Map<K, EntryProcessorResult<T>>>() { - @Override - public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>> fut) + @Override public Map<K, EntryProcessorResult<T>> applyx(IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>> fut) throws IgniteCheckedException { GridCacheReturn<Map<K, EntryProcessorResult<T>>> ret = fut.get(); @@ -2506,9 +2495,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return syncOp(new SyncOp<Map<K, EntryProcessorResult<T>>>(map.size() == 1) { - @Nullable - @Override - public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx) + @Nullable @Override public Map<K, EntryProcessorResult<T>> op(IgniteTxLocalAdapter tx) throws IgniteCheckedException { IgniteInternalFuture<GridCacheReturn<Map<K, EntryProcessorResult<T>>>> fut = tx.invokeAsync(ctx, map, args); @@ -2595,14 +2582,12 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); IgniteInternalFuture<V> fut = ctx.wrapClone(asyncOp(new AsyncOp<V>(key) { - @Override - public IgniteInternalFuture<V> op(IgniteTxLocalAdapter<K, V> tx) { + @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter<K, V> tx) { return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, ctx.noPeekArray()) - .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn<V>>, V>) RET2VAL); + .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn<V>>, V>)RET2VAL); } - @Override - public String toString() { + @Override public String toString() { return "putIfAbsentAsync [key=" + key + ", val=" + val + ']'; } })); @@ -2660,14 +2645,12 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); IgniteInternalFuture<Boolean> fut = asyncOp(new AsyncOp<Boolean>(key) { - @Override - public IgniteInternalFuture<Boolean> op(IgniteTxLocalAdapter<K, V> tx) { + @Override public IgniteInternalFuture<Boolean> op(IgniteTxLocalAdapter<K, V> tx) { return tx.putAllAsync(ctx, F.t(key, val), false, null, -1, ctx.noPeekArray()).chain( - (IgniteClosure<IgniteInternalFuture<GridCacheReturn<V>>, Boolean>) RET2FLAG); + (IgniteClosure<IgniteInternalFuture<GridCacheReturn<V>>, Boolean>)RET2FLAG); } - @Override - public String toString() { + @Override public String toString() { return "putxIfAbsentAsync [key=" + key + ", val=" + val + ']'; } }); @@ -2690,13 +2673,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) { - @Override - public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { return tx.putAllAsync(ctx, F.t(key, val), true, null, -1, ctx.hasPeekArray()).get().value(); } - @Override - public String toString() { + @Override public String toString() { return "replace [key=" + key + ", val=" + val + ']'; } })); @@ -2928,18 +2909,16 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, validateCacheKey(key); V prevVal = ctx.cloneOnFlag(syncOp(new SyncOp<V>(true) { - @Override - public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public V op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { V ret = tx.removeAllAsync(ctx, Collections.singletonList(key), entry, true, filter).get().value(); if (ctx.config().getInterceptor() != null) - return (V) ctx.config().getInterceptor().onBeforeRemove(key, ret).get2(); + return (V)ctx.config().getInterceptor().onBeforeRemove(key, ret).get2(); return ret; } - @Override - public String toString() { + @Override public String toString() { return "remove [key=" + key + ", filter=" + Arrays.toString(filter) + ']'; } })); @@ -2979,15 +2958,13 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, validateCacheKey(key); IgniteInternalFuture<V> fut = ctx.wrapClone(asyncOp(new AsyncOp<V>(key) { - @Override - public IgniteInternalFuture<V> op(IgniteTxLocalAdapter<K, V> tx) { + @Override public IgniteInternalFuture<V> op(IgniteTxLocalAdapter<K, V> tx) { // TODO should we invoke interceptor here? return tx.removeAllAsync(ctx, Collections.singletonList(key), null, true, filter) .chain((IgniteClosure<IgniteInternalFuture<GridCacheReturn<V>>, V>) RET2VAL); } - @Override - public String toString() { + @Override public String toString() { return "removeAsync [key=" + key + ", filter=" + Arrays.toString(filter) + ']'; } })); @@ -3056,13 +3033,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); IgniteInternalFuture<Object> fut = asyncOp(new AsyncInOp(keys) { - @Override - public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter<K, V> tx) { + @Override public IgniteInternalFuture<?> inOp(IgniteTxLocalAdapter<K, V> tx) { return tx.removeAllAsync(ctx, keys, null, false, filter); } - @Override - public String toString() { + @Override public String toString() { return "removeAllAsync [keys=" + keys + ", filter=" + Arrays.toString(filter) + ']'; } }); @@ -3103,13 +3078,11 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, validateCacheKey(key); boolean removed = syncOp(new SyncOp<Boolean>(true) { - @Override - public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public Boolean op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { return tx.removeAllAsync(ctx, Collections.singletonList(key), entry, false, filter).get().success(); } - @Override - public String toString() { + @Override public String toString() { return "removex [key=" + key + ", filter=" + Arrays.toString(filter) + ']'; } }); @@ -3168,8 +3141,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, validateCacheKey(key); return syncOp(new SyncOp<GridCacheReturn<V>>(true) { - @Override - public GridCacheReturn<V> op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public GridCacheReturn<V> op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { // Register before hiding in the filter. if (ctx.deploymentEnabled()) ctx.deploy().registerClass(val); @@ -3178,8 +3150,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.vararg(F.<K, V>cacheContainsPeek(val))).get(); } - @Override - public String toString() { + @Override public String toString() { return "remove [key=" + key + ", val=" + val + ']'; } }); @@ -3236,8 +3207,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, ctx.denyOnLocalRead(); return syncOp(new SyncOp<GridCacheReturn<V>>(true) { - @Override - public GridCacheReturn<V> op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { + @Override public GridCacheReturn<V> op(IgniteTxLocalAdapter<K, V> tx) throws IgniteCheckedException { // Register before hiding in the filter. if (ctx.deploymentEnabled()) ctx.deploy().registerClass(oldVal); @@ -3245,8 +3215,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, return tx.putAllAsync(ctx, F.t(key, newVal), true, null, -1, ctx.equalsPeekArray(oldVal)).get(); } - @Override - public String toString() { + @Override public String toString() { return "replace [key=" + key + ", oldVal=" + oldVal + ", newVal=" + newVal + ']'; } }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index b5c91a3..bf8c252 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -30,13 +30,6 @@ import org.apache.ignite.fs.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.cache.datastructures.*; -import org.apache.ignite.internal.processors.datastructures.*; -import org.apache.ignite.internal.processors.cache.version.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.lifecycle.LifecycleAware; -import org.apache.ignite.spi.*; -import org.apache.ignite.internal.processors.cache.datastructures.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*; import org.apache.ignite.internal.processors.cache.distributed.dht.colocated.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java index d47b40f..074c4bf 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/datastructures/CacheDataStructuresManager.java @@ -120,7 +120,7 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K, U.await(initLatch); if (!initFlag) - throw new IgniteCheckedException("DataStructures processor was not properly initialized."); + throw new IgniteCheckedException("DataStructures manager was not properly initialized."); } /** @@ -175,8 +175,8 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K, if (old != null) { if (old.capacity() != cap || old.collocated() != colloc) - throw new IgniteCheckedException("Failed to create queue, queue with the same name but different " + - "configuration already exists [name=" + name + ']'); + throw new IgniteCheckedException("Failed to create queue, queue with the same name but " + + "different configuration already exists [name=" + name + ']'); hdr = old; } @@ -415,7 +415,6 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K, /** * @param id Set ID. - * @return {@code True} if set was removed. * @throws IgniteCheckedException If failed. */ @SuppressWarnings("unchecked") @@ -512,23 +511,7 @@ public class CacheDataStructuresManager<K, V> extends GridCacheManagerAdapter<K, throws IgniteCheckedException { return CacheDataStructuresProcessor.retry(log, new Callable<T>() { @Nullable @Override public T call() throws Exception { - return (T) cache.putIfAbsent(key, val); - } - }); - } - - - /** - * @param cache Cache. - * @param key Key to remove. - * @throws IgniteCheckedException If failed. - * @return Removed value. - */ - @SuppressWarnings("unchecked") - @Nullable private <T> T retryRemove(final GridCache cache, final Object key) throws IgniteCheckedException { - return CacheDataStructuresProcessor.retry(log, new Callable<T>() { - @Nullable @Override public T call() throws Exception { - return (T) cache.remove(key); + return (T)cache.putIfAbsent(key, val); } }); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java index 0a6b98e..7164b00 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java @@ -23,18 +23,11 @@ import org.apache.ignite.cache.query.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.datastructures.*; -import org.apache.ignite.internal.util.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.resources.*; -import org.apache.ignite.spi.*; -import org.apache.ignite.spi.indexing.*; import org.apache.ignite.internal.managers.eventstorage.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.processors.cache.datastructures.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.version.*; +import org.apache.ignite.internal.processors.datastructures.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.processors.task.*; import org.apache.ignite.internal.util.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresProcessor.java index 951e42d..f736c5c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/CacheDataStructuresProcessor.java @@ -19,19 +19,17 @@ package org.apache.ignite.internal.processors.datastructures; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.*; import org.apache.ignite.internal.processors.cache.*; +import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.lang.*; -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.*; +import org.apache.ignite.lang.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -41,9 +39,10 @@ import java.util.*; import java.util.concurrent.*; import static org.apache.ignite.internal.processors.cache.CacheFlag.*; +import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; +import static org.apache.ignite.internal.processors.datastructures.CacheDataStructuresProcessor.DataStructureType.*; import static org.apache.ignite.transactions.IgniteTxConcurrency.*; import static org.apache.ignite.transactions.IgniteTxIsolation.*; -import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*; /** * Manager of data structures. @@ -157,16 +156,10 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { checkAtomicsConfiguration(); - final GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); + return getAtomic(new IgniteOutClosureX<IgniteAtomicSequence>() { + @Override public IgniteAtomicSequence applyx() throws IgniteCheckedException { + GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - // Check type of structure received by key from local cache. - IgniteAtomicSequence val = cast(dsMap.get(key), IgniteAtomicSequence.class); - - if (val != null) - return val; - - return getAtomic(new Callable<IgniteAtomicSequence>() { - @Override public IgniteAtomicSequence call() throws Exception { dsCacheCtx.gate().enter(); try (IgniteInternalTx tx = CU.txStartInternal(dsCacheCtx, dsView, PESSIMISTIC, REPEATABLE_READ)) { @@ -237,7 +230,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, new DataStructureInfo(name, DataStructureType.ATOMIC_SEQ, null), create); + }, new DataStructureInfo(name, ATOMIC_SEQ, null), create, IgniteAtomicSequence.class); } /** @@ -269,7 +262,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { return null; } - }, name, DataStructureType.ATOMIC_SEQ, null); + }, name, ATOMIC_SEQ, null); } /** @@ -282,22 +275,17 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { * @return Atomic long. * @throws IgniteCheckedException If loading failed. */ - public final IgniteAtomicLong atomicLong(final String name, final long initVal, + public final IgniteAtomicLong atomicLong(final String name, + final long initVal, final boolean create) throws IgniteCheckedException { A.notNull(name, "name"); checkAtomicsConfiguration(); - final GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - - // Check type of structure received by key from local cache. - IgniteAtomicLong atomicLong = cast(dsMap.get(key), IgniteAtomicLong.class); + return getAtomic(new IgniteOutClosureX<IgniteAtomicLong>() { + @Override public IgniteAtomicLong applyx() throws IgniteCheckedException { + final GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - if (atomicLong != null) - return atomicLong; - - return getAtomic(new Callable<IgniteAtomicLong>() { - @Override public IgniteAtomicLong call() throws Exception { dsCacheCtx.gate().enter(); try (IgniteInternalTx tx = CU.txStartInternal(dsCacheCtx, dsView, PESSIMISTIC, REPEATABLE_READ)) { @@ -340,19 +328,21 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, new DataStructureInfo(name, DataStructureType.ATOMIC_LONG, null), create); + }, new DataStructureInfo(name, ATOMIC_LONG, null), create, IgniteAtomicLong.class); } /** * @param c Closure creating data structure instance. * @param dsInfo Data structure info. * @param create Create flag. + * @param cls Expected data structure class. * @return Data structure instance. - * @throws IgniteCheckedException + * @throws IgniteCheckedException If failed. */ - @Nullable private <T> T getAtomic(Callable<T> c, + @Nullable private <T> T getAtomic(final IgniteOutClosureX<T> c, DataStructureInfo dsInfo, - boolean create) + boolean create, + Class<? extends T> cls) throws IgniteCheckedException { Map<String, DataStructureInfo> dsMap = utilityCache.get(DATA_STRUCTURES_KEY); @@ -365,29 +355,28 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { if (err != null) throw err; - T dataStructure; + final GridCacheInternalKey key = new GridCacheInternalKeyImpl(dsInfo.name); - try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { - if (create) { - err = utilityCache.invoke(DATA_STRUCTURES_KEY, new AddAtomicProcessor(dsInfo)).get(); + // Check type of structure received by key from local cache. + T dataStructure = cast(this.dsMap.get(key), cls); - if (err != null) - throw err; - } - else { - T2<Boolean, IgniteCheckedException> res = - utilityCache.invoke(DATA_STRUCTURES_KEY, new ContainsAtomicProcessor(dsInfo)).get(); + if (dataStructure != null) + return dataStructure; - err = res.get2(); + if (!create) + return c.applyx(); - if (err != null) - throw err; + try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { + err = utilityCache.invoke(DATA_STRUCTURES_KEY, new AddAtomicProcessor(dsInfo)).get(); - if (!res.get1()) - return null; - } + if (err != null) + throw err; - dataStructure = ctx.closure().callLocalSafe(c, false).get(); + dataStructure = ctx.closure().callLocalSafe(new Callable<T>() { + @Override public T call() throws Exception { + return c.applyx(); + } + }, false).get(); tx.commit(); } @@ -421,13 +410,14 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { return null; } - }, name, DataStructureType.ATOMIC_LONG, null); + }, name, ATOMIC_LONG, null); } /** * @param c Closure. * @param name Data structure name. * @param type Data structure type. + * @param afterRmv Optional closure to run after data structure removed. * @throws IgniteCheckedException If failed. */ private <T> void removeDataStructure(IgniteCallable<T> c, @@ -459,11 +449,12 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { if (err != null) throw err; - if (!res.get1()) { - tx.commit(); + assert res.get1() != null; + + boolean exists = res.get1(); + if (!exists) return; - } rmvInfo = ctx.closure().callLocalSafe(c, false).get(); @@ -494,16 +485,10 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { checkAtomicsConfiguration(); - final GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); + return getAtomic(new IgniteOutClosureX<IgniteAtomicReference>() { + @Override public IgniteAtomicReference<T> applyx() throws IgniteCheckedException { + GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - // Check type of structure received by key from local cache. - IgniteAtomicReference atomicRef = cast(dsMap.get(key), IgniteAtomicReference.class); - - if (atomicRef != null) - return atomicRef; - - return getAtomic(new Callable<IgniteAtomicReference<T>>() { - @Override public IgniteAtomicReference<T> call() throws Exception { dsCacheCtx.gate().enter(); try (IgniteInternalTx tx = CU.txStartInternal(dsCacheCtx, dsView, PESSIMISTIC, REPEATABLE_READ)) { @@ -548,7 +533,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, new DataStructureInfo(name, DataStructureType.ATOMIC_REF, null), create); + }, new DataStructureInfo(name, ATOMIC_REF, null), create, IgniteAtomicReference.class); } /** @@ -579,7 +564,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { return null; } - }, name, DataStructureType.ATOMIC_REF, null); + }, name, ATOMIC_REF, null); } /** @@ -601,16 +586,10 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { checkAtomicsConfiguration(); - final GridCacheInternalKeyImpl key = new GridCacheInternalKeyImpl(name); - - // Check type of structure received by key from local cache. - IgniteAtomicStamped atomicStamped = cast(dsMap.get(key), IgniteAtomicStamped.class); - - if (atomicStamped != null) - return atomicStamped; + return getAtomic(new IgniteOutClosureX<IgniteAtomicStamped>() { + @Override public IgniteAtomicStamped<T, S> applyx() throws IgniteCheckedException { + GridCacheInternalKeyImpl key = new GridCacheInternalKeyImpl(name); - return getAtomic(new Callable<IgniteAtomicStamped<T, S>>() { - @Override public IgniteAtomicStamped<T, S> call() throws Exception { dsCacheCtx.gate().enter(); try (IgniteInternalTx tx = CU.txStartInternal(dsCacheCtx, dsView, PESSIMISTIC, REPEATABLE_READ)) { @@ -655,7 +634,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, new DataStructureInfo(name, DataStructureType.ATOMIC_STAMPED, null), create); + }, new DataStructureInfo(name, ATOMIC_STAMPED, null), create, IgniteAtomicStamped.class); } /** @@ -686,7 +665,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { return null; } - }, name, DataStructureType.ATOMIC_STAMPED, null); + }, name, ATOMIC_STAMPED, null); } /** @@ -718,7 +697,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { } DataStructureInfo dsInfo = new DataStructureInfo(name, - DataStructureType.QUEUE, + QUEUE, create ? new QueueInfo(cfg.getCacheName(), cfg.isCollocated(), cap) : null); final int cap0 = cap; @@ -733,7 +712,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { /** * @param name Queue name. * @param cctx Queue cache context. - * @throws IgniteCheckedException + * @throws IgniteCheckedException If failed. */ public void removeQueue(final String name, final GridCacheContext cctx) throws IgniteCheckedException { assert name != null; @@ -760,7 +739,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { } }; - removeDataStructure(rmv, name, DataStructureType.QUEUE, afterRmv); + removeDataStructure(rmv, name, QUEUE, afterRmv); } /** @@ -785,36 +764,30 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { if (err != null) throw err; - T col; + if (!create) { + DataStructureInfo oldInfo = dsMap.get(dsInfo.name); - try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { - final String cacheName; + assert oldInfo.info instanceof CollectionInfo : oldInfo.info; - if (create) { - T2<String, IgniteCheckedException> res = - utilityCache.invoke(DATA_STRUCTURES_KEY, new AddCollectionProcessor(dsInfo)).get(); + String cacheName = ((CollectionInfo)oldInfo.info).cacheName; - err = res.get2(); + GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context(); - if (err != null) - throw err; + return c.applyx(cacheCtx); + } - cacheName = res.get1(); - } - else { - T3<Boolean, String, IgniteCheckedException> res = - utilityCache.invoke(DATA_STRUCTURES_KEY, new ContainsCollectionProcessor(dsInfo)).get(); + T col; - err = res.get3(); + try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { + T2<String, IgniteCheckedException> res = + utilityCache.invoke(DATA_STRUCTURES_KEY, new AddCollectionProcessor(dsInfo)).get(); - if (err != null) - throw err; + err = res.get2(); - if (!res.get1()) - return null; + if (err != null) + throw err; - cacheName = res.get2(); - } + String cacheName = res.get1(); final GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context(); @@ -833,6 +806,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { /** * @param dsMap Map with data structure information. * @param info New data structure information. + * @param create Create flag. * @return {@link IgniteException} if validation failed. */ @Nullable private static IgniteCheckedException validateDataStructure( @@ -878,16 +852,10 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { checkAtomicsConfiguration(); - final GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - - // Check type of structure received by key from local cache. - GridCacheCountDownLatchEx latch = cast(dsMap.get(key), GridCacheCountDownLatchEx.class); - - if (latch != null) - return latch; + return getAtomic(new IgniteOutClosureX<IgniteCountDownLatch>() { + @Override public IgniteCountDownLatch applyx() throws IgniteCheckedException { + GridCacheInternalKey key = new GridCacheInternalKeyImpl(name); - return getAtomic(new Callable<IgniteCountDownLatch>() { - @Override public IgniteCountDownLatch call() throws Exception { dsCacheCtx.gate().enter(); try (IgniteInternalTx tx = CU.txStartInternal(dsCacheCtx, dsView, PESSIMISTIC, REPEATABLE_READ)) { @@ -932,7 +900,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, new DataStructureInfo(name, DataStructureType.COUNT_DOWN_LATCH, null), create); + }, new DataStructureInfo(name, COUNT_DOWN_LATCH, null), create, GridCacheCountDownLatchEx.class); } /** @@ -978,7 +946,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { dsCacheCtx.gate().leave(); } } - }, name, DataStructureType.COUNT_DOWN_LATCH, null); + }, name, COUNT_DOWN_LATCH, null); } /** @@ -1103,7 +1071,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { } DataStructureInfo dsInfo = new DataStructureInfo(name, - DataStructureType.SET, + SET, create ? new CollectionInfo(cfg.getCacheName(), cfg.isCollocated()) : null); return getCollection(new CX1<GridCacheContext, IgniteSet<T>>() { @@ -1116,7 +1084,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { /** * @param name Set name. * @param cctx Set cache context. - * @throws IgniteCheckedException + * @throws IgniteCheckedException If failed. */ public void removeSet(final String name, final GridCacheContext cctx) throws IgniteCheckedException { assert name != null; @@ -1134,7 +1102,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { } }; - removeDataStructure(rmv, name, DataStructureType.SET, afterRmv); + removeDataStructure(rmv, name, SET, afterRmv); } /** @@ -1297,7 +1265,8 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { // No-op. } - /** + /* + * @param cacheName Collection cache name. * @param collocated Collocated flag. */ public CollectionInfo(String cacheName, boolean collocated) { @@ -1416,7 +1385,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { } if (create) { - if (type == DataStructureType.QUEUE || type == DataStructureType.SET) { + if (type == QUEUE || type == SET) { CollectionInfo oldInfo = (CollectionInfo)info; CollectionInfo newInfo = (CollectionInfo)dsInfo.info; @@ -1427,7 +1396,7 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { ", existingCollocated=" + newInfo.collocated + ']'); } - if (type == DataStructureType.QUEUE) { + if (type == QUEUE) { if (((QueueInfo)oldInfo).cap != ((QueueInfo)newInfo).cap) { return new IgniteCheckedException("Another queue with the same name but different " + "configuration already created [name=" + name + @@ -1464,128 +1433,6 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { /** * */ - static class ContainsAtomicProcessor implements - EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, T2<Boolean, IgniteCheckedException>>, - Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private DataStructureInfo info; - - /** - * @param info Data structure information. - */ - ContainsAtomicProcessor(DataStructureInfo info) { - assert info != null; - - this.info = info; - } - - /** - * Required by {@link Externalizable}. - */ - public ContainsAtomicProcessor() { - // No-op. - } - - /** {@inheritDoc} */ - @Override public T2<Boolean, IgniteCheckedException> process( - MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>> entry, - Object... args) - throws EntryProcessorException - { - Map<String, DataStructureInfo> map = entry.getValue(); - - if (map == null) - return new T2<>(false, null); - - DataStructureInfo oldInfo = map.get(info.name); - - if (oldInfo == null) - return new T2<>(false, null); - - return new T2<>(true, oldInfo.validate(info, false)); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - info.writeExternal(out); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - info = new DataStructureInfo(); - - info.readExternal(in); - } - } - - /** - * - */ - static class ContainsCollectionProcessor implements - EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, T3<Boolean, String, IgniteCheckedException>>, - Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** */ - private DataStructureInfo info; - - /** - * @param info Data structure information. - */ - ContainsCollectionProcessor(DataStructureInfo info) { - assert info != null; - - this.info = info; - } - - /** - * Required by {@link Externalizable}. - */ - public ContainsCollectionProcessor() { - // No-op. - } - - /** {@inheritDoc} */ - @Override public T3<Boolean, String, IgniteCheckedException> process( - MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>> entry, - Object... args) - throws EntryProcessorException - { - Map<String, DataStructureInfo> map = entry.getValue(); - - if (map == null) - return new T3<>(false, null, null); - - DataStructureInfo oldInfo = map.get(info.name); - - if (oldInfo == null) - return new T3<>(false, null, null); - - assert oldInfo.info instanceof CollectionInfo : oldInfo.info; - - return new T3<>(true, ((CollectionInfo)oldInfo.info).cacheName, oldInfo.validate(info, false)); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - info.writeExternal(out); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - info = new DataStructureInfo(); - - info.readExternal(in); - } - } - - /** - * - */ static class AddAtomicProcessor implements EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, IgniteCheckedException>, Externalizable { @@ -1655,14 +1502,19 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { info.readExternal(in); } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(AddAtomicProcessor.class, this); + } } /** * */ static class AddCollectionProcessor implements - EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, T2<String, IgniteCheckedException>>, - Externalizable { + EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, + T2<String, IgniteCheckedException>>, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -1690,7 +1542,6 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { @Override public T2<String, IgniteCheckedException> process( MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>> entry, Object... args) - throws EntryProcessorException { Map<String, DataStructureInfo> map = entry.getValue(); @@ -1732,14 +1583,19 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { info.readExternal(in); } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(AddCollectionProcessor.class, this); + } } /** * */ static class RemoveDataStructureProcessor implements - EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, T2<Boolean, IgniteCheckedException>>, - Externalizable { + EntryProcessor<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>, + T2<Boolean, IgniteCheckedException>>, Externalizable { /** */ private static final long serialVersionUID = 0L; @@ -1766,7 +1622,6 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { @Override public T2<Boolean, IgniteCheckedException> process( MutableEntry<CacheDataStructuresConfigurationKey, Map<String, DataStructureInfo>> entry, Object... args) - throws EntryProcessorException { Map<String, DataStructureInfo> map = entry.getValue(); @@ -1802,5 +1657,10 @@ public final class CacheDataStructuresProcessor extends GridProcessorAdapter { info.readExternal(in); } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(RemoveDataStructureProcessor.class, this); + } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06d8f2c4/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java index 6670e77..4eb8a43 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheAtomicLongImpl.java @@ -223,75 +223,119 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ext } /** {@inheritDoc} */ - @Override public long get() throws IgniteCheckedException { + @Override public long get() { checkRemoved(); - return CU.outTx(getCall, ctx); + try { + return CU.outTx(getCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long incrementAndGet() throws IgniteCheckedException { + @Override public long incrementAndGet() { checkRemoved(); - return CU.outTx(incAndGetCall, ctx); + try{ + return CU.outTx(incAndGetCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndIncrement() throws IgniteCheckedException { + @Override public long getAndIncrement() { checkRemoved(); - return CU.outTx(getAndIncCall, ctx); + try { + return CU.outTx(getAndIncCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long addAndGet(long l) throws IgniteCheckedException { + @Override public long addAndGet(long l) { checkRemoved(); - return CU.outTx(internalAddAndGet(l), ctx); + try { + return CU.outTx(internalAddAndGet(l), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndAdd(long l) throws IgniteCheckedException { + @Override public long getAndAdd(long l) { checkRemoved(); - return CU.outTx(internalGetAndAdd(l), ctx); + try { + return CU.outTx(internalGetAndAdd(l), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long decrementAndGet() throws IgniteCheckedException { + @Override public long decrementAndGet() { checkRemoved(); - return CU.outTx(decAndGetCall, ctx); + try { + return CU.outTx(decAndGetCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndDecrement() throws IgniteCheckedException { + @Override public long getAndDecrement() { checkRemoved(); - return CU.outTx(getAndDecCall, ctx); + try { + return CU.outTx(getAndDecCall, ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public long getAndSet(long l) throws IgniteCheckedException { + @Override public long getAndSet(long l) { checkRemoved(); - return CU.outTx(internalGetAndSet(l), ctx); + try { + return CU.outTx(internalGetAndSet(l), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** {@inheritDoc} */ - @Override public boolean compareAndSet(long expVal, long newVal) - throws IgniteCheckedException { + @Override public boolean compareAndSet(long expVal, long newVal) { checkRemoved(); - return CU.outTx(internalCompareAndSet(expVal, newVal), ctx); + try { + return CU.outTx(internalCompareAndSet(expVal, newVal), ctx); + } + catch (IgniteCheckedException e) { + throw U.convertException(e); + } } /** * Check removed flag. * - * @throws IgniteCheckedException If removed. + * @throws DataStructureRemovedException If removed. */ - private void checkRemoved() throws IgniteCheckedException { + private void checkRemoved() throws DataStructureRemovedException { if (rmvd) throw new DataStructureRemovedException("Atomic long was removed from cache: " + name); } @@ -325,7 +369,7 @@ public final class GridCacheAtomicLongImpl implements GridCacheAtomicLongEx, Ext ctx.kernalContext().dataStructures().removeAtomicLong(name); } catch (IgniteCheckedException e) { - throw new IgniteException(e); + throw U.convertException(e); } }