2
* Copyright (C) 2009 by Eric Lambert <Eric.Lambert@sun.com>
3
* Use and distribution licensed under the
4
* GNU Lesser General Public License (LGPL) version 2.1.
5
* See the COPYING file in the parent directory for full text.
9
import java.util.concurrent.Callable;
13
* This interface exposes the API which GearmanFunction classes will need to
17
* A Gearman Function represents the work to be accomplished by a
18
* {@link GearmanJob}. It defines how the job is executed and the data, if
19
* any, against which that execution will occurr.
21
public interface GearmanFunction extends Callable<GearmanPacket> {
24
* Retrieves the name of the funcion. This is used by a {@link GearmanWorker}
25
* to determine if the function has been regisitered with the user and
26
* therefor can be executed by the Worker.
28
* @return the name of the function.
33
* Some functions require a dataset upon which to operate. This method is
34
* used to load that data so that it is available when the function is
37
* @param data The data used by the function at execution time.
39
void setData(Object data);
42
* Set the handle of the job for which this function is executing.
44
* @param handle the job handle.
45
* @throws IllegalArgumentException if the handle is null or empty.
47
void setJobHandle(byte [] handle) throws IllegalArgumentException;
49
byte [] getJobHandle();
51
void registerEventListener(GearmanJobEventListener listener);
53
void fireEvent(GearmanPacket event);