![]() |
![]() |
![]() |
![]() |
![]() |
• 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.
• 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.The method behaviors differ between Tuxedo 12c Release 2 (12.1.3) and Tuxedo 12c Release 1 (12.1.1).Java server supports the following initialization and termination methods: tpsvrinit(), tpsvrinit(String []), tpsvrdone(), tpsvrthrinit(), tpsvrthrinit(String []), and tpsvrthrdone().
Note: tpsvrinit() and tpsvrdone() are mandatory; the other four methods are optional.
When a server dispatching thread is inactivated, tpsvrthrdone() method is invoked if the server class implements it.tpsvrthrinit() and tpsvrthrdone() will not be invoked if Java server is running in single-thread mode.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.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.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.
• Java service can throw any exception during execution and exit the Java service. In this case the Java server will return TPFAIL with rcode setting to 0 for this service to its client.
• All the exception information is recorded into the $APPDIR/stderr file.