http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinGlobalLoadBalancer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinGlobalLoadBalancer.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinGlobalLoadBalancer.java index e17231a..a6efebc 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinGlobalLoadBalancer.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinGlobalLoadBalancer.java @@ -129,9 +129,9 @@ class RoundRobinGlobalLoadBalancer { * * @param top Topology to pick from. * @return Best balanced node. - * @throws GridException Thrown in case of any error. + * @throws IgniteCheckedException Thrown in case of any error. */ - ClusterNode getBalancedNode(Collection<ClusterNode> top) throws GridException { + ClusterNode getBalancedNode(Collection<ClusterNode> top) throws IgniteCheckedException { assert !F.isEmpty(top); awaitInitializationCompleted(); @@ -150,7 +150,7 @@ class RoundRobinGlobalLoadBalancer { int cycleSize = nodes.size(); if (cycleSize == 0) - throw new GridException("Task topology does not have any alive nodes."); + throw new IgniteCheckedException("Task topology does not have any alive nodes."); AtomicInteger idx; @@ -217,10 +217,10 @@ class RoundRobinGlobalLoadBalancer { * @param top Topology for current request. * @param topMap Topology map. * @param nodes Current balanced nodes. - * @throws GridException If balancer can not return any node. + * @throws IgniteCheckedException If balancer can not return any node. */ private static void checkBalancerNodes(Collection<ClusterNode> top, Map<UUID, ClusterNode> topMap, Iterable<UUID> nodes) - throws GridException { + throws IgniteCheckedException { boolean contains = false; @@ -233,15 +233,15 @@ class RoundRobinGlobalLoadBalancer { } if (!contains) - throw new GridException("Task topology does not have alive nodes: " + top); + throw new IgniteCheckedException("Task topology does not have alive nodes: " + top); } /** * Awaits initialization of balancing nodes to be completed. * - * @throws GridException Thrown in case of thread interruption. + * @throws IgniteCheckedException Thrown in case of thread interruption. */ - private void awaitInitializationCompleted() throws GridException { + private void awaitInitializationCompleted() throws IgniteCheckedException { try { if (initLatch.getCount() > 0) initLatch.await(); @@ -249,7 +249,7 @@ class RoundRobinGlobalLoadBalancer { catch (InterruptedException e) { Thread.currentThread().interrupt(); - throw new GridException("Global balancer was interrupted.", e); + throw new IgniteCheckedException("Global balancer was interrupted.", e); } }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java index 069c7eb..e1f5ea1 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/roundrobin/RoundRobinLoadBalancingSpi.java @@ -52,7 +52,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * <pre name="code" class="java"> * public class MyFooBarTask extends GridComputeTaskSplitAdapter<Object, Object> { * @Override - * protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws GridException { + * protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws IgniteCheckedException { * List<MyFooBarJob> jobs = new ArrayList<MyFooBarJob>(gridSize); * * for (int i = 0; i < gridSize; i++) { @@ -78,7 +78,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * GridComputeLoadBalancer balancer; * * // Map jobs to grid nodes. - * public Map<? extends ComputeJob, GridNode> map(List<GridNode> subgrid, String arg) throws GridException { + * public Map<? extends ComputeJob, GridNode> map(List<GridNode> subgrid, String arg) throws IgniteCheckedException { * Map<MyFooBarJob, GridNode> jobs = new HashMap<MyFooBarJob, GridNode>(subgrid.size()); * * // In more complex cases, you can actually do @@ -92,7 +92,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * } * * // Aggregate results into one compound result. - * public String reduce(List<GridComputeJobResult> results) throws GridException { + * public String reduce(List<GridComputeJobResult> results) throws IgniteCheckedException { * // For the purpose of this example we simply * // concatenate string representation of every * // job result @@ -270,7 +270,7 @@ public class RoundRobinLoadBalancingSpi extends IgniteSpiAdapter implements Load /** {@inheritDoc} */ @Override public ClusterNode getBalancedNode(ComputeTaskSession ses, List<ClusterNode> top, ComputeJob job) - throws GridException { + throws IgniteCheckedException { A.notNull(ses, "ses", top, "top"); if (isPerTask) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java index bd629e6..02c608e 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/weightedrandom/WeightedRandomLoadBalancingSpi.java @@ -41,7 +41,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * <pre name="code" class="java"> * public class MyFooBarTask extends GridComputeTaskSplitAdapter<Object, Object> { * @Override - * protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws GridException { + * protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws IgniteCheckedException { * List<MyFooBarJob> jobs = new ArrayList<MyFooBarJob>(gridSize); * * for (int i = 0; i < gridSize; i++) { @@ -67,7 +67,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * GridComputeLoadBalancer balancer; * * // Map jobs to grid nodes. - * public Map<? extends ComputeJob, GridNode> map(List<GridNode> subgrid, String arg) throws GridException { + * public Map<? extends ComputeJob, GridNode> map(List<GridNode> subgrid, String arg) throws IgniteCheckedException { * Map<MyFooBarJob, GridNode> jobs = new HashMap<MyFooBarJob, GridNode>(subgrid.size()); * * // In more complex cases, you can actually do @@ -81,7 +81,7 @@ import static org.apache.ignite.events.IgniteEventType.*; * } * * // Aggregate results into one compound result. - * public String reduce(List<GridComputeJobResult> results) throws GridException { + * public String reduce(List<GridComputeJobResult> results) throws IgniteCheckedException { * // For the purpose of this example we simply * // concatenate string representation of every * // job result http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java index 1af22f3..45406dc 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java @@ -267,7 +267,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, try { dir = U.resolveWorkDirectory(path, true); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IgniteSpiException(e); } @@ -524,7 +524,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, private IgniteSpiCloseableIterator<Map.Entry<byte[], byte[]>> rawIterator( final Iterator<Map.Entry<SwapKey, byte[]>> iter) { return new GridCloseableIteratorAdapter<Map.Entry<byte[], byte[]>>() { - @Override protected Map.Entry<byte[], byte[]> onNext() throws GridException { + @Override protected Map.Entry<byte[], byte[]> onNext() throws IgniteCheckedException { Map.Entry<SwapKey, byte[]> x = iter.next(); return new T2<>(keyBytes(x.getKey()), x.getValue()); @@ -556,7 +556,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, try { keyBytes = marsh.marshal(key.key()); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IgniteSpiException("Failed to marshal key: " + key.key(), e); } @@ -1434,7 +1434,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, f.write(vals, sign); } catch (Exception e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } } } @@ -1467,7 +1467,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, buf = c.compact(vals, writeBufSize); } catch (IOException e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } } @@ -1493,7 +1493,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, w.write(vals, buf, sign); } catch (Exception e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } } } @@ -1508,7 +1508,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, } }); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IgniteSpiException(e); } } @@ -1797,7 +1797,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, bytes = entry.getValue().value(Space.this); } catch (IgniteSpiException e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } if (bytes != null) { @@ -1831,7 +1831,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi, Space.this.remove(last.getKey(), false); } catch (IgniteSpiException e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } finally { last = null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerContext.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerContext.java index 5f2b284..e435a7b 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerContext.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerContext.java @@ -9,9 +9,9 @@ package org.apache.ignite.streamer; +import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import java.util.*; import java.util.concurrent.*; @@ -67,9 +67,9 @@ public interface StreamerContext { * * @param clo Function to be executed on individual nodes. * @return Result received from all streamers. - * @throws GridException If query execution failed. + * @throws IgniteCheckedException If query execution failed. */ - public <R> Collection<R> query(IgniteClosure<StreamerContext, R> clo) throws GridException; + public <R> Collection<R> query(IgniteClosure<StreamerContext, R> clo) throws IgniteCheckedException; /** * Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes @@ -80,19 +80,19 @@ public interface StreamerContext { * @param nodes Optional list of nodes to execute query on, if empty, then all nodes on * which this streamer is running will be queried. * @return Result received from all streamers. - * @throws GridException If query execution failed. + * @throws IgniteCheckedException If query execution failed. */ public <R> Collection<R> query(IgniteClosure<StreamerContext, R> clo, Collection<ClusterNode> nodes) - throws GridException; + throws IgniteCheckedException; /** * Queries all streamer nodes deployed within grid. Given closure will be executed on each streamer node * in the grid. No result is collected. * * @param clo Function to be executed on individual nodes. - * @throws GridException If closure execution failed. + * @throws IgniteCheckedException If closure execution failed. */ - public void broadcast(IgniteInClosure<StreamerContext> clo) throws GridException; + public void broadcast(IgniteInClosure<StreamerContext> clo) throws IgniteCheckedException; /** * Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes on @@ -101,9 +101,9 @@ public interface StreamerContext { * @param clo Function to be executed on individual nodes. * @param nodes Optional list of nodes to execute query on, if empty, then all nodes on * which this streamer is running will be queried. - * @throws GridException If closure execution failed. + * @throws IgniteCheckedException If closure execution failed. */ - public void broadcast(IgniteInClosure<StreamerContext> clo, Collection<ClusterNode> nodes) throws GridException; + public void broadcast(IgniteInClosure<StreamerContext> clo, Collection<ClusterNode> nodes) throws IgniteCheckedException; /** * Queries all streamer nodes deployed within grid. Given closure will be executed on each streamer node in @@ -113,9 +113,9 @@ public interface StreamerContext { * @param clo Function to be executed on individual nodes. * @param rdc Reducer to reduce results received from remote nodes. * @return Reducer result. - * @throws GridException If query execution failed. + * @throws IgniteCheckedException If query execution failed. */ - public <R1, R2> R2 reduce(IgniteClosure<StreamerContext, R1> clo, IgniteReducer<R1, R2> rdc) throws GridException; + public <R1, R2> R2 reduce(IgniteClosure<StreamerContext, R1> clo, IgniteReducer<R1, R2> rdc) throws IgniteCheckedException; /** * Queries streamer nodes deployed within grid. Given closure will be executed on those of passed nodes on which @@ -127,8 +127,8 @@ public interface StreamerContext { * @param nodes Optional list of nodes to execute query on, if empty, then all nodes on * which this streamer is running will be queried. * @return Reducer result. - * @throws GridException If query execution failed. + * @throws IgniteCheckedException If query execution failed. */ public <R1, R2> R2 reduce(IgniteClosure<StreamerContext, R1> clo, IgniteReducer<R1, R2> rdc, - Collection<ClusterNode> nodes) throws GridException; + Collection<ClusterNode> nodes) throws IgniteCheckedException; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java index b028dfa..1088908 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerStage.java @@ -9,7 +9,7 @@ package org.apache.ignite.streamer; -import org.gridgain.grid.*; +import org.apache.ignite.*; import org.jetbrains.annotations.*; import java.util.*; @@ -46,8 +46,8 @@ public interface StreamerStage<IN> { * @param ctx Streamer context. * @param evts Input events. * @return Map of stage name to collection of events. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ @Nullable public Map<String, Collection<?>> run(StreamerContext ctx, Collection<IN> evts) - throws GridException; + throws IgniteCheckedException; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java index 24b74ad..b5c288a 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/StreamerWindow.java @@ -9,8 +9,8 @@ package org.apache.ignite.streamer; +import org.apache.ignite.*; import org.apache.ignite.streamer.index.*; -import org.gridgain.grid.*; import org.jetbrains.annotations.*; import java.util.*; @@ -95,18 +95,18 @@ public interface StreamerWindow<E> extends Iterable<E> { * * @param evt Event to add. * @return {@code True} if event was added. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public boolean enqueue(E evt) throws GridException; + public boolean enqueue(E evt) throws IgniteCheckedException; /** * Adds events to window. * * @param evts Events to add. * @return {@code} - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public boolean enqueue(E... evts) throws GridException; + public boolean enqueue(E... evts) throws IgniteCheckedException; /** * Adds all events to window. @@ -114,17 +114,17 @@ public interface StreamerWindow<E> extends Iterable<E> { * @param evts Collection of events to add. * @return {@code True} if all events were added, {@code false} if at * least 1 event was skipped. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public boolean enqueueAll(Collection<E> evts) throws GridException; + public boolean enqueueAll(Collection<E> evts) throws IgniteCheckedException; /** * Dequeues last element from windows. Will return {@code null} if window is empty. * * @return Dequeued element. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - @Nullable public E dequeue() throws GridException; + @Nullable public E dequeue() throws IgniteCheckedException; /** * Dequeues up to {@code cnt} elements from window. If current window size is less than {@code cnt}, @@ -132,35 +132,35 @@ public interface StreamerWindow<E> extends Iterable<E> { * * @param cnt Count to dequeue. * @return Collection of dequeued elements. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public Collection<E> dequeue(int cnt) throws GridException; + public Collection<E> dequeue(int cnt) throws IgniteCheckedException; /** * Dequeues all elements from window. * * @return Collection of dequeued elements. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public Collection<E> dequeueAll() throws GridException; + public Collection<E> dequeueAll() throws IgniteCheckedException; /** * If window supports eviction, this method will return next evicted element. * * @return Polls and returns next evicted event or {@code null} if eviction queue is empty or if * window does not support eviction. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - @Nullable public E pollEvicted() throws GridException; + @Nullable public E pollEvicted() throws IgniteCheckedException; /** * If window supports eviction, this method will return up to {@code cnt} evicted elements. * * @param cnt Number of elements to evict. * @return Collection of evicted elements. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public Collection<E> pollEvicted(int cnt) throws GridException; + public Collection<E> pollEvicted(int cnt) throws IgniteCheckedException; /** * If window supports batch eviction, this method will poll next evicted batch from window. @@ -169,24 +169,24 @@ public interface StreamerWindow<E> extends Iterable<E> { * If window does not support eviction, will return empty collection. * * @return Next evicted batch. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public Collection<E> pollEvictedBatch() throws GridException; + public Collection<E> pollEvictedBatch() throws IgniteCheckedException; /** * If window supports eviction, this method will return all available evicted elements. * * @return Collection of evicted elements. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public Collection<E> pollEvictedAll() throws GridException; + public Collection<E> pollEvictedAll() throws IgniteCheckedException; /** * Clears all evicted entries. * - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - public void clearEvicted() throws GridException; + public void clearEvicted() throws IgniteCheckedException; /** * Create window snapshot. Evicted entries are not included. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java index 3d2244b..97ac2ae 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndex.java @@ -42,7 +42,7 @@ import java.util.*; * } * * @Nullable @Override public Double onAdded(GridStreamerIndexEntry<StockPriceEvent, String, Double> entry, - * StockPriceEvent evt) throws GridException { + * StockPriceEvent evt) throws IgniteCheckedException { * return Math.min(entry.value(), evt.getPrice()); // Update the minimum on new event. * } * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java index 0c4f509..92ca30b 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProvider.java @@ -9,7 +9,7 @@ package org.apache.ignite.streamer.index; -import org.gridgain.grid.*; +import org.apache.ignite.*; /** * Represents an actual instance of an index. Used by a {@link org.apache.ignite.streamer.StreamerWindow} @@ -55,18 +55,18 @@ public interface StreamerIndexProvider<E, K, V> extends StreamerIndexProviderMBe * * @param sync Index update synchronizer. * @param evt Event to add to an index. - * @throws GridException If failed to add event to an index. + * @throws IgniteCheckedException If failed to add event to an index. */ - public void add(StreamerIndexUpdateSync sync, E evt) throws GridException; + public void add(StreamerIndexUpdateSync sync, E evt) throws IgniteCheckedException; /** * Removes an event from index. * * @param sync Index update synchronizer. * @param evt Event to remove from index. - * @throws GridException If failed to add event to an index. + * @throws IgniteCheckedException If failed to add event to an index. */ - public void remove(StreamerIndexUpdateSync sync, E evt) throws GridException; + public void remove(StreamerIndexUpdateSync sync, E evt) throws IgniteCheckedException; /** * Gets event indexing policy, which defines how events http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java index 7f73a55..7f97153 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexProviderAdapter.java @@ -11,8 +11,8 @@ package org.apache.ignite.streamer.index; import com.romix.scala.*; import com.romix.scala.collection.concurrent.*; +import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; @@ -146,7 +146,7 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI * @param sync Sync. * @param evt Event. */ - @Override public void add(StreamerIndexUpdateSync sync, E evt) throws GridException { + @Override public void add(StreamerIndexUpdateSync sync, E evt) throws IgniteCheckedException { assert evt != null; if (threadLocKey.get() != null) @@ -174,7 +174,7 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI * @param sync Sync. * @param evt Event. */ - @Override public void remove(StreamerIndexUpdateSync sync, E evt) throws GridException { + @Override public void remove(StreamerIndexUpdateSync sync, E evt) throws IgniteCheckedException { assert evt != null; if (threadLocKey.get() != null) @@ -301,9 +301,9 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI * @param evt Event. * @param key key. * @param sync Sync. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected abstract void add(E evt, K key, StreamerIndexUpdateSync sync) throws GridException; + protected abstract void add(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException; /** * Remove event from the index. @@ -311,18 +311,18 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI * @param evt Event. * @param key Key. * @param sync Sync. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected abstract void remove(E evt, K key, StreamerIndexUpdateSync sync) throws GridException; + protected abstract void remove(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException; /** * Lock updates on particular key. * * @param key Key. * @param sync Sync. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - private void lockKey(K key, StreamerIndexUpdateSync sync) throws GridException { + private void lockKey(K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { assert key != null; assert sync != null; @@ -334,7 +334,7 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI old.await(); } catch (InterruptedException e) { - throw new GridException("Failed to lock on key (thread has been interrupted): " + key, e); + throw new IgniteCheckedException("Failed to lock on key (thread has been interrupted): " + key, e); } // No point to replace or remove sync here. @@ -362,9 +362,9 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI * * @param key Key. * @param sync Sync. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected void lockIndexKey(IndexKey<V> key, StreamerIndexUpdateSync sync) throws GridException { + protected void lockIndexKey(IndexKey<V> key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { assert key != null; assert sync != null; assert isUnique(); @@ -377,7 +377,7 @@ public abstract class StreamerIndexProviderAdapter<E, K, V> implements StreamerI old.await(); } catch (InterruptedException e) { - throw new GridException("Failed to lock on key (thread has been interrupted): " + key, e); + throw new IgniteCheckedException("Failed to lock on key (thread has been interrupted): " + key, e); } // No point to replace or remove sync here. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexUpdater.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexUpdater.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexUpdater.java index 95df924..ce75c70 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexUpdater.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/StreamerIndexUpdater.java @@ -9,7 +9,7 @@ package org.apache.ignite.streamer.index; -import org.gridgain.grid.*; +import org.apache.ignite.*; import org.jetbrains.annotations.*; /** @@ -56,9 +56,9 @@ public interface StreamerIndexUpdater<E, K, V> { * @param evt New event. * @return New index value for given key, if {@code null}, then current * index entry will be removed the index. - * @throws GridException If entry should not be added to index (e.g. if uniqueness is violated). + * @throws IgniteCheckedException If entry should not be added to index (e.g. if uniqueness is violated). */ - @Nullable public V onAdded(StreamerIndexEntry<E, K, V> entry, E evt) throws GridException; + @Nullable public V onAdded(StreamerIndexEntry<E, K, V> entry, E evt) throws IgniteCheckedException; /** * Callback invoked whenever an event is being removed from the window and has http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/hash/StreamerHashIndexProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/hash/StreamerHashIndexProvider.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/hash/StreamerHashIndexProvider.java index 2cf5e00..ec42b23 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/hash/StreamerHashIndexProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/hash/StreamerHashIndexProvider.java @@ -10,8 +10,8 @@ package org.apache.ignite.streamer.index.hash; import com.romix.scala.collection.concurrent.*; +import org.apache.ignite.*; import org.apache.ignite.streamer.index.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -57,7 +57,7 @@ public class StreamerHashIndexProvider<E, K, V> extends StreamerIndexProviderAda } /** {@inheritDoc} */ - @Override protected void add(E evt, K key, StreamerIndexUpdateSync sync) throws GridException { + @Override protected void add(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { State<E, K, V> state0 = state.get(); if (state0 != null) @@ -92,7 +92,7 @@ public class StreamerHashIndexProvider<E, K, V> extends StreamerIndexProviderAda } else { if (isUnique()) - throw new GridException("Index unique key violation [evt=" + evt + ", key=" + key + ']'); + throw new IgniteCheckedException("Index unique key violation [evt=" + evt + ", key=" + key + ']'); V val = updater.onAdded(oldEntry, evt); @@ -122,7 +122,7 @@ public class StreamerHashIndexProvider<E, K, V> extends StreamerIndexProviderAda } /** {@inheritDoc} */ - @Override protected void remove(E evt, K key, StreamerIndexUpdateSync sync) throws GridException { + @Override protected void remove(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { State<E, K, V> state0 = state.get(); if (state0 != null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/index/tree/StreamerTreeIndexProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/index/tree/StreamerTreeIndexProvider.java b/modules/core/src/main/java/org/apache/ignite/streamer/index/tree/StreamerTreeIndexProvider.java index 4771ac5..09cfad1 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/index/tree/StreamerTreeIndexProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/index/tree/StreamerTreeIndexProvider.java @@ -10,8 +10,8 @@ package org.apache.ignite.streamer.index.tree; import com.romix.scala.collection.concurrent.*; +import org.apache.ignite.*; import org.apache.ignite.streamer.index.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.snaptree.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; @@ -93,7 +93,7 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda } /** {@inheritDoc} */ - @Override protected void add(E evt, K key, StreamerIndexUpdateSync sync) throws GridException { + @Override protected void add(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { State<E, K, V> state0 = state.get(); if (state0 != null) @@ -129,7 +129,7 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda if (isUnique()) { if (old != null) - throw new GridException("Index unique key violation [evt=" + evt + ", key=" + key + + throw new IgniteCheckedException("Index unique key violation [evt=" + evt + ", key=" + key + ", idxKey=" + idxKey + ']'); } else @@ -190,7 +190,7 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda if (isUnique()) { if (old != null) - throw new GridException("Index unique key violation [evt=" + evt + ", key=" + key + + throw new IgniteCheckedException("Index unique key violation [evt=" + evt + ", key=" + key + ", idxKey=" + newIdxKey + ']'); } else @@ -212,7 +212,7 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda } /** {@inheritDoc} */ - @Override protected void remove(E evt, K key, StreamerIndexUpdateSync sync) throws GridException { + @Override protected void remove(E evt, K key, StreamerIndexUpdateSync sync) throws IgniteCheckedException { State<E, K, V> state0 = state.get(); if (state0 != null) @@ -285,7 +285,7 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda if (isUnique()) { if (old != null) - throw new GridException("Index unique key violation [evt=" + evt + ", key=" + key + + throw new IgniteCheckedException("Index unique key violation [evt=" + evt + ", key=" + key + ", idxKey=" + newIdxKey + ']'); } else @@ -310,10 +310,10 @@ public class StreamerTreeIndexProvider<E, K, V> extends StreamerIndexProviderAda * @param key2 Key. * @param order Keys comparison result. * @param sync Sync. - * @throws GridException If interrupted. + * @throws IgniteCheckedException If interrupted. */ private void lockKeys(IndexKey<V> key1, IndexKey<V> key2, int order, StreamerIndexUpdateSync sync) - throws GridException { + throws IgniteCheckedException { assert isUnique(); assert key1 != null; assert key2 != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java index f220159..76f5d8b 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeBatchWindow.java @@ -9,11 +9,12 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.*; import org.gridgain.grid.*; import org.gridgain.grid.kernal.processors.streamer.*; -import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.tostring.*; +import org.gridgain.grid.util.typedef.internal.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -75,15 +76,15 @@ public class StreamerBoundedSizeBatchWindow<E> extends StreamerWindowAdapter<E> } /** {@inheritDoc} */ - @Override public void checkConfiguration() throws GridException { + @Override public void checkConfiguration() throws IgniteCheckedException { if (batchSize <= 0) - throw new GridException("Failed to initialize window (batchSize size must be positive) " + + throw new IgniteCheckedException("Failed to initialize window (batchSize size must be positive) " + "[windowClass=" + getClass().getSimpleName() + ", maximumBatches=" + maxBatches + ", batchSize=" + batchSize + ']'); if (maxBatches < 0) - throw new GridException("Failed to initialize window (maximumBatches cannot be negative) " + + throw new IgniteCheckedException("Failed to initialize window (maximumBatches cannot be negative) " + "[windowClass=" + getClass().getSimpleName() + ", maximumBatches=" + maxBatches + ", batchSize=" + batchSize + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java index c31b32e..0bc2d26 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedSizeWindowAdapter.java @@ -9,7 +9,7 @@ package org.apache.ignite.streamer.window; -import org.gridgain.grid.*; +import org.apache.ignite.*; import org.gridgain.grid.kernal.processors.streamer.*; import org.gridgain.grid.util.*; import org.gridgain.grid.util.lang.*; @@ -65,9 +65,9 @@ abstract class StreamerBoundedSizeWindowAdapter<E, T> extends StreamerWindowAdap } /** {@inheritDoc} */ - @Override public void checkConfiguration() throws GridException { + @Override public void checkConfiguration() throws IgniteCheckedException { if (maxSize < 0) - throw new GridException("Failed to initialize window (maximumSize cannot be negative) " + + throw new IgniteCheckedException("Failed to initialize window (maximumSize cannot be negative) " + "[windowClass=" + getClass().getSimpleName() + ", maxSize=" + maxSize + ", unique=" + unique + ']'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java index 187c34e..829e6fa 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeBatchWindow.java @@ -9,11 +9,12 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.*; import org.gridgain.grid.*; import org.gridgain.grid.kernal.processors.streamer.*; -import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.lang.*; import org.gridgain.grid.util.tostring.*; +import org.gridgain.grid.util.typedef.internal.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; @@ -96,16 +97,16 @@ public class StreamerBoundedTimeBatchWindow<E> extends StreamerWindowAdapter<E> } /** {@inheritDoc} */ - @Override public void checkConfiguration() throws GridException { + @Override public void checkConfiguration() throws IgniteCheckedException { if (maxBatches < 0) - throw new GridException("Failed to initialize window (maximumBatches cannot be negative) " + + throw new IgniteCheckedException("Failed to initialize window (maximumBatches cannot be negative) " + "[windowClass=" + getClass().getSimpleName() + ", maximumBatches=" + maxBatches + ", batchSize=" + batchSize + ", batchTimeInterval=" + batchTimeInterval + ']'); if (batchSize < 0) - throw new GridException("Failed to initialize window (batchSize cannot be negative) " + + throw new IgniteCheckedException("Failed to initialize window (batchSize cannot be negative) " + "[windowClass=" + getClass().getSimpleName() + ", maximumBatches=" + maxBatches + ", batchSize=" + batchSize + @@ -114,7 +115,7 @@ public class StreamerBoundedTimeBatchWindow<E> extends StreamerWindowAdapter<E> batchSize = Integer.MAX_VALUE; if (batchTimeInterval <= 0) - throw new GridException("Failed to initialize window (batchTimeInterval must be positive) " + + throw new IgniteCheckedException("Failed to initialize window (batchTimeInterval must be positive) " + "[windowClass=" + getClass().getSimpleName() + ", maximumBatches=" + maxBatches + ", batchSize=" + batchSize + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java index 140e057..f37116e 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerBoundedTimeWindow.java @@ -9,11 +9,11 @@ package org.apache.ignite.streamer.window; -import org.gridgain.grid.*; +import org.apache.ignite.*; import org.gridgain.grid.kernal.processors.streamer.*; import org.gridgain.grid.util.*; -import org.gridgain.grid.util.typedef.internal.*; import org.gridgain.grid.util.lang.*; +import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; import java.io.*; @@ -94,14 +94,14 @@ public class StreamerBoundedTimeWindow<E> extends StreamerWindowAdapter<E> { } /** {@inheritDoc} */ - @Override public void checkConfiguration() throws GridException { + @Override public void checkConfiguration() throws IgniteCheckedException { if (timeInterval <= 0) - throw new GridException("Failed to initialize window (timeInterval must be positive): [windowClass=" + + throw new IgniteCheckedException("Failed to initialize window (timeInterval must be positive): [windowClass=" + getClass().getSimpleName() + ", maxSize=" + maxSize + ", timeInterval=" + timeInterval + ", unique=" + unique + ']'); if (maxSize < 0) - throw new GridException("Failed to initialize window (maximumSize cannot be negative): [windowClass=" + + throw new IgniteCheckedException("Failed to initialize window (maximumSize cannot be negative): [windowClass=" + getClass().getSimpleName() + ", maxSize=" + maxSize + ", timeInterval=" + timeInterval + ", unique=" + unique + ']'); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java index 9d69102..3008801 100644 --- a/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/streamer/window/StreamerWindowAdapter.java @@ -9,15 +9,15 @@ package org.apache.ignite.streamer.window; +import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.lifecycle.*; import org.apache.ignite.streamer.*; import org.apache.ignite.streamer.index.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.processors.streamer.*; +import org.gridgain.grid.util.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; -import org.gridgain.grid.util.*; import org.jetbrains.annotations.*; import java.util.*; @@ -81,7 +81,7 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream protected abstract GridStreamerWindowIterator<E> iterator0(); /** {@inheritDoc} */ - @Override public boolean enqueue(E evt) throws GridException { + @Override public boolean enqueue(E evt) throws IgniteCheckedException { lock.readLock(); try { @@ -102,12 +102,12 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream } /** {@inheritDoc} */ - @Override public boolean enqueue(E... evts) throws GridException { + @Override public boolean enqueue(E... evts) throws IgniteCheckedException { return enqueueAll(Arrays.asList(evts)); } /** {@inheritDoc} */ - @Override public boolean enqueueAll(Collection<E> evts) throws GridException { + @Override public boolean enqueueAll(Collection<E> evts) throws IgniteCheckedException { lock.readLock(); try { @@ -144,17 +144,17 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream protected abstract boolean enqueue0(E evt); /** {@inheritDoc} */ - @Override public E dequeue() throws GridException { + @Override public E dequeue() throws IgniteCheckedException { return F.first(dequeue(1)); } /** {@inheritDoc} */ - @Override public Collection<E> dequeueAll() throws GridException { + @Override public Collection<E> dequeueAll() throws IgniteCheckedException { return dequeue(size()); } /** {@inheritDoc} */ - @Override public Collection<E> dequeue(int cnt) throws GridException { + @Override public Collection<E> dequeue(int cnt) throws IgniteCheckedException { lock.readLock(); try { @@ -182,17 +182,17 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream protected abstract Collection<E> dequeue0(int cnt); /** {@inheritDoc} */ - @Override public E pollEvicted() throws GridException { + @Override public E pollEvicted() throws IgniteCheckedException { return F.first(pollEvicted(1)); } /** {@inheritDoc} */ - @Override public Collection<E> pollEvictedAll() throws GridException { + @Override public Collection<E> pollEvictedAll() throws IgniteCheckedException { return pollEvicted(evictionQueueSize()); } /** {@inheritDoc} */ - @Override public Collection<E> pollEvicted(int cnt) throws GridException { + @Override public Collection<E> pollEvicted(int cnt) throws IgniteCheckedException { lock.readLock(); try { @@ -219,7 +219,7 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream protected abstract Collection<E> pollEvicted0(int cnt); /** {@inheritDoc} */ - @Override public Collection<E> pollEvictedBatch() throws GridException { + @Override public Collection<E> pollEvictedBatch() throws IgniteCheckedException { lock.readLock(); try { @@ -247,7 +247,7 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream protected abstract Collection<E> pollEvictedBatch0(); /** {@inheritDoc} */ - @Override public final void start() throws GridException { + @Override public final void start() throws IgniteCheckedException { checkConfiguration(); if (idxs != null) { @@ -278,9 +278,9 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream /** * Check window configuration. * - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - protected abstract void checkConfiguration() throws GridException; + protected abstract void checkConfiguration() throws IgniteCheckedException; /** * Reset routine. @@ -426,7 +426,7 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream } /** {@inheritDoc} */ - @Override public void clearEvicted() throws GridException { + @Override public void clearEvicted() throws IgniteCheckedException { pollEvictedAll(); } @@ -435,9 +435,9 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream * * @param evt Event. * @param rmv Remove flag. - * @throws GridException If index update failed. + * @throws IgniteCheckedException If index update failed. */ - protected void updateIndexes(E evt, boolean rmv) throws GridException { + protected void updateIndexes(E evt, boolean rmv) throws IgniteCheckedException { if (idxs != null) { StreamerIndexUpdateSync sync = new StreamerIndexUpdateSync(); @@ -516,8 +516,8 @@ public abstract class StreamerWindowAdapter<E> implements LifecycleAware, Stream try { updateIndexes(evt, true); } - catch (GridException e) { - throw new GridRuntimeException("Faied to remove event: " + evt, e); + catch (IgniteCheckedException e) { + throw new IgniteException("Faied to remove event: " + evt, e); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/impl/GridClientImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/impl/GridClientImpl.java b/modules/core/src/main/java/org/gridgain/client/impl/GridClientImpl.java index 5ce025a..1cabdf4 100644 --- a/modules/core/src/main/java/org/gridgain/client/impl/GridClientImpl.java +++ b/modules/core/src/main/java/org/gridgain/client/impl/GridClientImpl.java @@ -8,11 +8,11 @@ */ package org.gridgain.client.impl; +import org.apache.ignite.*; import org.gridgain.client.*; import org.gridgain.client.balancer.*; import org.gridgain.client.impl.connection.*; import org.gridgain.client.ssl.*; -import org.gridgain.grid.*; import org.gridgain.grid.util.typedef.*; import org.gridgain.grid.util.typedef.internal.*; import org.jetbrains.annotations.*; @@ -51,7 +51,7 @@ public class GridClientImpl implements GridClient { else U.addJavaNoOpLogger(); } - catch (GridException ignored) { + catch (IgniteCheckedException ignored) { // Our log4j warning suppression failed, leave it as is. } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java index 273bbfa..a5a27a6 100644 --- a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java +++ b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientConnectionManagerAdapter.java @@ -223,7 +223,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio srv.start(); } - catch (IOException | GridException e) { + catch (IOException | IgniteCheckedException e) { throw new GridClientException("Failed to start connection server.", e); } } @@ -473,7 +473,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio if (cfg.getSecurityCredentialsProvider() != null) cred = cfg.getSecurityCredentialsProvider().credentials(); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new GridClientException("Failed to obtain client credentials.", e); } @@ -713,7 +713,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio } /** {@inheritDoc} */ - @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, GridException { + @Nullable @Override public Object decode(GridNioSession ses, ByteBuffer buf) throws IOException, IgniteCheckedException { GridClientFutureAdapter<?> handshakeFut = ses.meta(GridClientNioTcpConnection.SES_META_HANDSHAKE); if (handshakeFut != null) { @@ -748,7 +748,7 @@ abstract class GridClientConnectionManagerAdapter implements GridClientConnectio } /** {@inheritDoc} */ - @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, GridException { + @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException { // No encoding needed for direct messages. throw new UnsupportedEncodingException(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientNioTcpConnection.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientNioTcpConnection.java index 11e18ac..a4057de 100644 --- a/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientNioTcpConnection.java +++ b/modules/core/src/main/java/org/gridgain/client/impl/connection/GridClientNioTcpConnection.java @@ -8,6 +8,7 @@ */ package org.gridgain.client.impl.connection; +import org.apache.ignite.*; import org.gridgain.client.*; import org.gridgain.client.impl.*; import org.gridgain.client.marshaller.*; @@ -211,7 +212,7 @@ public class GridClientNioTcpConnection extends GridClientConnection { cleanup = false; } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new GridClientException(e); } finally { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/marshaller/optimized/GridClientOptimizedMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/marshaller/optimized/GridClientOptimizedMarshaller.java b/modules/core/src/main/java/org/gridgain/client/marshaller/optimized/GridClientOptimizedMarshaller.java index 52f451b..5a63d93 100644 --- a/modules/core/src/main/java/org/gridgain/client/marshaller/optimized/GridClientOptimizedMarshaller.java +++ b/modules/core/src/main/java/org/gridgain/client/marshaller/optimized/GridClientOptimizedMarshaller.java @@ -9,6 +9,7 @@ package org.gridgain.client.marshaller.optimized; +import org.apache.ignite.*; import org.apache.ignite.marshaller.optimized.*; import org.gridgain.client.marshaller.*; import org.gridgain.grid.*; @@ -46,7 +47,7 @@ public class GridClientOptimizedMarshaller implements GridClientMarshaller { * @param clsNamesPath Path to a file with user preregistered class names. * @param poolSize Object streams pool size. * @throws IOException If an I/O error occurs while writing stream header. - * @throws GridRuntimeException If this marshaller is not supported on the current JVM. + * @throws IgniteException If this marshaller is not supported on the current JVM. * @see org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller */ public GridClientOptimizedMarshaller(boolean requireSer, List<String> clsNames, String clsNamesPath, int poolSize) @@ -54,7 +55,7 @@ public class GridClientOptimizedMarshaller implements GridClientMarshaller { try { opMarsh = new IgniteOptimizedMarshaller(requireSer, clsNames, clsNamesPath, poolSize); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IOException(e); } } @@ -78,7 +79,7 @@ public class GridClientOptimizedMarshaller implements GridClientMarshaller { return buf; } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IOException(e); } } @@ -88,7 +89,7 @@ public class GridClientOptimizedMarshaller implements GridClientMarshaller { try { return opMarsh.unmarshal(bytes, null); } - catch (GridException e) { + catch (IgniteCheckedException e) { throw new IOException(e); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/router/GridRouterFactory.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/router/GridRouterFactory.java b/modules/core/src/main/java/org/gridgain/client/router/GridRouterFactory.java index 39fd78b..2fd47f9 100644 --- a/modules/core/src/main/java/org/gridgain/client/router/GridRouterFactory.java +++ b/modules/core/src/main/java/org/gridgain/client/router/GridRouterFactory.java @@ -9,8 +9,8 @@ package org.gridgain.client.router; +import org.apache.ignite.*; import org.gridgain.client.router.impl.*; -import org.gridgain.grid.*; import org.jetbrains.annotations.*; import java.util.*; @@ -53,9 +53,9 @@ public final class GridRouterFactory { * * @param cfg Router configuration. * @return Started router. - * @throws GridException If router start failed. + * @throws IgniteCheckedException If router start failed. */ - public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg) throws GridException { + public static GridTcpRouter startTcpRouter(GridTcpRouterConfiguration cfg) throws IgniteCheckedException { GridTcpRouterImpl router = new GridTcpRouterImpl(cfg); router.start(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/router/impl/GridRouterCommandLineStartup.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/router/impl/GridRouterCommandLineStartup.java b/modules/core/src/main/java/org/gridgain/client/router/impl/GridRouterCommandLineStartup.java index 02a2474..4a03f9c 100644 --- a/modules/core/src/main/java/org/gridgain/client/router/impl/GridRouterCommandLineStartup.java +++ b/modules/core/src/main/java/org/gridgain/client/router/impl/GridRouterCommandLineStartup.java @@ -61,7 +61,7 @@ public class GridRouterCommandLineStartup { try { tcpRouter.start(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Failed to start TCP router on port " + tcpCfg.getPort() + ": " + e.getMessage(), e); tcpRouter = null; @@ -78,7 +78,7 @@ public class GridRouterCommandLineStartup { try { tcpRouter.stop(); } - catch (GridException e) { + catch (IgniteCheckedException e) { U.error(log, "Error while stopping the router.", e); } } @@ -88,9 +88,9 @@ public class GridRouterCommandLineStartup { * Wrapper method to run router from command-line. * * @param args Command-line arguments. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public static void main(String[] args) throws GridException { + public static void main(String[] args) throws IgniteCheckedException { X.println( " _____ _ _______ _ ", " / ___/____(_)___/ / ___/___ _(_)___ ", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterImpl.java b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterImpl.java index 2179417..3c3e848 100644 --- a/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterImpl.java +++ b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterImpl.java @@ -79,14 +79,14 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif /** * Starts router. * - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - @Override public void start() throws GridException { + @Override public void start() throws IgniteCheckedException { try { client = createClient(cfg); } catch (GridClientException e) { - throw new GridException("Failed to initialise embedded client.", e); + throw new IgniteCheckedException("Failed to initialise embedded client.", e); } GridNioServerListener<GridClientMessage> lsnr; @@ -104,7 +104,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif lsnr = new GridTcpRouterNioListenerOsImpl(log, client); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { - throw new GridException("Failed to create NIO listener.", e); + throw new IgniteCheckedException("Failed to create NIO listener.", e); } parser = new GridTcpRouterNioParser(); @@ -115,7 +115,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif hostAddr = InetAddress.getByName(cfg.getHost()); } catch (UnknownHostException e) { - throw new GridException("Failed to resolve grid address for configured host: " + cfg.getHost(), e); + throw new IgniteCheckedException("Failed to resolve grid address for configured host: " + cfg.getHost(), e); } SSLContext sslCtx; @@ -126,7 +126,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif sslCtx = sslCtxFactory == null ? null : sslCtxFactory.createSslContext(); } catch (SSLException e) { - throw new GridException("Failed to create SSL context.", e); + throw new IgniteCheckedException("Failed to create SSL context.", e); } for (int port = cfg.getPort(), last = port + cfg.getPortRange(); port <= last; port++) { @@ -146,7 +146,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif } if (bindPort == 0) - throw new GridException("Failed to bind TCP router server (possibly all ports in range " + + throw new IgniteCheckedException("Failed to bind TCP router server (possibly all ports in range " + "are in use) [firstPort=" + cfg.getPort() + ", lastPort=" + (cfg.getPort() + cfg.getPortRange()) + ", addr=" + hostAddr + ']'); @@ -253,7 +253,7 @@ public class GridTcpRouterImpl implements GridTcpRouter, GridTcpRouterMBean, Lif return true; } - catch (GridException e) { + catch (IgniteCheckedException e) { if (log.isDebugEnabled()) log.debug("Failed to start TCP router protocol on port " + port + ": " + e.getMessage()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterNioParser.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterNioParser.java b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterNioParser.java index bc49561..d120aaf 100644 --- a/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterNioParser.java +++ b/modules/core/src/main/java/org/gridgain/client/router/impl/GridTcpRouterNioParser.java @@ -9,8 +9,8 @@ package org.gridgain.client.router.impl; +import org.apache.ignite.*; import org.gridgain.client.marshaller.*; -import org.gridgain.grid.*; import org.gridgain.grid.kernal.processors.rest.client.message.*; import org.gridgain.grid.kernal.processors.rest.protocols.tcp.*; import org.gridgain.grid.util.nio.*; @@ -43,7 +43,7 @@ class GridTcpRouterNioParser extends GridTcpRestParser { } /** {@inheritDoc} */ - @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, GridException { + @Override public ByteBuffer encode(GridNioSession ses, Object msg) throws IOException, IgniteCheckedException { sndCnt++; if (msg instanceof GridRouterResponse) { @@ -82,7 +82,7 @@ class GridTcpRouterNioParser extends GridTcpRestParser { else if (msg instanceof GridClientPingPacket || msg instanceof GridClientHandshakeResponse) return super.encode(ses, msg); else - throw new GridException("Unsupported message: " + msg); + throw new IgniteCheckedException("Unsupported message: " + msg); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridAuthenticationException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridAuthenticationException.java b/modules/core/src/main/java/org/gridgain/grid/GridAuthenticationException.java index e777f82..a19cfdd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/GridAuthenticationException.java +++ b/modules/core/src/main/java/org/gridgain/grid/GridAuthenticationException.java @@ -9,10 +9,12 @@ package org.gridgain.grid; +import org.apache.ignite.*; + /** * Exception that represents authentication failure. */ -public class GridAuthenticationException extends GridException { +public class GridAuthenticationException extends IgniteCheckedException { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridBasicWarmupClosure.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridBasicWarmupClosure.java b/modules/core/src/main/java/org/gridgain/grid/GridBasicWarmupClosure.java index aeeec08..8519f5d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/GridBasicWarmupClosure.java +++ b/modules/core/src/main/java/org/gridgain/grid/GridBasicWarmupClosure.java @@ -211,7 +211,7 @@ public class GridBasicWarmupClosure implements IgniteInClosure<IgniteConfigurati doWarmup(ignites); } catch (Exception e) { - throw new GridRuntimeException(e); + throw new IgniteException(e); } finally { for (Ignite ignite : ignites) @@ -288,7 +288,7 @@ public class GridBasicWarmupClosure implements IgniteInClosure<IgniteConfigurati } default: - throw new GridException("Unsupported warmup method: " + warmupMethod); + throw new IgniteCheckedException("Unsupported warmup method: " + warmupMethod); } futs.add(svc.submit(call)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridDeploymentException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridDeploymentException.java b/modules/core/src/main/java/org/gridgain/grid/GridDeploymentException.java index 41a36f4..3ae1a50 100644 --- a/modules/core/src/main/java/org/gridgain/grid/GridDeploymentException.java +++ b/modules/core/src/main/java/org/gridgain/grid/GridDeploymentException.java @@ -9,13 +9,13 @@ package org.gridgain.grid; -import org.gridgain.grid.*; +import org.apache.ignite.*; import org.jetbrains.annotations.*; /** * Deployment or re-deployment failed. */ -public class GridDeploymentException extends GridException { +public class GridDeploymentException extends IgniteCheckedException { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridException.java b/modules/core/src/main/java/org/gridgain/grid/GridException.java deleted file mode 100644 index b5144bd..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/GridException.java +++ /dev/null @@ -1,108 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid; - -import org.gridgain.grid.util.typedef.*; -import org.jetbrains.annotations.*; - -import static org.gridgain.grid.util.GridUtils.*; - -/** - * General grid exception. This exception is used to indicate any error condition - * within Grid. - */ -public class GridException extends Exception { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Create empty exception. - */ - public GridException() { - super(); - } - - /** - * Creates new exception with given error message. - * - * @param msg Error message. - */ - public GridException(String msg) { - super(msg); - } - - /** - * Creates new grid exception with given throwable as a cause and - * source of error message. - * - * @param cause Non-null throwable cause. - */ - public GridException(Throwable cause) { - this(cause.getMessage(), cause); - } - - /** - * Creates new exception with given error message and optional nested exception. - * - * @param msg Error message. - * @param cause Optional nested exception (can be {@code null}). - */ - public GridException(String msg, @Nullable Throwable cause) { - super(msg, cause); - } - - /** - * Checks if this exception has given class in {@code 'cause'} hierarchy. - * - * @param cls Cause classes to check (if {@code null} or empty, {@code false} is returned). - * @return {@code True} if one of the causing exception is an instance of passed in classes, - * {@code false} otherwise. - */ - public boolean hasCause(@Nullable Class<? extends Throwable>... cls) { - return X.hasCause(this, cls); - } - - /** - * Gets first exception of given class from {@code 'cause'} hierarchy if any. - * - * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). - * @return First causing exception of passed in class, {@code null} otherwise. - */ - @Nullable public <T extends Throwable> T getCause(@Nullable Class<T> cls) { - return X.cause(this, cls); - } - - /** - * {@inheritDoc} - * <p> - * Adds troubleshooting links if they where not added by below in {@code cause} hierarchy. - */ - @Override public String getMessage() { - return X.hasCauseExcludeRoot(this, GridException.class, GridRuntimeException.class) ? - super.getMessage() : errorMessageWithHelpUrls(super.getMessage()); - } - - /** - * Returns exception message. - * <p> - * Unlike {@link #getMessage()} this method never include troubleshooting links - * to the result string. - * - * @return Original message. - */ - public String getOriginalMessage() { - return super.getMessage(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return getClass() + ": " + getMessage(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridInterruptedException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridInterruptedException.java b/modules/core/src/main/java/org/gridgain/grid/GridInterruptedException.java index 5c972b9..8c6230d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/GridInterruptedException.java +++ b/modules/core/src/main/java/org/gridgain/grid/GridInterruptedException.java @@ -9,11 +9,13 @@ package org.gridgain.grid; +import org.apache.ignite.*; + /** - * This exception is used to wrap standard {@link InterruptedException} into {@link GridException}. + * This exception is used to wrap standard {@link InterruptedException} into {@link IgniteCheckedException}. */ @SuppressWarnings({"TypeMayBeWeakened"}) -public class GridInterruptedException extends GridException { +public class GridInterruptedException extends IgniteCheckedException { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/GridRuntimeException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/GridRuntimeException.java b/modules/core/src/main/java/org/gridgain/grid/GridRuntimeException.java deleted file mode 100644 index 92f231e..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/GridRuntimeException.java +++ /dev/null @@ -1,85 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid; - -import org.gridgain.grid.util.typedef.*; -import org.jetbrains.annotations.*; - -import static org.gridgain.grid.util.GridUtils.*; - -/** - * Common runtime exception for grid. Thrown by all components wherever - * runtime exception is needed. - */ -public class GridRuntimeException extends RuntimeException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Constructs runtime grid exception with given message and cause. - * - * @param msg Exception message. - * @param cause Exception cause. - */ - public GridRuntimeException(String msg, @Nullable Throwable cause) { - super(msg, cause); - } - - /** - * Creates new runtime grid exception given throwable as a cause and - * source of error message. - * - * @param cause Non-null throwable cause. - */ - public GridRuntimeException(Throwable cause) { - this(cause.getMessage(), cause); - } - - /** - * Constructs runtime grid exception with given message. - * - * @param msg Exception message. - */ - public GridRuntimeException(String msg) { - super(msg); - } - - /** - * Checks if this exception has given class in {@code 'cause'} hierarchy. - * - * @param cls Cause class to check (if {@code null}, {@code false} is returned).. - * @return {@code True} if one of the causing exception is an instance of passed in class, - * {@code false} otherwise. - */ - public boolean hasCause(@Nullable Class<? extends Throwable>... cls) { - return X.hasCause(this, cls); - } - - /** - * Gets first exception of given class from {@code 'cause'} hierarchy if any. - * - * @param cls Cause class to get cause (if {@code null}, {@code null} is returned). - * @return First causing exception of passed in class, {@code null} otherwise. - */ - @Nullable public <T extends Throwable> T getCause(@Nullable Class<T> cls) { - return X.cause(this, cls); - } - - /** {@inheritDoc} */ - @Override public String getMessage() { - return X.hasCauseExcludeRoot(this, GridException.class, GridRuntimeException.class) ? - super.getMessage() : errorMessageWithHelpUrls(super.getMessage()); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return getClass() + ": " + getMessage(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java index 6973d6b..3af8e94 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java @@ -9,8 +9,8 @@ package org.gridgain.grid.cache; +import org.apache.ignite.*; import org.apache.ignite.lang.*; -import org.gridgain.grid.*; import org.gridgain.grid.cache.affinity.*; import org.gridgain.grid.cache.affinity.consistenthash.*; import org.gridgain.grid.cache.datastructures.*; @@ -112,9 +112,9 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * Gets size (in bytes) of all entries swapped to disk. * * @return Size (in bytes) of all entries swapped to disk. - * @throws GridException In case of error. + * @throws IgniteCheckedException In case of error. */ - public long overflowSize() throws GridException; + public long overflowSize() throws IgniteCheckedException; /** * Gets number of cache entries stored in off-heap memory. @@ -134,17 +134,17 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * Gets size in bytes for swap space. * * @return Size in bytes. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public long swapSize() throws GridException ; + public long swapSize() throws IgniteCheckedException; /** * Gets number of swap entries (keys). * * @return Number of entries stored in swap. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public long swapKeys() throws GridException; + public long swapKeys() throws IgniteCheckedException; /** * Gets iterator over keys and values belonging to this cache swap space on local node. This @@ -158,10 +158,10 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * {@link GridCacheFlag#SKIP_SWAP}. * * @return Iterator over keys. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. * @see #promote(Object) */ - public Iterator<Map.Entry<K, V>> swapIterator() throws GridException; + public Iterator<Map.Entry<K, V>> swapIterator() throws IgniteCheckedException; /** * Gets iterator over keys and values belonging to this cache off-heap memory on local node. This @@ -173,9 +173,9 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * {@link #removex(Object, org.apache.ignite.lang.IgnitePredicate[])} method. * * @return Iterator over keys. - * @throws GridException If failed. + * @throws IgniteCheckedException If failed. */ - public Iterator<Map.Entry<K, V>> offHeapIterator() throws GridException; + public Iterator<Map.Entry<K, V>> offHeapIterator() throws IgniteCheckedException; /** * Delegates to {@link GridCacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...)} method @@ -197,9 +197,9 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * @param ttl Time to live for loaded entries ({@code 0} for infinity). * @param args Optional user arguments to be passed into * {@link GridCacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method. - * @throws GridException If loading failed. + * @throws IgniteCheckedException If loading failed. */ - public void loadCache(@Nullable IgniteBiPredicate<K, V> p, long ttl, @Nullable Object... args) throws GridException; + public void loadCache(@Nullable IgniteBiPredicate<K, V> p, long ttl, @Nullable Object... args) throws IgniteCheckedException; /** * Asynchronously delegates to {@link GridCacheStore#loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...)} method http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/06931b4b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicUpdateTimeoutException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicUpdateTimeoutException.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicUpdateTimeoutException.java index f29acc7..8fa7f74 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicUpdateTimeoutException.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCacheAtomicUpdateTimeoutException.java @@ -9,12 +9,12 @@ package org.gridgain.grid.cache; -import org.gridgain.grid.*; +import org.apache.ignite.*; /** * Exception thrown when atomic operation timeout occurs. */ -public class GridCacheAtomicUpdateTimeoutException extends GridException { +public class GridCacheAtomicUpdateTimeoutException extends IgniteCheckedException { /** */ private static final long serialVersionUID = 0L;