public interface IJobSchedulerContext extends IMessageEndpoint
Modifier and Type | Method and Description |
---|---|
IJob |
createChildJob()
Creates a child job and yields all resources to children.
|
IJob |
createChildJob(boolean yieldAllResourcesToChildren)
Creates a child job.
|
long |
reserveResource(java.lang.String resource,
long amount)
Reserves the resource with the specified amount.
|
long |
reserveResource(java.lang.String resource,
long amount,
boolean restrictToChildren)
Reserves the resource with the specified amount, possibly restricting to
children jobs.
|
long |
reserveResource(java.lang.String resource,
long amount,
boolean restrictToChildren,
int millisecondsTimeout)
Reserves the resource with the specified amount, possibly restricting to
children jobs, and with the specified time-out.
|
long |
reserveResource(java.lang.String resource,
long amount,
int millisecondsTimeout)
Reserves the resource with the specified amount, with the specified time-out.
|
long |
yieldResource(java.lang.String resource,
long amount)
Yields the resource with the specified amount without a restriction to
children.
|
long |
yieldResource(java.lang.String resource,
long amount,
boolean restrictToChildren)
Yields the resource with the specified amount.
|
addNewMessageListener, getId, postMessage, postMessage, receiveMessage, receiveMessage, receiveMessage, receiveMessage
IJob createChildJob()
IJob createChildJob(boolean yieldAllResourcesToChildren)
yieldAllResourcesToChildren
- If set to true
yields all resources to children once the
job is submitted.long reserveResource(java.lang.String resource, long amount)
Blocks until the resource becomes available.
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, there were
not enough resources to satisfy reserve request.long reserveResource(java.lang.String resource, long amount, boolean restrictToChildren)
Blocks until the resource becomes available.
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.restrictToChildren
- If set to true
will reserve resources only from child
jobs.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, there were
not enough resources to satisfy reserve request.long reserveResource(java.lang.String resource, long amount, int millisecondsTimeout)
Blocks until the resource becomes available or the time-out expires. If the
time-out expires a JobSchedulerException
is
thrown.
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.millisecondsTimeout
- The number of milliseconds to wait, or -1 to wait indefinitely.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, there were
not enough resources to satisfy reserve request.long reserveResource(java.lang.String resource, long amount, boolean restrictToChildren, int millisecondsTimeout)
Blocks until the resource becomes available or the time-out expires. If the
time-out expires a JobSchedulerException
is
thrown.
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.restrictToChildren
- If set to true
will reserve resources only from child
jobs.millisecondsTimeout
- The number of milliseconds to wait, or -1 to wait indefinitely.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, there were
not enough resources to satisfy reserve request.long yieldResource(java.lang.String resource, long amount)
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, there were
not enough resources to satisfy reserve request.long yieldResource(java.lang.String resource, long amount, boolean restrictToChildren)
resource
- The resource. You can find common values for resources using
ConsumableResources
.amount
- The amount.restrictToChildren
- If set to true
will yield resources only to child jobs.java.lang.IllegalArgumentException
- If resource is null
.java.lang.IllegalArgumentException
- If amount if less than 0
.JobSchedulerException
- If error occurred during operation. For instance, yield amount
was more than the amount current allocated.