com.googlecode.mobilityrpc.quickstart
Class QuickTask

java.lang.Object
  extended by com.googlecode.mobilityrpc.quickstart.QuickTask

public class QuickTask
extends Object

A simplified API for sending and executing one-off tasks (Runnable or Callable objects) on remote machines.

Author:
Niall Gallagher

Method Summary
static
<T> T
execute(ConnectionId connectionId, Callable<T> callable)
          Transfers the given Callable object, and any objects it references, to the given remote machine, and executes it (calls the Callable.call() method) on the remote machine.
static void execute(ConnectionId connectionId, Runnable runnable)
          Transfers the given Runnable object, and any objects it references, to the given remote machine, and executes it (calls the Runnable.run() method) on the remote machine.
static
<T> T
execute(String address, Callable<T> callable)
          Transfers the given Callable object, and any objects it references, to the given remote machine, and executes it (calls the Callable.call() method) on the remote machine.
static void execute(String address, Runnable runnable)
          Transfers the given Runnable object, and any objects it references, to the given remote machine, and executes it (calls the Runnable.run() method) on the remote machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

execute

public static void execute(String address,
                           Runnable runnable)
Transfers the given Runnable object, and any objects it references, to the given remote machine, and executes it (calls the Runnable.run() method) on the remote machine.

Connects to the remote machine on the default port 5739.

Parameters:
address - The address (ip or name) of the remote machine
runnable - The object to send and execute on the remote machine

execute

public static void execute(ConnectionId connectionId,
                           Runnable runnable)
Transfers the given Runnable object, and any objects it references, to the given remote machine, and executes it (calls the Runnable.run() method) on the remote machine.

Parameters:
connectionId - The address/port of the remote machine
runnable - The object to send and execute on the remote machine

execute

public static <T> T execute(String address,
                            Callable<T> callable)
Transfers the given Callable object, and any objects it references, to the given remote machine, and executes it (calls the Callable.call() method) on the remote machine.

Transfers the object returned by the call method on the remote machine, and any objects it references, back to the local application.

Connects to the remote machine on the default port 5739.

Parameters:
address - The address (ip or name) of the remote machine
callable - The object to send to the remote machine
Returns:
The object returned by the Callable.call() method on the remote machine (transferred back to this machine)

execute

public static <T> T execute(ConnectionId connectionId,
                            Callable<T> callable)
Transfers the given Callable object, and any objects it references, to the given remote machine, and executes it (calls the Callable.call() method) on the remote machine.

Transfers the object returned by the call method on the remote machine, and any objects it references, back to the local application.

Parameters:
connectionId - The address/port of the remote machine
callable - The object to send to the remote machine
Returns:
The object returned by the Callable.call() method on the remote machine (transferred back to this machine)


Copyright © 2012. All Rights Reserved.