~elambert/gearmanij/gearman_java_library

« back to all changes in this revision

Viewing changes to src/org/gearman/GearmanFunction.java

  • Committer: Eric Lambert
  • Date: 2009-07-07 02:18:15 UTC
  • mfrom: (57.1.65 gearmanij-trunk)
  • Revision ID: eric.d.lambert@gmail.com-20090707021815-0xbupi72ubyoa62a
merge from trunk. ReverseWorkerTest has been ignored, it was failing claiming that certain ops were not supported, since there is duplication in the worker code, for the time being will just ignore this issue, will resolve once the worker code has been straightened out

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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.
6
 
 */
7
 
package org.gearman;
8
 
 
9
 
import java.util.concurrent.Callable;
10
 
 
11
 
/**
12
 
 *
13
 
 * This interface exposes the API which GearmanFunction classes will need to
14
 
 * implement.
15
 
 *
16
 
 * <p>
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.
20
 
 */
21
 
public interface GearmanFunction extends Callable<GearmanPacket> {
22
 
 
23
 
    /**
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.
27
 
     *
28
 
     * @return the name of the function.
29
 
     */
30
 
    String getName();
31
 
 
32
 
    /**
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
35
 
     * called.
36
 
     *
37
 
     * @param data The data used by the function at execution time.
38
 
     */
39
 
    void setData(Object data);
40
 
 
41
 
    /**
42
 
     * Set the handle of the job for which this function is executing.
43
 
     *
44
 
     * @param handle the job handle.
45
 
     * @throws IllegalArgumentException if the handle is null or empty.
46
 
     */
47
 
    void setJobHandle(byte [] handle) throws IllegalArgumentException;
48
 
 
49
 
    byte [] getJobHandle();
50
 
 
51
 
    void registerEventListener(GearmanJobEventListener listener);
52
 
 
53
 
    void fireEvent(GearmanPacket event);
54
 
 
55
 
 
56
 
}