Table of Contents Previous Next PDF


Introduction to Oracle Tuxedo Java Programming

Introduction to Oracle Tuxedo Java Programming
This topic includes the following sections:
Overview
An Oracle Tuxedo service can be developed using pure Java language. The service implemented with Java language functions the same as other Tuxedo services. You can call the services advertised by the Tuxedo Java server (TMJAVASVR) using ATMI interfaces from client/ Tuxedo server, and similarly, you can call the services advertised by the Tuxedo server using TJATMI interfaces from the java-implemented service.
Besides, you can call java-implemented services from any type of Tuxedo clients, such as native clients, /WS clients, and Jolt clients.
It is supported to use a variety of mainstream Java technologies like TJATMI interface, JATMI TypedBuffers, POLO java object, and so on to implement Tuxedo services.
Programing Guidelines
The following guidelines are basic instructions for Java service development.
Java server class, which implements Java services, should inherit the TuxedoJavaServer class; Java server class also should have a default constructor.
In Java server class, Java method, which will be advertised as Java service, should take the TPSVCINFO interface as the only input argument and should be declared to public.
Java server class should implement tpsvrinit() method, which will be called when Tuxedo Java server starts up.
Java server class should implement tpsvrdone() method, which will be called when Tuxedo Java server shuts down.
Java service could return result to client by using tpreturn and exit by throwing exception.
Tuxedo Java Server Threads and Java Class Instance Model
Tuxedo Java Server tpsvrinit()/tpsvrdone() Handling
tpsvrinit() Handling
Users need to implement the tpsvrinit() method. Given that tpsvrinit() will be called when server starts up, it's recommended to put the class scope initialization in this method. If one class' tpsvrinit() fails, a warning message will be reported in user log and the Java server will continue its execution.
tpsvrdone() Handling
Users need to implement the tpsvrdone() method. Given that tpsvrdone() will be called when the server shuts down, it's recommended to put the class scope cleanup actions in this method.
Tuxedo Java Server tpreturn() Handling
The tpreturn() in Java service does not immediately disrupt the Java service method's execution but provide the return result to Tuxedo Java server.
How does tpreturn() behave in Java service is different from how does tpreturn() behave in the existing Tuxedo system.
When a tpreturn() is called in the existing Tuxedo system, the flow control is transferred to Tuxedo automatically.
When a tpreturn() is called in Java service, statements after tpreturn() will still be executed. Users must make sure tpreturn() is the last execution statement in Java service - if not, we suggest to use a following Java return invocation after tpreturn(); otherwise, tpreturn() will not transfer the flow control to the Tuxedo system automatically.
Note:
The use of a Java return statement in Java service without a previous tpreturn() statement is not suggested - such use will make the Java server return TPFAIL with rcode setting 0 to the corresponding client.
Tuxedo Java Server Exception Handling

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.