|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.clients.jobagent.slotmanager.InternalSlotManager net.sf.basedb.clients.jobagent.slotmanager.MasterSlotManager
public class MasterSlotManager
An extension to the internal slot manager which also accepts
slot assignment from remote job agents. A custom request
handler (MasterSlotManager.RemoteSlotRequestHandler
) is installed to take care
of the communication. Remotely assigned slots has a time-out (30 seconds)
associated with them. This means that if the connection with
the remote host is lost, the assigned slots are re-cycled.
The requst handler uses a simple protocol with the following actions:
slotmanager://host:port/get-slot?TIME
: Get a new slot for the
TIME estimated execution time. TIME is a name from the Job.ExecutionTime
enumeration. If succcessful, the request handler answers with OK
on the first line
and then Id:slot-id
and Slot:TIME
on the following lines.
It is recommended that the answer is parsed with JobAgentConnection.parseSimpleAnswer(String)
.
slotmanger://slot-id@host:port/release-slot
: Release the slot with
the given id.
slotmanager://slot-id@host:port/ping-slot
: Ping the slot with the
given id to indicate that the job is still running on the remote job agent. A remote
slot has a timeout of 30 seconds so the remote job agent has to send a ping at least
at that interval or the slot will be returned to the pool.
FAILED
followed with an
explanation.
Nested Class Summary | |
---|---|
(package private) static class |
MasterSlotManager.RemoteSlot
A remote slot is a slot with some information about when it was created and last updated. |
(package private) static class |
MasterSlotManager.RemoteSlotRequestHandler
Request handler implementation that accepts requests for slots from remote hosts. |
(package private) static class |
MasterSlotManager.RemoteSlotTimeoutChecker
Task that is scheduled at regular intervals to check for timed out slots. |
Field Summary | |
---|---|
private static Logger |
log
|
private MasterSlotManager.RemoteSlotRequestHandler |
remoteRequestHandler
|
private Map<String,MasterSlotManager.RemoteSlot> |
remoteSlots
|
private TimerTask |
timeoutChecker
|
Constructor Summary | |
---|---|
MasterSlotManager()
|
Method Summary | |
---|---|
(package private) int |
checkTimeoutOnRemoteSlots()
Check the remote slots to see if they have timed out. |
void |
close()
This method is called when the job agent is shutting down. |
(package private) MasterSlotManager.RemoteSlot |
getRemoteSlot(Job.ExecutionTime estimated)
Create a slot for a job on a remote job agent with the specified estimated execution time. |
(package private) MasterSlotManager.RemoteSlot |
getRemoteSlot(String slotId)
Get the remote slot with the given id. |
void |
init(Agent agent)
Initialize the slot manager. |
(package private) MasterSlotManager.RemoteSlot |
releaseRemoteSlot(String slotId)
Release the remote slot with the given id. |
Methods inherited from class net.sf.basedb.clients.jobagent.slotmanager.InternalSlotManager |
---|
getAgent, getSlot, getSlot, releaseSlot |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private Map<String,MasterSlotManager.RemoteSlot> remoteSlots
private MasterSlotManager.RemoteSlotRequestHandler remoteRequestHandler
private TimerTask timeoutChecker
Constructor Detail |
---|
public MasterSlotManager()
Method Detail |
---|
public void init(Agent agent)
SlotManager
init
in interface SlotManager
init
in class InternalSlotManager
agent
- The job agentpublic void close()
SlotManager
close
in interface SlotManager
close
in class InternalSlotManager
MasterSlotManager.RemoteSlot getRemoteSlot(Job.ExecutionTime estimated)
InternalSlotManager.getSlot(net.sf.basedb.core.Job.ExecutionTime)
and then wrap the slot in a MasterSlotManager.RemoteSlot
instance.
MasterSlotManager.RemoteSlot getRemoteSlot(String slotId)
slotId
- The id of the slot
MasterSlotManager.RemoteSlot releaseRemoteSlot(String slotId)
slotId
- The id of the slot
int checkTimeoutOnRemoteSlots()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |