Groovy Documentation

gpars.serial
Class WithSerialId

java.lang.Object
  gpars.serial.WithSerialId
All Implemented Interfaces:
Serializable

class WithSerialId

Base class for objects which can be exposed to remote nodes via serialization.

Main concept is following: - each object belongs to some LocalHost - every object can be exposed to any groovyx.gpars.remote.RemoteHost - on remote host object is represented by proxy usually called remote object - for serialization we use writeReplace method, which creates special handle to be serialized instead of the object - for deserialization handle's readResolve method creates remote object (proxy)

See Serializable for detailed description how methods writeReplace & readResolve works.

It is very important to know that (de)serialization never happens by itself but always happens in context of groovyx.gpars.remote.RemoteHost and (

link:
LocalHost}. Such context is used for right resolution/transformation of objects
author:
Alex Tkachman


Field Summary
SerialHandle serialHandle

See SerialHandle class for details

 
Constructor Summary
WithSerialId()

 
Method Summary
protected RemoteHandle createRemoteHandle(SerialHandle handle, SerialContext host)

SerialHandle getOrCreateSerialHandle()

Gets serial handle for the object If needed new handle created and serialization host subscribed for the object handle

Class getRemoteClass()

Class of remote object to be created

protected Object writeReplace()

Replace object by handle for serialization

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

serialHandle

SerialHandle serialHandle
See SerialHandle class for details


 
Constructor Detail

WithSerialId

WithSerialId()


 
Method Detail

createRemoteHandle

protected RemoteHandle createRemoteHandle(SerialHandle handle, SerialContext host)


getOrCreateSerialHandle

public final SerialHandle getOrCreateSerialHandle()
Gets serial handle for the object If needed new handle created and serialization host subscribed for the object handle
return:
serial handle for the object


getRemoteClass

public Class getRemoteClass()
Class of remote object to be created
return:
Throws UnsupportedOperationException


writeReplace

@SuppressWarnings({"UnusedDeclaration"})
protected final Object writeReplace()
Replace object by handle for serialization
return:
handle to serialize
throws:
ObjectStreamException If the object cannot be serialized


 

Groovy Documentation