|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.realtime.RealtimeObject
public abstract class RealtimeObject
This class provides a default implementation of the Realtime
interface.
Instances of this class should be created using the inner
Factory class. For example:
public class Foo extends RealtimeObject {
static final Factory<Foo> FACTORY = new Factory<Foo>() {
protected Foo create() {
return new Foo();
}
};
protected Foo() {} // Default constructor for sub-classes.
public static Foo newInstance() { // Static factory method.
return FACTORY.object();
}
// Optional.
public boolean move(ObjectSpace os) { ... }
}
Instances of this class can be immutable. Instances allocated in a
pool context must be exported
(e.g. return value) or preserved (e.g. static instance)
if referenced after exiting the pool context.
| Nested Class Summary | |
|---|---|
static class |
RealtimeObject.Factory<T extends RealtimeObject>
This abstract class represents the factory responsible for the creation of RealtimeObject instances. |
| Nested classes/interfaces inherited from interface javolution.realtime.Realtime |
|---|
Realtime.ObjectSpace |
| Constructor Summary | |
|---|---|
protected |
RealtimeObject()
Default constructor. |
| Method Summary | ||
|---|---|---|
|
export()
Exports this object and its local real-time associations out of the current pool context (equivalent to ). |
|
boolean |
move(Realtime.ObjectSpace os)
Moves this real-time object to the specified object space. |
|
|
moveHeap()
Moves this object and its real-time associations to the heap (equivalent to ). |
|
|
preserve()
Prevents this object and its real-time associations to be recycled (equivalent to ). |
|
protected void |
recycle()
Recycles this object and its internals only. |
|
java.lang.String |
toString()
Returns the String representation of this object. |
|
Text |
toText()
Returns the default textual representation of this realtime object. |
|
|
unpreserve()
Allows this object and its real-time associations to be recycled if not preserved any more (equivalent to ). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected RealtimeObject()
| Method Detail |
|---|
public final java.lang.String toString()
String representation of this object.
This method is final to ensure consistency with toText()
(which is the method to override).
toString in class java.lang.ObjecttoText().stringValue()public Text toText()
toText in interface Realtimepublic final <T> T export()
move
(ObjectSpace.OUTER)).
This method affects only local objects allocated on the stack
and has no effect on heap objects or objects allocated outside of
the current pool context.
Note: To avoid pool depletion when exporting to outer pool, the object is actually exchanged with an outer pool object.
thispublic final <T> T moveHeap()
move(ObjectSpace.HEAP)).
thispublic final <T> T preserve()
move(ObjectSpace.HOLD)).
This method increments this object preserved counter.
thisunpreserve()public final <T> T unpreserve()
move(ObjectSpace.STACK)).
This method decrements this object preserved counter.
thispreserve()public boolean move(Realtime.ObjectSpace os)
Realtime
move in interface Realtimeos - the object space to move this real-time object to.
true if the move has to be propagated to
external real-time references; false otherwise.protected void recycle()
move operations, recycling is limited to this
object and its internals and has no effect on external
variable members (real-time or not).
|
J avolution v3.7 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||