|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuka.patch.PatchAdapter
uka.patch.PatchAdapterImpl
Default implementation of the PatchAdapter interface.
| Nested Class Summary | |
(package private) class |
PatchAdapterImpl.Output
|
| Field Summary | |
private java.lang.Object[] |
ARGS_this
|
(package private) SimpleObjectSpace |
copies
|
(package private) static java.util.HashMap |
descriptors
|
(package private) ReferenceFilter |
filter
|
(package private) SharedObjectSpace |
objects
|
(package private) java.lang.Object |
root
|
private static java.lang.Class[] |
TYPES_PatchAdapter
|
| Constructor Summary | |
PatchAdapterImpl(java.lang.Object root)
|
|
PatchAdapterImpl(SharedObjectSpace objects,
java.lang.Object root,
ReferenceFilter filter)
Create a patch adapter with a custom object space. |
|
| Method Summary | |
void |
appendTo(ToString s)
This method should append the contents of each instance variable of the current
object to the given ToString object. |
void |
applyPatch(PatchReader reader)
Applies a patch read from the passed input stream to the own monitored object. |
void |
checkConsistency(java.util.logging.Logger log)
|
void |
createPatch(AbstractPatchWriter writer)
API: Create a patch and write it to the given output stream. |
AbstractPatchWriter |
createPatch(MarshalStream marshal)
Convenience method. |
PatchReader |
createPatchReader(UnmarshalStream unmarshal)
|
PatchReader |
createPatchReader(UnmarshalStream unmarshal,
int fromRank)
API: Read a patch from the given input stream and apply it to the root object associated with this patch adapter. |
private void |
doApplyPatch(PatchReader reader,
java.lang.Object orig,
java.lang.Object copy)
|
private static java.lang.Object |
doClone(java.lang.Object orig)
|
private static void |
doDescend(java.lang.Object orig,
ReferenceConsumer consumer)
|
private static void |
doFilterReferences(java.lang.Object orig,
ReferenceFilter filter)
|
private boolean |
enterCopy(int id)
|
ObjectSpace |
getObjectSpace()
Returns the object space of original objects. |
private static PatchDescriptor |
getPatchDescriptor(java.lang.Class origClass)
|
java.lang.Object |
getRoot()
|
private void |
readObject(java.io.ObjectInputStream in)
Make sure transient fields are restored after unmarshaling. |
private void |
restore()
|
private void |
restoreAfterUnmarshal()
Rebuilds transient fields after unmarshaling this object from a stream. |
void |
updateAfterApplyPatch()
Create backup copies of new or newly shared objects and remove backup copies of dead or no longer shared objects. |
void |
updateAfterCreatePatch()
|
void |
updateAfterDistributionUpdate()
Remove backup copies of dead or no longer shared objects. |
| Methods inherited from class uka.patch.PatchAdapter |
newInstance |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
java.lang.Object root
static final java.util.HashMap descriptors
SharedObjectSpace objects
ReferenceFilter filter
transient SimpleObjectSpace copies
private static java.lang.Class[] TYPES_PatchAdapter
private java.lang.Object[] ARGS_this
| Constructor Detail |
public PatchAdapterImpl(java.lang.Object root)
throws java.io.IOException
public PatchAdapterImpl(SharedObjectSpace objects,
java.lang.Object root,
ReferenceFilter filter)
throws java.io.IOException
| Method Detail |
public void checkConsistency(java.util.logging.Logger log)
private void restoreAfterUnmarshal()
throws java.lang.ClassNotFoundException,
java.io.IOException
Rebuilds transient fields after unmarshaling this object
from a stream. When marshaling a PatchAdapter, the
backup copies are not marshaled along with their
originals. This is done to save bandwidth and to avoid
conflicts with backup copies of objects implementing the
replicated interface (e.g. the backup copy of the patchable
root object). When replicated objects are marshaled during a
remote method invocation, they are replaced with their
corresponding stubs and resolved at the remote side to the
local replica. This is only possible for regular replicated
objects that are exported and completely initialized. Backup
copies of replicated objects are not exported. Therefore, it is
better not to marshal backup copies at all.
This method is called automatically during the unmarshaling
process of UnmarshalStream, or called
explicitly after unmarshaling through an ObjectInputStream via the readObject(java.io.ObjectInputStream) method.
java.lang.ClassNotFoundException
java.io.IOException
private void restore()
throws java.io.IOException
java.io.IOException
private static java.lang.Object doClone(java.lang.Object orig)
throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionrestoreAfterUnmarshal()public java.lang.Object getRoot()
getRoot in class PatchAdapterPatchAdapter.newInstance(Object).public ObjectSpace getObjectSpace()
PatchAdapter
getObjectSpace in class PatchAdapterAbstractPatchWriter
private boolean enterCopy(int id)
throws java.io.IOException
java.io.IOException
private static PatchDescriptor getPatchDescriptor(java.lang.Class origClass)
throws java.io.IOException
java.io.IOException
public AbstractPatchWriter createPatch(MarshalStream marshal)
throws java.io.IOException
createPatch in class PatchAdaptermarshal - the stream, the patch is written to.
java.io.IOExceptioncreatePatch(MarshalStream)
public void createPatch(AbstractPatchWriter writer)
throws java.io.IOException
createPatch in class PatchAdapterjava.io.IOException
public PatchReader createPatchReader(UnmarshalStream unmarshal)
throws java.io.IOException,
java.lang.ClassNotFoundException
createPatchReader in class PatchAdapterjava.io.IOException
java.lang.ClassNotFoundException
public PatchReader createPatchReader(UnmarshalStream unmarshal,
int fromRank)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void applyPatch(PatchReader reader)
throws java.io.IOException,
java.lang.ClassNotFoundException
PatchAdapterPatchAdapter.createPatch(MarshalStream).
applyPatch in class PatchAdapterjava.io.IOException
java.lang.ClassNotFoundException
private void doApplyPatch(PatchReader reader,
java.lang.Object orig,
java.lang.Object copy)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void updateAfterCreatePatch()
throws java.io.IOException
updateAfterCreatePatch in class PatchAdapterjava.io.IOException
public void updateAfterDistributionUpdate()
throws java.io.IOException
Remove backup copies of dead or no longer shared objects. This method must be called after creating a patch and after writing the corresponding distribution update (if a partitioned object space is used).
Note: This is somewhat asymmetric to updateAfterApplyPatch(), because backup copy creation must be
done immediately after creating the patch and before
sending the distribution update. See the lengthy comment at the
end of PatchAdapterImpl.Output.createCompletePatch() and the log entry of
changeset:2528.
updateAfterDistributionUpdate in class PatchAdapterjava.io.IOException
private static void doFilterReferences(java.lang.Object orig,
ReferenceFilter filter)
throws java.io.IOException
java.io.IOException
private static void doDescend(java.lang.Object orig,
ReferenceConsumer consumer)
throws java.io.IOException
java.io.IOException
public void updateAfterApplyPatch()
throws java.io.IOException
updateAfterApplyPatch in class PatchAdapterjava.io.IOExceptionapplyPatch(uka.patch.PatchReader),
PartitionedObjectSpace.readDistributionUpdate(uka.patch.PatchReader)public void appendTo(ToString s)
Printableappend the contents of each instance variable of the current
object to the given ToString object. The appended data
should be labeled with the name of the corresponding instance
variable.
appendTo in interface PrintableToString,
ToString.append(String, Object),
ToString.append(String, boolean),
ToString.append(String, byte),
ToString.append(String, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||