|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.prc.example.java.common.Client
edu.wpi.prc.example.java.generator.WorkGeneratorClient
public class WorkGeneratorClient
The WorkGeneratorClient is an XML-RPC client with added functionality that is needed by the work unit generator. It has methods for sending new work units to the server, retrieving the last work unit that was added, and retrieving the number of new (ingress) work units that the server has.
Field Summary | |
---|---|
private static WorkGeneratorClient |
client
|
private static java.lang.String |
DEFAULT_SERVER_ADDRESS
|
private static int |
EXIT_ERROR
|
private static java.lang.String |
GET_LAST_WU_RPC_NAME
|
private static java.lang.String |
GET_NUM_WU_RPC_NAME
|
private static java.lang.String |
SEND_WU_RPC_NAME
|
Constructor Summary | |
---|---|
private |
WorkGeneratorClient(java.lang.String serverAddress)
Constructor specifying the address of the project server. |
Method Summary | |
---|---|
WorkUnit |
getLastWorkUnit()
Retrieves the last work unit that was generated from the server. |
int |
getNumWorkUnits()
Retrieves the number of ingress (new) work units in the transitioner. |
static WorkGeneratorClient |
instance()
|
int |
sendWorkUnit(byte[] data)
Sends a new work unit to the server. |
int |
sendWorkUnit(byte[] data,
int priority,
int points)
Sends a new work unit to the server. |
int |
sendWorkUnit(byte[] data,
int priority,
int points,
double expirationTime)
Sends a new work unit to the server. |
int |
sendWorkUnit(java.lang.String workUnitID,
byte[] data,
int priority,
int points)
Sends a new work unit to the server. |
int |
sendWorkUnit(java.lang.String workUnitID,
byte[] data,
int priority,
int points,
double expirationTime)
Sends a new work unit to the server. |
private int |
sendWorkUnit(java.util.Vector params,
java.lang.String errorMessage)
Executes the server.addWorkUnit RPC with the given parameter list. |
private void |
shutdown()
Exits the entire process because an unrecoverable error occurred. |
Methods inherited from class edu.wpi.prc.example.java.common.Client |
---|
executeRPC, executeRPCUntilSuccess, setServerAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int EXIT_ERROR
private static final java.lang.String GET_LAST_WU_RPC_NAME
private static final java.lang.String GET_NUM_WU_RPC_NAME
private static final java.lang.String SEND_WU_RPC_NAME
private static final java.lang.String DEFAULT_SERVER_ADDRESS
private static WorkGeneratorClient client
Constructor Detail |
---|
private WorkGeneratorClient(java.lang.String serverAddress)
serverAddress
- The address (host:port) of the project server.Method Detail |
---|
private int sendWorkUnit(java.util.Vector params, java.lang.String errorMessage)
params
- The parameters to the server.addWorkUnit RPC.errorMessage
- The message to be displayed if an error occurs.
public WorkUnit getLastWorkUnit() throws RPCHandlerException
RPCHandlerException
public int sendWorkUnit(java.lang.String workUnitID, byte[] data, int priority, int points, double expirationTime)
workUnitID
- The ID of the work unit.data
- A byte array containing the work unit data.priority
- The priority of the work unit. The minimum
priority is zero, and higher values correspond to higher
priorities.points
- The number of points to give a volunteer upon
returning a valid result for this work unit.expirationTime
- The number of seconds until this work unit
should expire. If the work unit is not retired before this amount
of time elapses, the work unit will be recycled into the ingress
queue and will be distributed to other volunteers.
public int sendWorkUnit(java.lang.String workUnitID, byte[] data, int priority, int points)
workUnitID
- The ID of the work unit.data
- A byte array containing the work unit data.priority
- The priority of the work unit. The minimum
priority is zero, and higher values correspond to higher
priorities.points
- The number of points to give a volunteer upon
returning a valid result for this work unit.
public int sendWorkUnit(byte[] data, int priority, int points, double expirationTime)
data
- A byte array containing the work unit data.priority
- The priority of the work unit. The minimum
priority is zero, and higher values correspond to higher
priorities.points
- The number of points to give a volunteer upon
returning a valid result for this work unit.expirationTime
- The number of seconds until this work unit
should expire. If the work unit is not retired before this amount
of time elapses, the work unit will be recycled into the ingress
queue and will be distributed to other volunteers.
public int sendWorkUnit(byte[] data, int priority, int points)
data
- A byte array containing the work unit data.priority
- The priority of the work unit. The minimum
priority is zero, and higher values correspond to higher
priorities.points
- The number of points to give a volunteer upon
returning a valid result for this work unit.
public int sendWorkUnit(byte[] data)
data
- A byte array containing the work unit data.
public int getNumWorkUnits()
private void shutdown()
public static WorkGeneratorClient instance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |