public class ThreadConstraint extends ResourceConstraint<ThreadConstraint>
ThreadGroup
and
RealtimeThreadGroup
, instances of ProcessingConstraint
can be nested. The number of the threads, including threads in
subgroups not subject to another ProcessingConstraint
instance, can be both tracked and bounded.Constructor and Description |
---|
ThreadConstraint(RealtimeThreadGroup group,
int max)
Creates a
ThreadConstraint to govern a group of threads. |
Modifier and Type | Method and Description |
---|---|
int |
available()
Determine how much of the resource are available for use, i.e., the
amount of the limit minus amount lent.
|
static ThreadConstraint |
currentConstraint()
Determine the processing constraint for the current execution context.
|
static ThreadConstraint |
currentConstraint(Thread thread)
Determine the processing constraint for the give execution context.
|
static ThreadConstraint |
currentConstraint(ThreadGroup group)
Determine the processing constraint for the give execution context.
|
int |
getBudget()
Determine the total amount of a memory under the control of this
resource constraint instance.
|
static ThreadConstraint |
getRootConstraint()
Get the root instance for this constraint type.
|
boolean |
isEnforcing()
Determine whether or not enforcing is in effect.
|
void |
start()
Start applying this constraint to is tasks.
|
void |
stop()
Stop applying this constraint to is tasks.
|
int |
used()
Determine how much of the resource have been used of the amount available.
|
finalize, getNotificationHandler, getParent, getRealtimeThreadGroup, governs, governs, governs, setNotificationHandler, visitBorrowers, visitGoverned
public ThreadConstraint(RealtimeThreadGroup group, int max) throws StaticIllegalStateException
ThreadConstraint
to govern a group of threads.StaticIllegalStateException
group
- The RealtimeThreadGroup
to govern.max
- The maximum number of threads allowed.public static ThreadConstraint getRootConstraint()
public static ThreadConstraint currentConstraint()
public static ThreadConstraint currentConstraint(Thread thread)
thread
- The given execution context.public static ThreadConstraint currentConstraint(ThreadGroup group)
group
- The given execution context.public boolean isEnforcing()
isEnforcing
in class ResourceConstraint<ThreadConstraint>
true
when yes and false
when not.public void start()
start
in class ResourceConstraint<ThreadConstraint>
public void stop()
stop
in class ResourceConstraint<ThreadConstraint>
public int getBudget()
public int used()
public int available()
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.