|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorc.trace.handles.Handle<E>
public abstract class Handle<E>
Works with HandleInputStream
and HandleOutputStream
to
explicitly manage the lifetime of serialized pointers. Handles are used
in place of non-null pointers. There are four types of handles:
FirstHandle
RepeatHandle
LastHandle
OnlyHandle
It is up to the programmer to choose the appropriate handle type according to the number of references and the order in which values are serialized. In other words, you're performing your own memory management.
WARNING: DO NOT use this with a regular ObjectOutput
or
ObjectInput
. It only works with subtypes of
HandleOutputStream
and HandleInputStream
.
FIXME: Handles do not deserialize circular references correctly. This should be straightforward to fix (if a handle detects that it needs to point to a value which is currently being read, it should register with the HandleInputStream to be updated once the value is read), but so far I haven't needed it.
HandleOutputStream
,
Serialized FormField Summary | |
---|---|
protected E |
value
|
Constructor Summary | |
---|---|
Handle()
Required by Externalizable , but should never be called
when not deserializing. |
|
Handle(E value)
Create a handle to a value, which must be non-null. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object that)
Handles are equal if the values they point to are equal. |
E |
get()
Get the value pointed to by this handle. |
int |
hashCode()
Handles which point to the same value should use the same hash code. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.io.Externalizable |
---|
readExternal, writeExternal |
Field Detail |
---|
protected E value
Constructor Detail |
---|
public Handle()
Externalizable
, but should never be called
when not deserializing.
public Handle(E value)
Method Detail |
---|
public final E get()
public final java.lang.String toString()
toString
in class java.lang.Object
public final boolean equals(java.lang.Object that)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |