org.jboss.ejb.plugins
public class: SessionObjectOutputStream [javadoc |
source]
java.lang.Object
java.io.OutputStream
java.io.ObjectOutputStream
org.jboss.ejb.plugins.SessionObjectOutputStream
All Implemented Interfaces:
ObjectStreamConstants, ObjectOutput, Closeable, Flushable
The SessionObjectOutputStream is used to serialize stateful session beans
when they are passivated
| Method from org.jboss.ejb.plugins.SessionObjectOutputStream Summary: |
|---|
|
replaceObject |
| Methods from java.io.ObjectOutputStream: |
|---|
|
close, defaultWriteObject, flush, putFields, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeShort, writeUTF, writeUnshared |
| Method from org.jboss.ejb.plugins.SessionObjectOutputStream Detail: |
protected Object replaceObject(Object obj) throws IOException {
Object replacement = obj;
// section 6.4.1 of the ejb1.1 specification states what must be taken care of
// ejb reference (remote interface) : store handle
if (obj instanceof EJBObject)
replacement = ((EJBObject)obj).getHandle();
// ejb reference (home interface) : store handle
else if (obj instanceof EJBHome)
replacement = ((EJBHome)obj).getHomeHandle();
// session context : store a typed dummy object
else if (obj instanceof SessionContext)
replacement = new StatefulSessionBeanField(StatefulSessionBeanField.SESSION_CONTEXT);
// naming context : the jnp implementation is serializable, do nothing
// user transaction : store a typed dummy object
else if (obj instanceof UserTransaction)
replacement = new StatefulSessionBeanField(StatefulSessionBeanField.USER_TRANSACTION);
else if( obj instanceof Handle )
replacement = new HandleWrapper((Handle)obj);
else if( (obj instanceof Remote) && !(obj instanceof RemoteStub) )
{
Remote remote = (Remote) obj;
try
{
replacement = RemoteObject.toStub(remote);
}
catch(IOException ignore)
{
// Let the Serialization layer try with original object
}
}
return replacement;
}
|