Class InternalSlotManager
java.lang.Object
net.sf.basedb.clients.jobagent.slotmanager.InternalSlotManager
- All Implemented Interfaces:
SlotManager
- Direct Known Subclasses:
MasterSlotManager
The internal slot manager assigns slot to jobs based on their
estimated execution time. The configuration file gives the
maximum number of slots for each execution time:
- agent.shortest.slots:
Job.ExecutionTime.SHORTEST
- agent.short.slots:
Job.ExecutionTime.SHORT
- agent.medium.slots:
Job.ExecutionTime.MEDIUM
- agent.long.slots:
Job.ExecutionTime.LONG
- Since:
- 2.16
- Author:
- Nicklas
- Last modified
- $Date: 2014-04-09 14:21:20 +0200 (on, 09 apr 2014) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This method is called when the job agent is shutting down.protected Agent
getAgent()
Get the job agent this slot manager belongs to.Get a slot for the specified job.protected Slot
getSlot
(Job.ExecutionTime estimated) Get a slot for a job with the given estimated execution time.void
Initialize the slot manager.void
releaseSlot
(Slot slot) Called by the job agent when the job has finished exeuting.
-
Field Details
-
log
-
agent
-
maxSlots
private int[] maxSlots -
usedSlots
private int[] usedSlots
-
-
Constructor Details
-
InternalSlotManager
public InternalSlotManager()
-
-
Method Details
-
init
Description copied from interface:SlotManager
Initialize the slot manager. This method is called once when the job agent is starting up. The slot manager may read configuration settings, and intialize local resources.- Specified by:
init
in interfaceSlotManager
- Parameters:
agent
- The job agent
-
close
public void close()Description copied from interface:SlotManager
This method is called when the job agent is shutting down. The slot manager should clean up any resources it is using.- Specified by:
close
in interfaceSlotManager
-
getSlot
Description copied from interface:SlotManager
Get a slot for the specified job. If no free slot is available null is returned.- Specified by:
getSlot
in interfaceSlotManager
- Parameters:
job
- The job that the job agent wants to execute- Returns:
- A slot or null if no slot is available
-
releaseSlot
Description copied from interface:SlotManager
Called by the job agent when the job has finished exeuting.- Specified by:
releaseSlot
in interfaceSlotManager
- Parameters:
slot
- The slot that was assigned to the job
-
getAgent
Get the job agent this slot manager belongs to.- See Also:
-
getSlot
Get a slot for a job with the given estimated execution time. If no slot is available at the specified execution time, longer times are searched. If all slots are taken, null is returned.- Parameters:
estimated
- The estimated execution time of the slot- Returns:
- A slot or null if no slot is available
-