uka.karmi.stream
Class MarshalOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ObjectOutputStream
          extended byuka.karmi.stream.MarshalOutputStream
All Implemented Interfaces:
java.io.DataOutput, MarshalOutput, java.io.ObjectOutput, java.io.ObjectStreamConstants, PatchOutputStream
Direct Known Subclasses:
GMTechnology.GMOutput, PSPTechnology.PSPOutput

public class MarshalOutputStream
extends java.io.ObjectOutputStream
implements MarshalOutput, PatchOutputStream

A marshal stream for connections between two socket technology objects. Remote objects must be replaced during serialization. When a MarshalOutputStream is used to transport arguments or results in a remote method call, getDGCMarshalContext returns the DGCMarshalContext that is used during the serialization.

Author:
Bernhard Haumacher

Nested Class Summary
 
Nested classes inherited from class java.io.ObjectOutputStream
java.io.ObjectOutputStream.PutField
 
Field Summary
(package private)  DGCMarshalContext marshalContext
          Interface to the output part of the distributed garbage collector.
(package private)  java.lang.Object migratingServer
           
(package private)  Technology technology
          The technology this stream belongs to.
(package private)  java.lang.Object updatedReplica
           
 
Fields inherited from class java.io.ObjectOutputStream
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
MarshalOutputStream(java.io.OutputStream out, Technology technology)
           
 
Method Summary
 void finishMigration()
           
 void finishUpdate()
           
 DGCMarshalContext getDGCMarshalContext()
          Returns the DGCMarshalContext for this serialization
 Technology getTechnology()
          With getTechnology() a remote reference that is about to be marshaled can obtain a reference to the technology.
protected  java.lang.Object replaceObject(java.lang.Object obj)
          Replaces objects during serialization.
 void startMigration(java.lang.Object obj)
          Marks the object obj to be migrated.
 void startUpdate(java.lang.Object obj)
           
protected  void writeStreamHeader()
          no stream header.
 
Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, close, defaultWriteObject, drain, enableReplaceObject, flush, putFields, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeUnshared, writeUTF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

technology

Technology technology
The technology this stream belongs to.


marshalContext

DGCMarshalContext marshalContext
Interface to the output part of the distributed garbage collector.


migratingServer

java.lang.Object migratingServer

updatedReplica

java.lang.Object updatedReplica
Constructor Detail

MarshalOutputStream

public MarshalOutputStream(java.io.OutputStream out,
                           Technology technology)
                    throws java.io.IOException,
                           java.io.StreamCorruptedException
Method Detail

writeStreamHeader

protected void writeStreamHeader()
                          throws java.io.IOException
no stream header.

Throws:
java.io.IOException

getTechnology

public Technology getTechnology()
Description copied from interface: MarshalOutput
With getTechnology() a remote reference that is about to be marshaled can obtain a reference to the technology. The returned technology is that one that is currently communicating the object. Returns the technology this object belongs to.

Specified by:
getTechnology in interface MarshalOutput
See Also:
MarshalOutput.getTechnology()

getDGCMarshalContext

public DGCMarshalContext getDGCMarshalContext()
Description copied from interface: MarshalOutput
Returns the DGCMarshalContext for this serialization

Specified by:
getDGCMarshalContext in interface MarshalOutput
See Also:
MarshalOutput.getDGCMarshalContext()

startMigration

public void startMigration(java.lang.Object obj)
Description copied from interface: MarshalOutput
Marks the object obj to be migrated. References to remote objects are normally replaced by their stubs, when they are passed as arguments in a remote call. Calling this method before marshaling the parameters of a call causes the remote server obj to be migrated during this remote call.

Specified by:
startMigration in interface MarshalOutput

finishMigration

public void finishMigration()
Specified by:
finishMigration in interface MarshalOutput
See Also:
MarshalOutput.startMigration(Object)

startUpdate

public void startUpdate(java.lang.Object obj)
Specified by:
startUpdate in interface PatchOutputStream

finishUpdate

public void finishUpdate()
Specified by:
finishUpdate in interface PatchOutputStream

replaceObject

protected java.lang.Object replaceObject(java.lang.Object obj)
                                  throws java.io.IOException
Replaces objects during serialization. Checks whether migration is currently enabled and excludes the migrating server implementation object from the replacement process.

Throws:
java.io.IOException
See Also:
ExportPoint.replaceObject(Object)