uka.patch
Class MultiplexPatchWriter

java.lang.Object
  extended byuka.patch.AbstractPatchWriter
      extended byuka.patch.MultiplexPatchWriter
All Implemented Interfaces:
Constants

public class MultiplexPatchWriter
extends AbstractPatchWriter

Multiplexes a patch created with calls to the interface of AbstractPatchWriter to several MarshalStreams. With an installed distributor, the generated patches can be customized for the recipient. If not all objects in the source object graph are locally available at all target graphs (the graphs the generated patches will be applied to), these objects can be excluded from the patch.


Field Summary
(package private)  int activeCnt
          Number of initialized fields in activeGroup.
(package private)  PatchWriter[] activeGroup
          Subset of PatchWriters in group.
(package private)  ReferenceFilter filter
           
(package private)  PatchWriter[] group
          Group of PatchWriters for transmitting patches to other ranks.
(package private)  boolean[] hasStream
          Remembers the initialization status of PatchWriters in group.
(package private)  int myRank
           
(package private)  PartitionedObjectSpace objects
           
(package private)  int size
           
 
Fields inherited from class uka.patch.AbstractPatchWriter
currentID, modified, unmodifiedCnt
 
Fields inherited from interface uka.patch.Constants
CODE_BOOLEAN, CODE_DOUBLE, CODE_END_OF_PATCH, CODE_FLOAT, CODE_INT16, CODE_INT32, CODE_INT64, CODE_INT8, CODE_NOT_MODIFIED, CODE_NULL, CODE_PATCH_HEADER, CODE_REFERENCE, MAX_DISTRIBUTION_RECORDS
 
Constructor Summary
MultiplexPatchWriter(PartitionedObjectSpace objects, ReferenceFilter filter, int myRank)
           
 
Method Summary
 void beginPatch()
           
 void beginPatchRecord(int id)
           
 void clear()
           
protected  void encode(boolean value)
           
protected  void encode(byte value)
           
protected  void encode(char value)
           
protected  void encode(double value)
           
protected  void encode(float value)
           
protected  void encode(int value)
           
protected  void encode(long value)
           
protected  void encode(short value)
           
protected  void encodeBeginPatch()
           
protected  void encodeEndPatch()
           
protected  void encodeNull()
           
protected  void encodePatchHeader(int id)
           
protected  java.lang.Object encodeReference(java.lang.Object ref)
           
protected  void encodeUnmodifiedCnt(int cnt)
           
 void endPatch()
           
 void flush()
           
 PatchWriter[] getGroup()
           
 MarshalStream getOutput(int rank)
          Experimental low-level API: Patch creation for the expert.
 void init(java.lang.Object root)
           
 void rawWriteInt(int value)
           
 void registerStreams(MarshalStream[] streams)
           
 void unregisterStreams()
           
 
Methods inherited from class uka.patch.AbstractPatchWriter
endPatchRecord, flushUnmodified, write, write, write, write, write, write, write, write, writeNotModified, writeNull, writeReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

int size

myRank

int myRank

objects

PartitionedObjectSpace objects

filter

ReferenceFilter filter

group

PatchWriter[] group
Group of PatchWriters for transmitting patches to other ranks. This array is initialized with PatchWriters upon construction, but the writer connections are plugged in dynamically in calls to registerStreams(uka.transport.MarshalStream[]).


hasStream

boolean[] hasStream
Remembers the initialization status of PatchWriters in group. If hasStream[n] is true, the corresponding PatchWriter {#link #group}[n] is initialized with a stream for transmission.


activeCnt

int activeCnt
Number of initialized fields in activeGroup.


activeGroup

PatchWriter[] activeGroup
Subset of PatchWriters in group. The active group is configured for each patch record to ensure it is only sent to those ranks having a copy of the corresponding object.

See Also:
beginPatchRecord(int)
Constructor Detail

MultiplexPatchWriter

public MultiplexPatchWriter(PartitionedObjectSpace objects,
                            ReferenceFilter filter,
                            int myRank)
                     throws java.io.IOException
Method Detail

getGroup

public PatchWriter[] getGroup()

registerStreams

public void registerStreams(MarshalStream[] streams)

unregisterStreams

public void unregisterStreams()

init

public void init(java.lang.Object root)
          throws java.io.IOException
Specified by:
init in class AbstractPatchWriter
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

clear

public void clear()
           throws java.io.IOException
Specified by:
clear in class AbstractPatchWriter
Throws:
java.io.IOException

beginPatch

public void beginPatch()
                throws java.io.IOException
Specified by:
beginPatch in class AbstractPatchWriter
Throws:
java.io.IOException

endPatch

public void endPatch()
              throws java.io.IOException
Specified by:
endPatch in class AbstractPatchWriter
Throws:
java.io.IOException

beginPatchRecord

public void beginPatchRecord(int id)
                      throws java.io.IOException
Overrides:
beginPatchRecord in class AbstractPatchWriter
Throws:
java.io.IOException

encodeBeginPatch

protected void encodeBeginPatch()
                         throws java.io.IOException
Specified by:
encodeBeginPatch in class AbstractPatchWriter
Throws:
java.io.IOException

encodeEndPatch

protected void encodeEndPatch()
                       throws java.io.IOException
Specified by:
encodeEndPatch in class AbstractPatchWriter
Throws:
java.io.IOException

encodePatchHeader

protected void encodePatchHeader(int id)
                          throws java.io.IOException
Specified by:
encodePatchHeader in class AbstractPatchWriter
Throws:
java.io.IOException

encodeUnmodifiedCnt

protected void encodeUnmodifiedCnt(int cnt)
                            throws java.io.IOException
Specified by:
encodeUnmodifiedCnt in class AbstractPatchWriter
Throws:
java.io.IOException

encodeNull

protected void encodeNull()
                   throws java.io.IOException
Specified by:
encodeNull in class AbstractPatchWriter
Throws:
java.io.IOException

encodeReference

protected java.lang.Object encodeReference(java.lang.Object ref)
                                    throws java.io.IOException
Specified by:
encodeReference in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(boolean value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(byte value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(char value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(short value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(int value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(float value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(long value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

encode

protected void encode(double value)
               throws java.io.IOException
Specified by:
encode in class AbstractPatchWriter
Throws:
java.io.IOException

rawWriteInt

public void rawWriteInt(int value)
                 throws java.io.IOException
Specified by:
rawWriteInt in class AbstractPatchWriter
Throws:
java.io.IOException

getOutput

public MarshalStream getOutput(int rank)
                        throws java.io.IOException
Experimental low-level API: Patch creation for the expert.

Specified by:
getOutput in class AbstractPatchWriter
Throws:
java.io.IOException