|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.realtime.MemoryArea
javax.realtime.ScopedMemory
javax.realtime.PrivateScopedMemory
The class PrivateScopedMemory refines the
ScopedMemory by restricting the number of active
thread within a memory to one.
| Field Summary | |
protected RealtimeThread |
owner
|
| Fields inherited from class javax.realtime.ScopedMemory |
joinSynchronizer |
| Fields inherited from class javax.realtime.MemoryArea |
logic, parent, sizeInBytes |
| Constructor Summary | |
PrivateScopedMemory(long size)
Creates a new PrivateScopedMemory instance. |
|
PrivateScopedMemory(long size,
Runnable logic)
Creates a new PrivateScopedMemory instance. |
|
PrivateScopedMemory(SizeEstimator size)
Creates a new PrivateScopedMemory instance. |
|
PrivateScopedMemory(SizeEstimator size,
Runnable logic)
Creates a new PrivateScopedMemory instance. |
|
| Method Summary | |
void |
enter(Runnable logic)
Associate this memory area to the current real-time thread for the duration of the execution of the run() method
of the given Runnable. |
void |
join()
Wait until the reference count of this PrivateScopedMemory goes down to zero. |
void |
join(HighResolutionTime time)
Wait at most until the time designated by the time
parameter for the reference count of this
PrivateScopedMemory to go down to zero. |
void |
joinAndEnter()
Combine join();enter(); such that no
enter from another thread can intervene between
the two method invocations. |
void |
joinAndEnter(HighResolutionTime time)
Combine join(time);enter(); such that no
enter from another thread can intervene between
the two method invocations. |
void |
joinAndEnter(Runnable logic)
Combine join();enter(logic); such that no
enter from another thread can intervene between
the two method invocations. |
void |
joinAndEnter(Runnable logic,
HighResolutionTime time)
Combine join(time);enter(logic); such that no
enter from another thread can intervene between
the two method invocations. |
protected void |
resetOwner()
|
protected void |
setOwner()
|
String |
toString()
Returns a user-friendly representation of this PrivateScopedMemory. |
| Methods inherited from class javax.realtime.ScopedMemory |
getMaximumSize, getPortal, getReferenceCount, setPortal |
| Methods inherited from class javax.realtime.MemoryArea |
enter, executeInArea, finalize, fini, getMemoryArea, guardedRun, init, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance, size |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected RealtimeThread owner
| Constructor Detail |
public PrivateScopedMemory(long size)
PrivateScopedMemory instance.
size - The size of MemoryArea to allocate, in
bytes. If size is less than or equal to zero an
IllegalArgumentException is thrown.
public PrivateScopedMemory(long size,
Runnable logic)
PrivateScopedMemory instance.
size - The size of MemoryArea to allocate, in
bytes. If size is less than or equal to zero an
IllegalArgumentException is thrown.logic - -The java.lang.Runnable whose run() method is
invoked when any of the variations of enter() which do not take
a java.lang.Runnable is called.public PrivateScopedMemory(SizeEstimator size)
PrivateScopedMemory instance.
size - A SizeEstimator object which indicates the
amount of memory required by this MemoryArea.
public PrivateScopedMemory(SizeEstimator size,
Runnable logic)
PrivateScopedMemory instance.
size - The size of MemoryArea to
allocate, in bytes.logic - The run() method of this object will be called
whenever enter() called.| Method Detail |
public void join()
throws InterruptedException
PrivateScopedMemory goes down to zero.
join in class ScopedMemoryInterruptedException - If another thread interrupts
this thread while it is waiting.
public void join(HighResolutionTime time)
throws InterruptedException
time
parameter for the reference count of this
PrivateScopedMemory to go down to zero.
join in class ScopedMemorytime - If this time is an absolute time, the wait is
bounded by that point in time. If 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.
InterruptedException - if another thread interrupts
this thread while it is waiting.
public void joinAndEnter()
throws InterruptedException,
ScopedCycleException
join();enter(); such that no
enter from another thread can intervene between
the two method invocations. The resulting method will wait for
the reference count on this PrivateScopedMemory to reach
zero, then enter the PrivateScopedMemory and execute the
run method from logic passed in the
constructor. If no Runnable was passed, the method returns
immediately.
joinAndEnter in class ScopedMemoryInterruptedException - If another thread interrupts
this thread while it is waiting.
ScopedCycleException - If entering this
PrivateScopedMemory would violate the single parent rule.
public void joinAndEnter(HighResolutionTime time)
throws InterruptedException,
ScopedCycleException
join(time);enter(); such that no
enter from another thread can intervene between
the two method invocations. The resulting method will wait for
the reference count on this PrivateScopedMemory to reach
zero, or for the current time to reach the designated time,
then enter the PrivateScopedMemory and execute the
run method from Runnable object
passed at constructin time. If no Runnable was
passed then this method returns immediately.
joinAndEnter in class ScopedMemorytime - The time that bounds the wait.
InterruptedException - if another thread interrupts
this thread while it is waiting.
ScopedCycleException - If entering this
PrivateScopedMemory would violate the single parent rule.
public void joinAndEnter(Runnable logic)
throws InterruptedException,
ScopedCycleException
join();enter(logic); such that no
enter from another thread can intervene between
the two method invocations. The resulting method will wait for
the reference count on this PrivateScopedMemory to reach
zero, then enter the PrivateScopedMemory and execute the
run method from logic
joinAndEnter in class ScopedMemorylogic - The Runnable object which contains the
code to execute.
InterruptedException - If another thread interrupts
this thread while it is waiting.
ScopedCycleException - If entering this
PrivateScopedMemory would violate the single parent rule.
public void joinAndEnter(Runnable logic,
HighResolutionTime time)
throws InterruptedException,
ScopedCycleException
join(time);enter(logic); such that no
enter from another thread can intervene between
the two method invocations. The resulting method will wait for
the reference count on this PrivateScopedMemory to reach
zero, or for the current time to reach the designated time,
then enter the PrivateScopedMemory and execute the
run method from logic.
joinAndEnter in class ScopedMemorylogic - The Runnable object which contains the
code to execute.time - The time that bounds the wait.
InterruptedException - if another thread interrupts
this thread while it is waiting.
ScopedCycleException - If entering this
PrivateScopedMemory would violate the single parent rule.public String toString()
PrivateScopedMemory.
toString in class ScopedMemory
public void enter(Runnable logic)
throws ScopedCycleException
run() method
of the given Runnable. During this bound
period of execution, all objects are allocated from the memory
area until another one takes effect, or the
enter() method is exited. A runtime exception is
thrown if this method is called from thread other than a
RealtimeThread or
NoHeapRealtimeThread.
enter in class ScopedMemorylogic - The Runnable object whose run() method should be
invoked.
ScopedCycleException - If entering this PrivateScopedMemory
would violate the single parent rule.protected void setOwner()
protected void resetOwner()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||