![]() |
![]() |
BEA WebLogic Enterprise 4.2 Developer Center |
![]() HOME | SITE MAP | SEARCH | CONTACT | GLOSSARY | PDF FILES | WHAT'S NEW |
||
![]() JAVA REFERENCE | TABLE OF CONTENTS | PREVIOUS TOPIC | NEXT TOPIC |
This chapter contains the following topics:
The WebLogic Enterprise TP Framework provides a programming framework that enables users to create servers for high-performance TP applications. This chapter describes the architecture of and interfaces in the TP Framework. Information about the TP Framework API is in the Java API Reference. Information about how to use this API can be found in Creating Java Server Applications.
The TP Framework consists of:
com.beasys.Tobj_Servant
class, which has virtual methods for object state management
com.beasys.Tobj.TP
class, which provides methods to:
ULOG
) file
The TP Framework supports the following interfaces:
TP Framework Interfaces
com.beasys.Tobj_Servant
org.omg.CosTransactions.TransactionalObject
(deprecated in the previous release)
The Whenever a request comes in for an inactive CORBA object, the object is activated and the
Note:
The The
Note:
Unlike implementing C++ server applications with the WebLogic Enterprise system, when you are implementing Java server applications with the WebLogic Enterprise system, you must provide definitions for the The The purpose of this interface is to provide high-level calls that application code can call, instead of calls to underlying APIs provided by the Portable Object Adapter (POA), the CORBAservices Naming Service, and the BEA TUXEDO system. By using these calls, programmers can learn a simpler API and are spared the complexity of the underlying APIs.
The Tobj_Servant Interface
com.beasys.Tobj_Servant
interface defines operations that allow a CORBA object to assist in the management of its state. Every implementation skeleton generated by the IDL compiler automatically inherits from the com.beasys.Tobj_Servant
class. The com.beasys.Tobj_Servant
class contains two virtual methods, activate_object
and deactivate_object
, that can be redefined by the programmer.
activate_object
method is invoked on the servant. When the CORBA object is deactivated, the deactivate_object
method is invoked on the servant. The timing of deactivation is driven by the implementation's activation policy. When deactivate_object
is invoked, the TP Framework passes in a reason code to indicate why the call was made.
activate_object
and deactivate_object
methods are the only methods that the TP Framework guarantees will be invoked for CORBA object activation and deactivation. The servant class constructor and destructor may or may not be invoked at activation or deactivation time. Therefore, the server-application code must not do any state handling for CORBA objects in either the constructor or destructor of the servant class.
Server Interface
com.beasys.Tobj.Server
interface provides callback methods that can be used for application-specific server initialization and termination logic. The com.beasys.Tobj.Server
class is a Java class.
com.beasys.Tobj.Server.initialize
and com.beasys.Tobj.Server.release
methods. The TP Framework provides default versions of these methods.
TP Interface
com.beasys.Tobj.TP
interface supplies a set of service methods that can be invoked by application code. This is the only interface in the TP Framework that can safely be invoked by application code. All other interfaces have callback methods that are intended to be invoked only by system code.
com.beasys.Tobj.TP
interface implicitly uses two features of the WebLogic Enterprise software that extend the CORBA APIs:
During server application initialization, the application constructs the object reference for an application factory. It then invokes the register_factory
method, passing in the factory's object reference together with a factory id
field. On server release (shutdown), the application uses the unregister_factory
method to unregister the factory.
The org.omg.CosTransactions.TransactionalObject
interface was formerly used to indicate that an object was transactional. In the previous version of the WebLogic Enterprise software, if a transactional invocation was done on an object that did not descend from the org.omg.CosTransactions.TransactionalObject
interface, an exception was raised. Therefore, in the previous version, an object had to descend from the org.omg.CosTransactions.TransactionalObject
interface to be eligible to participate in transactions. This behavior was enforced by the TP Framework.
However, in version 2.1 of the WebLogic Enterprise software, this interface is deprecated. Therefore, the use of this interface is now optional and no enforcement of descent from this interface is done for objects infected with transactions. By specifying the never
or ignore
transaction policies, the programmer can specify that an object is not to be infected by transactions. There is no interface enforcement for eligibility for transactions. The only indicator is the transaction policy.
Note: The CORBAservices Object Transaction Service does not require that all requests be performed within the scope of a transaction. It is up to each object to determine its behavior when invoked outside the scope of a transaction; an object that requires a transaction context can raise a standard exception.
The following sections provide some information about how to use transactions.
In general, the handling of the outcome of a transaction is the responsibility of the initiator. Therefore, the following is true:
The following behavior is enforced by the WebLogic Enterprise system:
org.omg.CORBA.OBJ_ADAPTER
exception is raised to the client application.
The CORBA object must follow strict rules with respect to suspending and resuming a transaction within a method invocation. These rules and the error conditions that result from their violation are described in this section.
When a CORBA object method begins execution, it can be in one of the following three states with respect to transactions:
Transaction Suspend and Resume
AUTOTRAN
or transaction policy always
behavior.
Note:
Not recommended. The transaction may be timed out and aborted before another request causes the transaction to be resumed.
The following restrictions apply to WebLogic Enterprise transactions:
Restrictions
CORBA objects can affect transaction outcome during two stages of transaction processing:
Voting on Transaction Outcome
The org.omg.CORBA.Current.rollback_only
method can be used to ensure that the only possible outcome is to roll back the current transaction. The rollback_only
method can be invoked from any CORBA object method.
CORBA objects that have the transaction activation policy are given a chance to vote whether the transaction should commit or roll back after transactional work is completed. These objects are notified of the completion of transactional work prior to the start of the two-phase commit algorithm when the TP Framework invokes its Note that this behavior does not apply to objects with process or method activation policies. If the CORBA object wants to roll back the transaction, it can invoke the
Note:
CORBA objects that have the
deactivate_object
method.
org.omg.CORBA.Current.rollback_only
method. If it wants to vote to commit the transaction, it does not make that call. Note, however, that a vote to commit does not guarantee that the transaction is committed, since other objects may subsequently vote to roll back the transaction.
transaction
activation policy are, by definition, notified when a transaction completes, as described above. However, CORBA objects that have a method
or process
activation policy do not receive any notification. This is something that programmers need to be aware of.
process
that opens an SQL cursor within a client-initiated transaction. Typically, once the client application commits the transaction, all cursors that were opened within that transaction are automatically closed; however, the object does not receive any notification that its cursor has been closed.