com.ibm.websphere.servlet.session
Class UserTransactionWrapper

java.lang.Object
  |
  +--com.ibm.websphere.servlet.session.UserTransactionWrapper
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

Deprecated. Store UserTransaction object directly into httpsession

public class UserTransactionWrapper
extends java.lang.Object
implements java.io.Externalizable

Section 6.6 of the J2EE specification lists of set of object types which a distributable application can placed in a javax.servlet.http.HttpSession object. It also indicates that these objects must be accurately recreated when they move from one VM to another as part of the HttpSession moving. One of these object types is javax.transaction.UserTransaction. However, there are no attributes retrievable from UserTransaction which either implement java.io.Serializable and can be used to reconstruct the UserTransaction. WebSphere offers 2 choices. First, you can simply place the UserTransaction in the HttpSession. While this will be allowed, the UserTransaction object will not be moved outside the VM (for example, to the database when persistent sessions are configured in WebSphere). Second, you can encapsulate the UserTransaction along with the javax.naming.InitialContext object that was used to obtain the transaction in the following wrapper object, UserTransactionWrapper. WebSphere will move the necessary elements of the InitialContext outside the VM, and then use those elements to reconstruct first the InitialContext and then the UserTransaction from the InitialContext. One should also note that per section 4.2.1 of J2EE, all transactions must be started and completed on the thread which the servlet/jsp sevice() method was invoked. This means all transactions are assumed complete (either committed rolled back) if and when a UserTransactionWrapper is transfered outside a VM.

See Also:
Serialized Form

Constructor Summary
UserTransactionWrapper()
          Deprecated. This is for Java Serialization purpose
UserTransactionWrapper(javax.transaction.UserTransaction u, javax.naming.InitialContext i)
          Deprecated. Use this constructor to create UserTransactionWrapper object
 
Method Summary
 javax.transaction.UserTransaction getUserTransaction()
          Deprecated.  
 void readExternal(java.io.ObjectInput in)
          Deprecated. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 void writeExternal(java.io.ObjectOutput out)
          Deprecated. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings and arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserTransactionWrapper

public UserTransactionWrapper(javax.transaction.UserTransaction u,
                              javax.naming.InitialContext i)
Deprecated. 
Use this constructor to create UserTransactionWrapper object

UserTransactionWrapper

public UserTransactionWrapper()
Deprecated. 
This is for Java Serialization purpose
Method Detail

getUserTransaction

public javax.transaction.UserTransaction getUserTransaction()
Deprecated. 

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Deprecated. 
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.lang.ClassNotFoundException - If the class for an object being restored cannot be found.
Since:
JDK1.1

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Deprecated. 
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings and arrays.
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException - Includes any I/O exceptions that may occur
Since:
JDK1.1