|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dautelle.realtime.RealtimeObject
This class provides a default implementation of the Realtime
interface.
Instances of this class should be created using a RealtimeObject.Factory
.
For example:
public class Foo extends RealtimeObject { static final Factory FACTORY = new Factory() { public Object create() { return new Foo(); } }; protected Foo() {} // Default constructor for sub-classes. public static Foo newInstance() { // Static factory method. return (Foo) FACTORY.object(); } public Object export() { // Optional, only if new real-time members. ... // Exports new real-time variable members. return super.export(); } public Object toHeap() { // Optional, only if new real-time members. ... // Moves to heap new real-time variable members. return super.toHeap(); } }
Instances of this class can be immutable. Instances allocated in a
pool context must be exported
if referenced
after exiting the pool context.
Nested Class Summary | |
protected static class |
RealtimeObject.Factory
This abstract class represents the factory responsible for the creation of RealtimeObject instances. |
Constructor Summary | |
protected |
RealtimeObject()
Default constructor. |
Method Summary | |
protected java.lang.Object |
clone()
Overrides the clone method to ensure that the copy references the heap pool. |
java.lang.Object |
export()
Exports this object out of the current pool context. |
boolean |
isLocalObject()
Indicates if this object is an object local to the current pool context. |
boolean |
isPoolObject()
Indicates if this object belongs to a pool (stack allocated object). |
protected void |
recycle()
Recycles this object. |
java.lang.Object |
toHeap()
Moves this object to the heap. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected RealtimeObject()
Method Detail |
public final boolean isLocalObject()
Note: Due to the "export" rule, non-local objects cannot refer to local object.
true
if this object belongs to the current
pool context; false
otherwise.public final boolean isPoolObject()
Note: Due to the "export" rule, heap objects cannot refer to pool object.
true
if this object belongs to a pool;
false
if this object belongs to the heap.protected void recycle()
local objects
and has no effect on heap objects or objects allocated outside of
the current pool context. Recycling is limited to this object and
its internal and has no effect on any shared member.
public java.lang.Object export()
Realtime
Realtime
members are exported as well (recursion).
This method affects only objects belonging to the current pool context.
To avoid pool depletion, a "free" object from the outer pool
is moved to replace the object being exported.
export
in interface Realtime
this
public java.lang.Object toHeap()
Realtime
Realtime
members are moved to the heap as well (recursion).
This method affects only objects belonging to a pool context
(current or not).
toHeap
in interface Realtime
this
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
|
JADE v6.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |