Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sboikov committed Jan 29, 2015
1 parent 62cae2d commit 7cdd0c1
Show file tree
Hide file tree
Showing 121 changed files with 923 additions and 550 deletions.
Expand Up @@ -70,12 +70,10 @@ public static void main(String[] args) throws IgniteCheckedException {
} }


/** /**
* Collocates jobs with keys they need to work on using {@link org.apache.ignite.IgniteCompute#affinityRun(String, Object, Runnable)} * Collocates jobs with keys they need to work on using {@link IgniteCompute#affinityRun(String, Object, Runnable)}
* method. * method.
*
* @throws IgniteCheckedException If failed.
*/ */
private static void visitUsingAffinityRun() throws IgniteCheckedException { private static void visitUsingAffinityRun() {
Ignite g = Ignition.ignite(); Ignite g = Ignition.ignite();


final GridCache<Integer, String> cache = g.cache(CACHE_NAME); final GridCache<Integer, String> cache = g.cache(CACHE_NAME);
Expand All @@ -97,13 +95,11 @@ private static void visitUsingAffinityRun() throws IgniteCheckedException {
} }


/** /**
* Collocates jobs with keys they need to work on using {@link org.apache.ignite.IgniteCluster#mapKeysToNodes(String, Collection)} * Collocates jobs with keys they need to work on using {@link IgniteCluster#mapKeysToNodes(String, Collection)}
* method. The difference from {@code affinityRun(...)} method is that here we process multiple keys * method. The difference from {@code affinityRun(...)} method is that here we process multiple keys
* in a single job. * in a single job.
*
* @throws IgniteCheckedException If failed.
*/ */
private static void visitUsingMapKeysToNodes() throws IgniteCheckedException { private static void visitUsingMapKeysToNodes() {
final Ignite g = Ignition.ignite(); final Ignite g = Ignition.ignite();


Collection<Integer> keys = new ArrayList<>(KEY_CNT); Collection<Integer> keys = new ArrayList<>(KEY_CNT);
Expand Down
Expand Up @@ -99,9 +99,8 @@ public static void main(String[] args) throws Exception {
* Start listening to messages on all grid nodes within passed in projection. * Start listening to messages on all grid nodes within passed in projection.
* *
* @param msg Grid messaging. * @param msg Grid messaging.
* @throws IgniteCheckedException If failed.
*/ */
private static void startListening(IgniteMessaging msg) throws IgniteCheckedException { private static void startListening(IgniteMessaging msg) {
// Add ordered message listener. // Add ordered message listener.
msg.remoteListen(TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() { msg.remoteListen(TOPIC.ORDERED, new IgniteBiPredicate<UUID, String>() {
@IgniteInstanceResource @IgniteInstanceResource
Expand All @@ -113,7 +112,7 @@ private static void startListening(IgniteMessaging msg) throws IgniteCheckedExce
try { try {
g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg); g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.ORDERED, msg);
} }
catch (IgniteCheckedException e) { catch (IgniteException e) {
e.printStackTrace(); e.printStackTrace();
} }


Expand All @@ -132,7 +131,7 @@ private static void startListening(IgniteMessaging msg) throws IgniteCheckedExce
try { try {
g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg); g.message(g.cluster().forNodeId(nodeId)).send(TOPIC.UNORDERED, msg);
} }
catch (IgniteCheckedException e) { catch (IgniteException e) {
e.printStackTrace(); e.printStackTrace();
} }


Expand Down
Expand Up @@ -80,7 +80,7 @@ public static void main(String[] args) throws IgniteCheckedException {


return false; // Unsubscribe. return false; // Unsubscribe.
} }
catch (IgniteCheckedException e) { catch (IgniteException e) {
throw new GridClosureException(e); throw new GridClosureException(e);
} }
} }
Expand Down Expand Up @@ -112,7 +112,7 @@ else if ("PONG".equals(rcvMsg))


return true; // Continue listening. return true; // Continue listening.
} }
catch (IgniteCheckedException e) { catch (IgniteException e) {
throw new GridClosureException(e); throw new GridClosureException(e);
} }
} }
Expand Down
74 changes: 37 additions & 37 deletions modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
Expand Up @@ -52,7 +52,7 @@
* <li>{@code affinity(...)} methods colocate jobs with nodes on which a specified key is cached.</li> * <li>{@code affinity(...)} methods colocate jobs with nodes on which a specified key is cached.</li>
* </ul> * </ul>
* Note that if attempt is made to execute a computation over an empty projection (i.e. projection that does * Note that if attempt is made to execute a computation over an empty projection (i.e. projection that does
* not have any alive nodes), then {@link ClusterGroupEmptyException} will be thrown out of result future. * not have any alive nodes), then {@link org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException} will be thrown out of result future.
* <h1 class="header">Serializable</h1> * <h1 class="header">Serializable</h1>
* Also note that {@link Runnable} and {@link Callable} implementations must support serialization as required * Also note that {@link Runnable} and {@link Callable} implementations must support serialization as required
* by the configured marshaller. For example, {@link IgniteOptimizedMarshaller} requires {@link Serializable} * by the configured marshaller. For example, {@link IgniteOptimizedMarshaller} requires {@link Serializable}
Expand Down Expand Up @@ -120,10 +120,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param job Job which will be co-located on the node with given affinity key. * @param job Job which will be co-located on the node with given affinity key.
* @see ComputeJobContext#cacheName() * @see ComputeJobContext#cacheName()
* @see ComputeJobContext#affinityKey() * @see ComputeJobContext#affinityKey()
* @throws IgniteCheckedException If job failed. * @throws IgniteException If job failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public void affinityRun(@Nullable String cacheName, Object affKey, Runnable job) throws IgniteCheckedException; public void affinityRun(@Nullable String cacheName, Object affKey, Runnable job) throws IgniteException;


/** /**
* Executes given job on the node where data for provided affinity key is located * Executes given job on the node where data for provided affinity key is located
Expand All @@ -135,12 +135,12 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param affKey Affinity key. * @param affKey Affinity key.
* @param job Job which will be co-located on the node with given affinity key. * @param job Job which will be co-located on the node with given affinity key.
* @return Job result. * @return Job result.
* @throws IgniteCheckedException If job failed. * @throws IgniteException If job failed.
* @see ComputeJobContext#cacheName() * @see ComputeJobContext#cacheName()
* @see ComputeJobContext#affinityKey() * @see ComputeJobContext#affinityKey()
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R> R affinityCall(@Nullable String cacheName, Object affKey, Callable<R> job) throws IgniteCheckedException; public <R> R affinityCall(@Nullable String cacheName, Object affKey, Callable<R> job) throws IgniteException;


/** /**
* Executes given task on the grid projection. For step-by-step explanation of task execution process * Executes given task on the grid projection. For step-by-step explanation of task execution process
Expand All @@ -153,10 +153,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* class name is used as task name. * class name is used as task name.
* @param arg Optional argument of task execution, can be {@code null}. * @param arg Optional argument of task execution, can be {@code null}.
* @return Task result. * @return Task result.
* @throws IgniteCheckedException If task failed. * @throws IgniteException If task failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <T, R> R execute(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg) throws IgniteCheckedException; public <T, R> R execute(Class<? extends ComputeTask<T, R>> taskCls, @Nullable T arg) throws IgniteException;


/** /**
* Executes given task on this grid projection. For step-by-step explanation of task execution process * Executes given task on this grid projection. For step-by-step explanation of task execution process
Expand All @@ -169,10 +169,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* class name is used as task name. * class name is used as task name.
* @param arg Optional argument of task execution, can be {@code null}. * @param arg Optional argument of task execution, can be {@code null}.
* @return Task result. * @return Task result.
* @throws IgniteCheckedException If task failed. * @throws IgniteException If task failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <T, R> R execute(ComputeTask<T, R> task, @Nullable T arg) throws IgniteCheckedException; public <T, R> R execute(ComputeTask<T, R> task, @Nullable T arg) throws IgniteException;


/** /**
* Executes given task on this grid projection. For step-by-step explanation of task execution process * Executes given task on this grid projection. For step-by-step explanation of task execution process
Expand All @@ -186,22 +186,22 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param taskName Name of the task to execute. * @param taskName Name of the task to execute.
* @param arg Optional argument of task execution, can be {@code null}. * @param arg Optional argument of task execution, can be {@code null}.
* @return Task result. * @return Task result.
* @throws IgniteCheckedException If task failed. * @throws IgniteException If task failed.
* @see ComputeTask for information about task execution. * @see ComputeTask for information about task execution.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <T, R> R execute(String taskName, @Nullable T arg) throws IgniteCheckedException; public <T, R> R execute(String taskName, @Nullable T arg) throws IgniteException;


/** /**
* Broadcasts given job to all nodes in grid projection. * Broadcasts given job to all nodes in grid projection.
* <p> * <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}). * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
* *
* @param job Job to broadcast to all projection nodes. * @param job Job to broadcast to all projection nodes.
* @throws IgniteCheckedException If job failed. * @throws IgniteException If job failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public void broadcast(Runnable job) throws IgniteCheckedException; public void broadcast(Runnable job) throws IgniteException;


/** /**
* Broadcasts given job to all nodes in grid projection. Every participating node will return a * Broadcasts given job to all nodes in grid projection. Every participating node will return a
Expand All @@ -211,10 +211,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* *
* @param job Job to broadcast to all projection nodes. * @param job Job to broadcast to all projection nodes.
* @return Collection of results for this execution. * @return Collection of results for this execution.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R> Collection<R> broadcast(Callable<R> job) throws IgniteCheckedException; public <R> Collection<R> broadcast(Callable<R> job) throws IgniteException;


/** /**
* Broadcasts given closure job with passed in argument to all nodes in grid projection. * Broadcasts given closure job with passed in argument to all nodes in grid projection.
Expand All @@ -226,32 +226,32 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param job Job to broadcast to all projection nodes. * @param job Job to broadcast to all projection nodes.
* @param arg Job closure argument. * @param arg Job closure argument.
* @return Collection of results for this execution. * @return Collection of results for this execution.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R, T> Collection<R> broadcast(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteCheckedException; public <R, T> Collection<R> broadcast(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteException;


/** /**
* Executes provided job on a node in this grid projection. * Executes provided job on a node in this grid projection.
* <p> * <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}). * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
* *
* @param job Job closure to execute. * @param job Job closure to execute.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public void run(Runnable job) throws IgniteCheckedException; public void run(Runnable job) throws IgniteException;


/** /**
* Executes collection of jobs on grid nodes within this grid projection. * Executes collection of jobs on grid nodes within this grid projection.
* <p> * <p>
* Supports asynchronous execution (see {@link IgniteAsyncSupport}). * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
* *
* @param jobs Collection of jobs to execute. * @param jobs Collection of jobs to execute.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public void run(Collection<? extends Runnable> jobs) throws IgniteCheckedException; public void run(Collection<? extends Runnable> jobs) throws IgniteException;


/** /**
* Executes provided job on a node in this grid projection. The result of the * Executes provided job on a node in this grid projection. The result of the
Expand All @@ -261,10 +261,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* *
* @param job Job to execute. * @param job Job to execute.
* @return Job result. * @return Job result.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R> R call(Callable<R> job) throws IgniteCheckedException; public <R> R call(Callable<R> job) throws IgniteException;


/** /**
* Executes collection of jobs on nodes within this grid projection. * Executes collection of jobs on nodes within this grid projection.
Expand All @@ -274,10 +274,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* *
* @param jobs Collection of jobs to execute. * @param jobs Collection of jobs to execute.
* @return Collection of job results for this execution. * @return Collection of job results for this execution.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R> Collection<R> call(Collection<? extends Callable<R>> jobs) throws IgniteCheckedException; public <R> Collection<R> call(Collection<? extends Callable<R>> jobs) throws IgniteException;


/** /**
* Executes collection of jobs on nodes within this grid projection. The returned * Executes collection of jobs on nodes within this grid projection. The returned
Expand All @@ -288,10 +288,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param jobs Collection of jobs to execute. * @param jobs Collection of jobs to execute.
* @param rdc Reducer to reduce all job results into one individual return value. * @param rdc Reducer to reduce all job results into one individual return value.
* @return Future with reduced job result for this execution. * @return Future with reduced job result for this execution.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R1, R2> R2 call(Collection<? extends Callable<R1>> jobs, IgniteReducer<R1, R2> rdc) throws IgniteCheckedException; public <R1, R2> R2 call(Collection<? extends Callable<R1>> jobs, IgniteReducer<R1, R2> rdc) throws IgniteException;


/** /**
* Executes provided closure job on a node in this grid projection. This method is different * Executes provided closure job on a node in this grid projection. This method is different
Expand All @@ -303,10 +303,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param job Job to run. * @param job Job to run.
* @param arg Job argument. * @param arg Job argument.
* @return Job result. * @return Job result.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R, T> R apply(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteCheckedException; public <R, T> R apply(IgniteClosure<T, R> job, @Nullable T arg) throws IgniteException;


/** /**
* Executes provided closure job on nodes within this grid projection. A new job is executed for * Executes provided closure job on nodes within this grid projection. A new job is executed for
Expand All @@ -318,10 +318,10 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param job Job to run. * @param job Job to run.
* @param args Job arguments. * @param args Job arguments.
* @return Collection of job results. * @return Collection of job results.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <T, R> Collection<R> apply(IgniteClosure<T, R> job, Collection<? extends T> args) throws IgniteCheckedException; public <T, R> Collection<R> apply(IgniteClosure<T, R> job, Collection<? extends T> args) throws IgniteException;


/** /**
* Executes provided closure job on nodes within this grid projection. A new job is executed for * Executes provided closure job on nodes within this grid projection. A new job is executed for
Expand All @@ -335,11 +335,11 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @param args Job arguments. * @param args Job arguments.
* @param rdc Reducer to reduce all job results into one individual return value. * @param rdc Reducer to reduce all job results into one individual return value.
* @return Future with reduced job result for this execution. * @return Future with reduced job result for this execution.
* @throws IgniteCheckedException If execution failed. * @throws IgniteException If execution failed.
*/ */
@IgniteAsyncSupported @IgniteAsyncSupported
public <R1, R2, T> R2 apply(IgniteClosure<T, R1> job, Collection<? extends T> args, public <R1, R2, T> R2 apply(IgniteClosure<T, R1> job, Collection<? extends T> args,
IgniteReducer<R1, R2> rdc) throws IgniteCheckedException; IgniteReducer<R1, R2> rdc) throws IgniteException;


/** /**
* Gets tasks future for active tasks started on local node. * Gets tasks future for active tasks started on local node.
Expand Down Expand Up @@ -418,9 +418,9 @@ public <R1, R2, T> R2 apply(IgniteClosure<T, R1> job, Collection<? extends T> ar
* class name will be used as task's name. * class name will be used as task's name.
* @param clsLdr Task class loader. This class loader is in charge * @param clsLdr Task class loader. This class loader is in charge
* of loading all necessary resources for task execution. * of loading all necessary resources for task execution.
* @throws IgniteCheckedException If task is invalid and cannot be deployed. * @throws IgniteException If task is invalid and cannot be deployed.
*/ */
public void localDeployTask(Class<? extends ComputeTask> taskCls, ClassLoader clsLdr) throws IgniteCheckedException; public void localDeployTask(Class<? extends ComputeTask> taskCls, ClassLoader clsLdr) throws IgniteException;


/** /**
* Gets map of all locally deployed tasks keyed by their task name . * Gets map of all locally deployed tasks keyed by their task name .
Expand All @@ -435,9 +435,9 @@ public <R1, R2, T> R2 apply(IgniteClosure<T, R1> job, Collection<? extends T> ar
* undeployed on every node. * undeployed on every node.
* *
* @param taskName Name of the task to undeploy. * @param taskName Name of the task to undeploy.
* @throws IgniteCheckedException Thrown if undeploy failed. * @throws IgniteException Thrown if undeploy failed.
*/ */
public void undeployTask(String taskName) throws IgniteCheckedException; public void undeployTask(String taskName) throws IgniteException;


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override public <R> ComputeTaskFuture<R> future(); @Override public <R> ComputeTaskFuture<R> future();
Expand Down
Expand Up @@ -22,7 +22,7 @@
/** /**
* Deployment or re-deployment failed. * Deployment or re-deployment failed.
*/ */
public class IgniteDeploymentException extends IgniteCheckedException { public class IgniteDeploymentException extends IgniteException {
/** */ /** */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;


Expand Down

0 comments on commit 7cdd0c1

Please sign in to comment.