/** * Initializes the task description. * @param jobId The <code>UUID</code> of the job that the task is for. * @param taskId The ID of the task to be performed. * @param task An <code>Object</code> describing the task to be performed. * This should be passed to <code>TaskWorker.performTask</code>. * @see TaskWorker#performTask(Object, ca.eandb.util.progress.ProgressMonitor) */ public TaskDescription(UUID jobId, int taskId, Object task) { this.jobId = jobId; this.taskId = taskId; this.task = new Serialized<Object>(task); }
/** * Returns the deserialized object. * @return The deserialized object. * @throws IllegalStateException If the object has not been deserialized. */ public T get() { if (!isDeserialized()) { throw new IllegalStateException("Object not deserialized."); } return object; }
/** * Returns the deserialized object. * @param deserialize A value indicating whether the object should be * deserialized if it is not already. * @return The deserialized object. * @throws ClassNotFoundException If a required class could not be found * during deserialization. * @throws IllegalStateException If the object has not been deserialized * and <code>deserialize</code> is false. */ public T get(boolean deserialize) throws ClassNotFoundException { if (!isDeserialized()) { if (deserialize) { deserialize(); } else { throw new IllegalStateException("Object not deserialized."); } } return object; }
/** * Submits a job to a server for processing. * @param job The <code>ParallelizableJob</code> to be processed. * @param description A description of the job. * @param host The host name of the server to send the job to. * @param username The user name to use to authenticate with the server. * @param password The password to use to authenticate with the server. * @return The <code>UUID</code> assigned to the job. * @throws SecurityException If the user does not have access to perform * the requested action on the server. * @throws RemoteException If a failure occurs in attempting to communicate * with the server. * @throws ClassNotFoundException If deserialization of the job at the * server requires a class that could not be found on the server. * @throws JobExecutionException If the submitted job threw an exception at * the server during initialization. * @throws LoginException If the login attempt fails. * @throws NotBoundException If the <code>AuthenticationService</code> * could not be found at the server. * @throws ProtocolVersionException If this client is incompatible with the * server. */ public static UUID submitJob(ParallelizableJob job, String description, String host, String username, String password) throws SecurityException, RemoteException, ClassNotFoundException, JobExecutionException, LoginException, NotBoundException, ProtocolVersionException { Serialized<ParallelizableJob> payload = new Serialized<ParallelizableJob>(job); JobService service = connect(host, username, password); return service.submitJob(payload, description); }