public abstract class ScopedMemory extends MemoryArea
ScopedMemory
is the abstract base class of all classes dealing with
representations of memory spaces which have a limited lifetime. In general,
objects allocated in scoped memory are freed when, and only when, no
schedulable object has access to the objects in the scoped memory.
A ScopedMemory
area is a connection to a particular region of memory
and reflects the current status of that memory. The object does not
necessarily contain direct references to the region of memory. That is
implementation dependent.
When a ScopedMemory
area is instantiated, the object itself is
allocated from the current memory allocation context, but the memory space
that object represents (its backing store) is allocated from memory that is
not otherwise directly visible to Java code; e.g., it might be allocated with
the C malloc
function. This backing store behaves effectively as if
it were allocated when the associated scoped memory object is constructed and
freed at that scoped memory object's finalization.
The enter()
method of ScopedMemory
is one
mechanism used to make a memory area the current allocation context. The
other mechanism for activating a memory area is making it the initial memory
area for a realtime thread or async event handler. Entry into the scope is
accomplished, for example, by calling the method:
public void enter(Runnable logic)
where logic
is an instance of Runnable
whose run()
method represents the entry point of the code that will run in the new scope.
Exit from the scope occurs between the time the runnable.run()
method
completes and the time control returns from the enter()
method.
By default, allocations of objects within runnable.run()
are taken
from the backing store of the ScopedMemory
.
ScopedMemory
is an abstract class, but all specified methods include
implementations. The responsibilities of MemoryArea
,
ScopedMemory
and the classes that extend ScopedMemory
are not
specified. In JamaicaVM, application code is not permitted to create
instances of user-defined direct subclasses of ScopedMemory
.
Modifier and Type | Method and Description |
---|---|
void |
enter()
Associates this memory area with the current schedulable for the duration
of the execution of the
run() method of the instance of Runnable given in the constructor. |
boolean |
enter(BooleanSupplier logic)
Same as
MemoryArea.enter(Runnable) except that the executed method is
called getAsBoolean() and a boolean is returned. |
double |
enter(DoubleSupplier logic)
Same as
MemoryArea.enter(Runnable) except that the executed method is
called getAsDouble() and a double is returned. |
int |
enter(IntSupplier logic)
Same as
MemoryArea.enter(Runnable) except that the executed method is
called getAsInt() and an int is returned. |
long |
enter(LongSupplier logic)
Same as
MemoryArea.enter(Runnable) except that the executed method is
called getAsLong() and a long is returned. |
void |
enter(Runnable logic)
Associates this memory area with the current schedulable for the duration
of the execution of the
run() method of the given Runnable . |
<T> T |
enter(Supplier<T> logic)
Same as
MemoryArea.enter(Runnable) except that the executed method is
called get() and an object is returned. |
boolean |
executeInArea(BooleanSupplier logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
double |
executeInArea(DoubleSupplier logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
int |
executeInArea(IntSupplier logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
long |
executeInArea(LongSupplier logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
void |
executeInArea(Runnable logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
<T> T |
executeInArea(Supplier<T> logic)
Executes the run method from the
logic parameter using
this memory area as the current allocation context. |
MemoryArea |
getParent()
Returns the parent memory area when there is a parent and it is a scoped
memory.
|
Object |
getPortal()
Returns a reference to the portal object in this instance of
ScopedMemory . |
int |
getReferenceCount()
Returns the reference count of this
ScopedMemory . |
static long |
globalBackingStoreConsumed() |
static long |
globalBackingStoreRemaining() |
static long |
globalBackingStoreSize() |
void |
join()
Waits until the reference count of this
ScopedMemory goes down to
zero. |
void |
join(HighResolutionTime<?> time)
Waits at most until the time designated by the
time parameter for
the reference count of this ScopedMemory to drop to zero. |
void |
joinAndEnter()
In the error-free case,
joinAndEnter combines
join();enter(); such that no enter() from another
schedulable can intervene between the two method invocations. |
boolean |
joinAndEnter(BooleanSupplier logic)
Same as
joinAndEnter(Runnable) except that the executed
method is called get and a boolean is returned. |
boolean |
joinAndEnter(BooleanSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnter(Runnable, HighResolutionTime) except that
the executed method is called get and a boolean
is returned. |
double |
joinAndEnter(DoubleSupplier logic)
Same as
joinAndEnter(Runnable) except that the executed
method is called get and a double is returned. |
double |
joinAndEnter(DoubleSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnter(Runnable, HighResolutionTime) except that
the executed method is called get and a double
is returned. |
void |
joinAndEnter(HighResolutionTime<?> time)
In the error-free case,
joinAndEnter combines
join();enter(); such that no enter() from another
schedulable can intervene between the two method invocations. |
int |
joinAndEnter(IntSupplier logic)
Same as
joinAndEnter(Runnable) except that the executed
method is called get and an int is returned. |
int |
joinAndEnter(IntSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnter(Runnable, HighResolutionTime) except that
the executed method is called get and an int
is returned. |
long |
joinAndEnter(LongSupplier logic)
Same as
joinAndEnter(Runnable) except that the executed
method is called get and a long is returned. |
long |
joinAndEnter(LongSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnter(Runnable, HighResolutionTime) except that
the executed method is called get and a long
is returned. |
void |
joinAndEnter(Runnable logic)
In the error-free case,
joinAndEnter combines
join();enter(); such that no enter() from another
schedulable can intervene between the two method invocations. |
void |
joinAndEnter(Runnable logic,
HighResolutionTime<?> time)
In the error-free case,
joinAndEnter combines
join();enter(); such that no enter() from another
schedulable can intervene between the two method invocations. |
<P> P |
joinAndEnter(Supplier<P> logic,
HighResolutionTime<?> time)
Same as
joinAndEnter(Runnable, HighResolutionTime) except that
the executed method is called get and an object
is returned. |
<T> T |
joinAndEnter(Supplier<T> logic)
Same as
joinAndEnter(Runnable) except that the executed
method is called get and an object is returned. |
boolean |
joinAndEnterInternal(BooleanSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get and a
boolean is returned. |
double |
joinAndEnterInternal(DoubleSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get and a double
is returned. |
int |
joinAndEnterInternal(IntSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get and an int
is returned. |
long |
joinAndEnterInternal(LongSupplier logic,
HighResolutionTime<?> time)
Same as
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get and a long
is returned. |
<P> P |
joinAndEnterInternal(Supplier<P> logic,
HighResolutionTime<?> time)
Same as
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get and an object
is returned. |
boolean |
mayHoldReferenceTo()
Determines whether an object
A allocated in the memory area
represented by this can hold a reference to an object
B allocated in the current memory area. |
boolean |
mayHoldReferenceTo(Object value)
Determines whether an object allocated in the memory area
represented by
this can hold a reference to the object
value . |
void |
setPortal(Object object)
Sets the portal object of the memory area represented by this
instance of
ScopedMemory to the given object. |
String |
toString()
Returns a user-friendly representation of this
ScopedMemory of the form
<class-name>@<num>" where <class-name>
is the name of the class, e.g. |
getMemoryArea, memoryConsumed, memoryRemaining, newArray, newArrayInArea, newInstance, newInstance, size
public static long globalBackingStoreSize()
public static long globalBackingStoreConsumed()
public static long globalBackingStoreRemaining()
public boolean mayHoldReferenceTo()
MemoryArea
A
allocated in the memory area
represented by this
can hold a reference to an object
B
allocated in the current memory area.mayHoldReferenceTo
in class MemoryArea
true
only when the current memory area is also an
instance of PerennialMemory
.public boolean mayHoldReferenceTo(Object value)
MemoryArea
this
can hold a reference to the object
value
.mayHoldReferenceTo
in class MemoryArea
value
- The object to test.public void enter() throws ScopedCycleException
run()
method of the instance of Runnable
given in the constructor. During this period of execution, this
memory area becomes the default allocation context until another default
allocation context is selected (using enter
, or executeInArea(java.lang.Runnable)
) or the enter
method exits.enter
in class MemoryArea
ScopedCycleException
- when this invocation would break
the single parent rule.ThrowBoundaryError
- Thrown when the JVM needs to
propagate an exception allocated
in this
scope to (or
through) the memory area of the
caller. Storing a reference to
that exception would cause an
IllegalAssignmentError
,
so the JVM may not be permitted to
deliver the exception. The ThrowBoundaryError
is allocated in the current
allocation context and contains
information about the exception it
replaces.IllegalTaskStateException
- when the execution context is not
an instance of Schedulable
or when this method is invoked
during finalization of objects in
scoped memory and entering this
scoped memory area would force
deletion of the execution context
that triggered finalization. This
would include the scope containing
the execution context, and the
scope (if any) containing the
scope containing execution
context.StaticIllegalArgumentException
- when the caller is a schedulable
and a null
value for
logic
was supplied when
the memory area was constructed.MemoryAccessError
- when caller is a schedulable that
may not use the heap and this
memory area's logic value is
allocated in heap memory.public void enter(Runnable logic) throws ScopedCycleException
run()
method of the given Runnable
.
During this period of execution, this memory area becomes the default
allocation context until another default allocation context is selected
(using enter
, or executeInArea(java.lang.Runnable)
) or the enter
method exits.enter
in class MemoryArea
ScopedCycleException
- when this invocation would break
the single parent rule.ThrowBoundaryError
- when the JVM needs to propagate an
exception allocated in this
scope to (or through) the
memory area of the caller. Storing
a reference to that exception
would cause an IllegalAssignmentError
,
so the JVM may not be permitted to
deliver the exception. The ThrowBoundaryError
is allocated in the current
allocation context and contains
information about the exception it
replaces.IllegalTaskStateException
- when the execution context is not
an instance of Schedulable
or when this method is invoked
during finalization of objects in
scoped memory and entering this
scoped memory area would force
deletion of the task that
triggered finalization. This
would include the scope containing
the task, and the scope (if any)
containing the scope containing
task.StaticIllegalArgumentException
- when the caller is a schedulable
and logic
is
null
.logic
- The Runnable object whose run()
method should be
invoked.public boolean enter(BooleanSupplier logic) throws ScopedCycleException
MemoryArea
MemoryArea.enter(Runnable)
except that the executed method is
called getAsBoolean()
and a boolean is returned.enter
in class MemoryArea
ScopedCycleException
logic
- The object whose getAsboolean()
method is to
be executed.getAsBoolean()
method.public double enter(DoubleSupplier logic) throws ScopedCycleException
MemoryArea
MemoryArea.enter(Runnable)
except that the executed method is
called getAsDouble()
and a double is returned.enter
in class MemoryArea
ScopedCycleException
logic
- The object whose getAsDouble()
method is to be
executed.getAsDouble()
method.public int enter(IntSupplier logic) throws ScopedCycleException
MemoryArea
MemoryArea.enter(Runnable)
except that the executed method is
called getAsInt()
and an int is returned.enter
in class MemoryArea
ScopedCycleException
logic
- The object whose getAsInt()
method is to be
executed.getAsInt()
method.public long enter(LongSupplier logic) throws ScopedCycleException
MemoryArea
MemoryArea.enter(Runnable)
except that the executed method is
called getAsLong()
and a long is returned.enter
in class MemoryArea
ScopedCycleException
logic
- The object whose getAsLong()
method is to be
executed.getAsLong()
method.public <T> T enter(Supplier<T> logic) throws ScopedCycleException
MemoryArea
MemoryArea.enter(Runnable)
except that the executed method is
called get()
and an object is returned. The
The get()
method must ensure that the returned object is
allocated outside the area, when the area is not a PerennialMemory.enter
in class MemoryArea
ScopedCycleException
logic
- The object whose get()
method is to be
executed.get()
method.public Object getPortal() throws MemoryAccessError, IllegalAssignmentError
ScopedMemory
.
Assignment rules are enforced on the value returned by getPortal()
as if the return value were first stored in an object allocated in the
current allocation context, then moved to its final destination.
IllegalAssignmentError
- when a reference to the portal
object may not be stored in the
caller's allocation context; that
is, when the object is allocated
in a more deeply nested scoped
memory than the current allocation
context or not on the caller's
scope stack.IllegalTaskStateException
- when the execution context is not
an instance of
Schedulable
.MemoryAccessError
null
when there is no
portal object. The portal value is always set to null
when the
contents of the memory are deleted.public void setPortal(Object object)
ScopedMemory
to the given object. The object must
have been allocated in this ScopedMemory
instance.IllegalThreadStateException
- when the execution context is not an
instance of
Schedulable
.IllegalAssignmentError
- when the execution context is an
instance of
Schedulable
,
and object
is not allocated in
this scoped memory instance and not
null
.InaccessibleAreaException
- when the execution context is a
schedulable, this
memory area
is not in the caller's scope stack and
object
is not null
.object
- The object which will become the portal for this. When null
the previous portal object remains the portal object
for this or when there was no previous portal object then
there is still no portal object for this
.public int getReferenceCount()
ScopedMemory
.
Note that a reference count of zero reliably means that the scope is not referenced, but other reference counts are subject to artifacts of lazy/eager maintenance by the implementation.
ScopedMemory
.public MemoryArea getParent()
null
is
returned. This reduces the need for casting the returned value.null
or the parent scopepublic String toString()
ScopedMemory
of the form
<class-name>@<num>"
where <class-name>
is the name of the class, e.g. javax.realtime.memory.ScopedMemory, and
<num> is a number that uniquely identifies this scoped memory area.public void join(HighResolutionTime<?> time) throws InterruptedException
time
parameter for
the reference count of this ScopedMemory
to drop to zero. Returns
immediately when the memory area is unreferenced.
Since the time is expressed as a HighResolutionTime
,
this method is an accurate timer with nanosecond granularity. The actual
resolution of the timer and even the quantity it measures depends on the
clock associated with time
. The delay time may be relative or
absolute. When relative, then the delay is the amount of time given by
time
, and measured by its associated clock. When absolute, then the
delay is until the indicated value is reached by the clock. When the given
absolute time is less than or equal to the current value of the clock, the
call to join
returns immediately.
InterruptedException
- when this schedulable is
interrupted by
RealtimeThread.interrupt()
or
AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is not
an instance of
Schedulable
.StaticIllegalArgumentException
- when the execution context is a
schedulable and time
is
null
.UnsupportedOperationException
- when the wait operation is not
supported using the clock
associated with time
.time
- When this time is an absolute time, the wait is bounded by that
point in time. When the time is a relative time (or a member of
the RationalTime
subclass of RelativeTime
) the
wait is bounded by a the specified interval from some time
between the time join
is called and the time it starts
waiting for the reference count to reach zero.public void join() throws InterruptedException
ScopedMemory
goes down to
zero. Returns immediately when the memory is unreferenced.InterruptedException
- when this schedulable is
interrupted by
RealtimeThread.interrupt()
or
AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is not
an instance of
Schedulable
.public void joinAndEnter() throws InterruptedException
joinAndEnter
combines
join();enter();
such that no enter()
from another
schedulable can intervene between the two method invocations. The resulting
method will wait for the reference count on this ScopedMemory
to
reach zero, then enters the ScopedMemory
and executes the
run
method from logic
passed in the constructor. When no
instance of Runnable
was passed to the memory area's constructor,
the method throws StaticIllegalArgumentException
immediately.
When multiple threads are waiting in joinAndEnter
family methods
for a memory area, at most one of them will be released each time
the reference count goes to zero.
Note that although joinAndEnter
guarantees that the reference count
is zero when the schedulable is released for entry, it does not guarantee
that the reference count will remain one for any length of time.
A subsequent enter
could raise the reference count to two.
InterruptedException
- when this schedulable is
interrupted by RealtimeThread.interrupt()
or
AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is
not an instance of Schedulable
or
when this method is invoked
during finalization of objects
in scoped memory and entering
this scoped memory area would
force deletion of the task that
triggered finalization. This
would include the scope
containing the task, and the
scope (if any) containing the
scope containing the task.ThrowBoundaryError
- when the JVM needs to propagate
an exception allocated in
this
scope to (or
through) the memory area of the
caller. Storing a reference to
that exception would cause an
IllegalAssignmentError
,
so the JVM may not be permitted
to deliver the exception. The
ThrowBoundaryError
is allocated in the current
allocation context and contains
information about the exception
it replaces.ScopedCycleException
- when this invocation would
break the single parent rule.StaticIllegalArgumentException
- when the execution context is a
schedulable and no non-null
logic
value was
supplied to the memory area's
constructor.MemoryAccessError
- when caller is a non-heap
schedulable and this memory
area's logic value is allocated
in heap memory.public void joinAndEnter(HighResolutionTime<?> time) throws InterruptedException
joinAndEnter
combines
join();enter();
such that no enter()
from another
schedulable can intervene between the two method invocations. The resulting
method will wait for the reference count on this ScopedMemory
to
reach zero, or for the current time to reach the designated time, then
enter the ScopedMemory
and execute the run
method from
Runnable
object passed to the constructor. When no instance of
Runnable
was passed to the memory area's constructor, the method
throws StaticIllegalArgumentException
immediately.
When multiple threads are waiting in joinAndEnter
family
methods for a memory area, at most one of them will be released
each time the reference count goes to zero.
Since the time is expressed as a HighResolutionTime
,
this method has an accurate timer with nanosecond granularity. The actual
resolution of the timer and even the quantity it measures depends on the
clock associated with time
. The delay time may be relative or
absolute. When relative, then the calling thread is blocked for at most the
amount of time given by time
, and measured by its associated clock.
When absolute, then the time delay is until the indicated value is reached
by the clock. When the given absolute time is less than or equal to the
current value of the clock, the call to joinAndEnter
behaves
effectively like enter()
.
Note that expiration of time
may cause control to enter the memory
area before its reference count has gone to zero.
ThrowBoundaryError
- when the JVM needs to propagate
an exception allocated in
this
scope to (or
through) the memory area of the
caller. Storing a reference to
that exception would cause an
IllegalAssignmentError
,
so the JVM may not be permitted
to deliver the exception. The
ThrowBoundaryError
is allocated in the current
allocation context and contains
information about the exception
it replaces.InterruptedException
- when this schedulable is
interrupted by
RealtimeThread.interrupt()
or
AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is
not an instance of
Schedulable
or when this method is invoked
during finalization of objects
in scoped memory and entering
this scoped memory area would
force deletion of the task that
triggered finalization. This
would include the scope
containing the task, and the
scope (if any) containing the
scope containing the task.ScopedCycleException
- when the execution context is a
schedulable and this invocation
would break the single parent
rule.StaticIllegalArgumentException
- when the execution context is a
schedulable, and time
is null
or no non-null
logic
value was
supplied to the memory area's
constructor.UnsupportedOperationException
- when the wait operation is not
supported using the clock
associated with time
.MemoryAccessError
- when calling schedulable may
not use the heap and this
memory area's logic value is
allocated in heap memory.time
- The time that bounds the wait.public void joinAndEnter(Runnable logic) throws InterruptedException, StaticIllegalArgumentException, IllegalTaskStateException, ThrowBoundaryError, ScopedCycleException, StaticIllegalStateException
joinAndEnter
combines
join();enter();
such that no enter()
from another
schedulable can intervene between the two method invocations. The resulting
method will wait for the reference count on this ScopedMemory
to
reach zero, then enter the ScopedMemory
and execute the run
method from logic
When logic
is null
, the method throws
StaticIllegalArgumentException
immediately.
When multiple threads are waiting in joinAndEnter
family methods
for a memory area, at most one of them will be released each time
the reference count goes to zero.
Note that although joinAndEnter
guarantees that the reference count
is zero when the schedulable is released for entry, it does not guarantee
that the reference count will remain one for any length of time.
A subsequent enter
could raise the reference count to two.
InterruptedException
- when this schedulable is
interrupted by RealtimeThread.interrupt()
or AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is
not an instance of Schedulable
or
when this method is invoked
during finalization of objects
in scoped memory and entering
this scoped memory area would
force deletion of the task that
triggered finalization. This
would include the scope
containing the task, and the
scope (if any) containing the
scope containing the task.ThrowBoundaryError
- thrown when the JVM needs to
propagate an exception
allocated in this
scope
to (or through) the memory area
of the caller. Storing a
reference to that exception
would cause an IllegalAssignmentError
,
so the JVM may not be permitted
to deliver the exception. The
ThrowBoundaryError
is allocated in the current
allocation context and contains
information about the exception
it replaces.ScopedCycleException
- when this invocation would
break the single parent rule.StaticIllegalArgumentException
- when the execution context is a
schedulable and logic
is null
.IllegalStateException
- JamaicaVM: when the caller is a
non-realtime Java thread and
-strictRTSJ is set.StaticIllegalStateException
logic
- The Runnable
object which contains the code to
execute.public <T> T joinAndEnter(Supplier<T> logic) throws InterruptedException
joinAndEnter(Runnable)
except that the executed
method is called get
and an object is returned.InterruptedException
logic
- The object whose get method will be executed.public boolean joinAndEnter(BooleanSupplier logic) throws InterruptedException
joinAndEnter(Runnable)
except that the executed
method is called get
and a boolean
is returned.InterruptedException
logic
- The object whose get method will be executed.public int joinAndEnter(IntSupplier logic) throws InterruptedException
joinAndEnter(Runnable)
except that the executed
method is called get
and an int
is returned.InterruptedException
logic
- The object whose get method will be executed.public long joinAndEnter(LongSupplier logic) throws InterruptedException
joinAndEnter(Runnable)
except that the executed
method is called get
and a long
is returned.InterruptedException
logic
- The object whose get method will be executed.public double joinAndEnter(DoubleSupplier logic) throws InterruptedException
joinAndEnter(Runnable)
except that the executed
method is called get
and a double
is returned.InterruptedException
logic
- The object whose get method will be executed.public void joinAndEnter(Runnable logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter
combines
join();enter();
such that no enter()
from another
schedulable can intervene between the two method invocations. The resulting
method will wait for the reference count on this ScopedMemory
to
reach zero, or for the current time to reach the designated time, then
enter the ScopedMemory
and execute the run
method from
logic
.
Since the time is expressed as a HighResolutionTime
,
this method is an accurate timer with nanosecond granularity. The actual
resolution of the timer and even the quantity it measures depends on the
clock associated with time
. The delay time may be relative or
absolute. When relative, then the delay is the amount of time given by
time
, and measured by its associated clock. When absolute, then the
delay is until the indicated value is reached by the clock. When the given
absolute time is less than or equal to the current value of the clock, the
call to joinAndEnter
behaves effectively like enter(Runnable)
.
The method throws StaticIllegalArgumentException
immediately when
logic
is null
.
When multiple threads are waiting in joinAndEnter
family methods
for a memory area, at most one of them will be released each time
the reference count goes to zero.
Note that expiration of time
may cause control to enter the memory
area before its reference count has gone to zero.
InterruptedException
- when this schedulable is
interrupted by
RealtimeThread.interrupt()
or
AsynchronouslyInterruptedException.fire()
while waiting for the reference
count to go to zero.IllegalTaskStateException
- when the execution context is
not an instance of
Schedulable
or when this method is invoked
during finalization of objects
in scoped memory and entering
this scoped memory area would
force deletion of the task that
triggered finalization. This
would include the scope
containing the task, and the
scope (if any) containing the
scope containing the task.ThrowBoundaryError
- when the JVM needs to propagate
an exception allocated in
this
scope to (or
through) the memory area of the
caller. Storing a reference to
that exception would cause a
IllegalAssignmentError
,
so the JVM may not be permitted
to deliver the exception. The
ThrowBoundaryError
is preallocated and saves
information about the exception
it replaces.ScopedCycleException
- when the execution context is a
schedulable and this invocation
would break the single parent
rule.StaticIllegalArgumentException
- when the execution context is a
schedulable and time
or
logic
is null
.UnsupportedOperationException
- when the wait operation is not
supported using the clock
associated with time
.logic
- The Runnable
object which contains the code to
execute.time
- The time that bounds the wait.public <P> P joinAndEnter(Supplier<P> logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter(Runnable, HighResolutionTime)
except that
the executed method is called get
and an object
is returned.InterruptedException
logic
- The object whose get method will be executed.public boolean joinAndEnter(BooleanSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter(Runnable, HighResolutionTime)
except that
the executed method is called get
and a boolean
is returned.InterruptedException
logic
- The object whose get method will be executed.public int joinAndEnter(IntSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter(Runnable, HighResolutionTime)
except that
the executed method is called get
and an int
is returned.InterruptedException
logic
- The object whose get method will be executed.public long joinAndEnter(LongSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter(Runnable, HighResolutionTime)
except that
the executed method is called get
and a long
is returned.InterruptedException
logic
- The object whose get method will be executed.public double joinAndEnter(DoubleSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnter(Runnable, HighResolutionTime)
except that
the executed method is called get
and a double
is returned.InterruptedException
logic
- The object whose get method will be executed.public <P> P joinAndEnterInternal(Supplier<P> logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get
and an object
is returned.InterruptedException
logic
- The object whose get method will be executed.public boolean joinAndEnterInternal(BooleanSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get
and a
boolean
is returned.InterruptedException
logic
- The object whose get method will be executed.public int joinAndEnterInternal(IntSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get
and an int
is returned.InterruptedException
logic
- The object whose get method will be executed.public long joinAndEnterInternal(LongSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get
and a long
is returned.InterruptedException
logic
- The object whose get method will be executed.public double joinAndEnterInternal(DoubleSupplier logic, HighResolutionTime<?> time) throws InterruptedException
joinAndEnterInternal(Runnable, HighResolutionTime)
except that the executed method is called get
and a double
is returned.InterruptedException
logic
- The object whose get method will be executed.public void executeInArea(Runnable logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.public <T> T executeInArea(Supplier<T> logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.get()
method.public int executeInArea(IntSupplier logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.getAsInt()
method.public long executeInArea(LongSupplier logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.getAsLong()
method.public double executeInArea(DoubleSupplier logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.getAsDouble()
method.public boolean executeInArea(BooleanSupplier logic) throws InaccessibleAreaException
logic
parameter using
this memory area as the current allocation context. This method
behaves as if it moves the allocation context down the scope stack
to the occurrence of this
.executeInArea
in class MemoryArea
IllegalTaskStateException
- when the execution context
is not an instance of Schedulable
.InaccessibleAreaException
- when the memory area is not in
the schedulable's scope stack.StaticIllegalArgumentException
- when the execution context is an
instance of Schedulable
schedulable and
logic
is null
.logic
- The runnable object whose run()
method should
be executed.getAsBoolean()
method.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2022 aicas GmbH. All Rights Reserved.