T
- public abstract class ResourceConstraint<T extends ResourceConstraint<T>>
extends java.lang.Object
<T>
in the each
concrete subclass. Each type is responsible for constraining on resource
for a group of tasks (instances of Schedulable
and
other instances of java.lang.Thread
). A task is only ever
associated with one instance of a given type of ResourceConstraint
via its RealtimeThreadGroup
nearest instance, i.e., the first
RealtimeThreadGroup
found that has an associated instance of
<T>
when traversing up the thread group hierarchy from its
immediate thread group.Constructor and Description |
---|
ResourceConstraint(RealtimeThreadGroup group)
Create a new contraint with the given parent.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize() |
java.util.function.Consumer<T> |
getNotificationHandler() |
T |
getParent() |
RealtimeThreadGroup |
getRealtimeThreadGroup()
Determine the associated realtime thread group.
|
boolean |
governs()
See whether or not this task is governed, i.e., limited by this
constraint.
|
boolean |
governs(Schedulable schedulable)
See whether or not
schedulable is governed, i.e., limited by
this constraint. |
boolean |
governs(java.lang.Thread thread)
See whether or not
thread is governed, i.e., limited by
this constraint. |
boolean |
isEnforcing()
Determine whether or not enforcing is in effect.
|
void |
setNotificationHandler(java.util.function.Consumer<T> handler)
Set the handler that should be called when this constraint is
violated.
|
abstract void |
start()
Start applying this constraint to is tasks.
|
abstract void |
stop()
Stop applying this constraint to is tasks.
|
void |
visitBorrowers(java.util.function.Consumer<T> visitor)
Do something on each child constraint.
|
void |
visitGoverned(java.util.function.Consumer<java.lang.Thread> visitor)
Do something on each task subject to this constraint.
|
public ResourceConstraint(RealtimeThreadGroup group)
group
- The group this constraint governs.java.lang.Throwable
public T getParent()
public boolean isEnforcing()
true
when yes and false
when not.public abstract void start()
public abstract void stop()
public RealtimeThreadGroup getRealtimeThreadGroup()
public boolean governs()
public boolean governs(java.lang.Thread thread)
thread
is governed, i.e., limited by
this constraint.thread
- The thread in questionpublic boolean governs(Schedulable schedulable)
schedulable
is governed, i.e., limited by
this constraint.schedulable
- The schedulable in questionpublic final void visitBorrowers(java.util.function.Consumer<T> visitor)
visitor
- the code to execute on each child.public final void visitGoverned(java.util.function.Consumer<java.lang.Thread> visitor)
visitor
- the code to execute on each task.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setNotificationHandler(java.util.function.Consumer<T> handler)
handler
- A consumer that accepts the constraint object.
{@code Thread.currentThread() can be used to identify the thread
that caused the overrun.public java.util.function.Consumer<T> getNotificationHandler()
aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.