com.beasys.Tobj
Class Server

java.lang.Object
  |
  +--com.beasys.Tobj.Server

public class Server
extends java.lang.Object
implements java.io.Serializable

Provides callback methods that can be used for application-specific server initialization and termination logic. Default implementations are provided.

See Also:
Serialized Form

Constructor Summary
Server()
           
 
Method Summary
 boolean initialize(java.lang.String[] args)
          Allows the application to perform application-specific initialization procedures, such as logging into a database, creating and registering well-known object factories, initializing global variables, and so forth.
 void release()
          Allows the application to perform any application-specific cleanup, such as logging off a database, unregistering well-known factories, or deallocating resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server()
Method Detail

initialize

public boolean initialize(java.lang.String[] args)
                   throws InitializeFailed
Allows the application to perform application-specific initialization procedures, such as logging into a database, creating and registering well-known object factories, initializing global variables, and so forth.

Note: Default implementation opens default XA RM.

The com.beasys.Tobj.Servant.initialize method, which is invoked as the last step in server initialization, allows the application to perform application-specific initialization. Typically, a server application does the following tasks in the initialize method:

The TP Framework provides a default implementation of the initialize method. The default implementation opens XA resource managers for the server. The TP Framework does this by issuing a tx_open() invocation, which uses the default OPENINFO parameter configured for the server's group in the UBBCONFIG file or the TUXCONFIG file.

Note: If the server application implements the initialize method, it is the responsibility of the server application to open any required XA resource managers. This is done by invoking either of the following methods:

Transactions may be started in the initialize method after invoking the com.beasys.Tobj.TransactionCurrent.open_xa_rm or com.beasys.Tobj.TP.open_xa_rm method. However, any transactions that are started in the initialize method must be terminated by the server application before the initialize method returns. If the transactions are still active when control is returned, the server system fails to boot, and it exits gracefully. This happens because the server application has no logical way of either committing or rolling back the transaction after the initialize method returns.

Parameters:
args - Command line options. The argv[0] argument contains the name of the server.
Returns:
TRUE indicates success. FALSE indicates failure. If an error occurs in initialize(), the application code should return FALSE. The application code should not call the system call exit(). Invoking exit() does not give the TP Framework a chance to release resources allocated during startup and may cause unpredictable results.

If the return value is FALSE:

  • All resources allocated by the server will be released and the server will be shut down.

  • The com.beasys.Tobj.Server.release method is not invoked.

  • Any transactions that are started in the initialize method and are not terminated will eventually time out; they are not automatically rolled back.

Throws:
InitializeFailed - If an exception is raised in the initialize method, the TP Framework catches the exception. The TP Framework behavior is the same as if the initialize method returned FALSE (that is, an exception is considered to be a failure). In addition, an error message is written to the user log (ULOG) file.

release

public void release()
             throws ReleaseFailed
Allows the application to perform any application-specific cleanup, such as logging off a database, unregistering well-known factories, or deallocating resources.

Note: Default implementation closes default XA RM.

Throws:
ReleaseFailed - A ULOG message is reported, and server process shutdown continues.