Chapter 22. Writing Programs To Customize Jvms; Writing Java Classes To Redirect Jvm Stdout And Stderr Output - IBM SC34-6814-04 Customization Manual

Cics transaction server for z/os
Table of Contents

Advertisement

Chapter 22. Writing programs to customize JVMs

This chapter describes how to write programs to customize a Java Virtual Machine
(JVM). The normal way to customize JVMs is by specifying options in the JVM
profile, and system properties in the JVM properties file. There are three additional
ways to customize JVMs:
v You can create Java classes that intercept the stdout and stderr output from a
v You can define Language Environment runtime options for the Language
v You can override the options in a JVM profile by using a program, DFHJVMAT,

Writing Java classes to redirect JVM stdout and stderr output

Use the USEROUTPUTCLASS option in a JVM profile to name a Java class that
intercepts the stdout and stderr output from the JVM. You can tailor this class to
specify your choice of time stamps and record headers, and to redirect the output.
CICS supplies sample Java classes, com.ibm.cics.samples.SJMergedStream and
com.ibm.cics.samples.SJTaskStream, that you can use for this purpose. Sample
source is provided for both these classes, in the directory /usr/lpp/cicsts/
cicsts32/samples/useroutputclass. The /usr/lpp/cicsts/cicsts32 directory is the
install directory for CICS files on z/OS UNIX. This directory is specified by the
USSDIR parameter in the DFHISTAR install job. The sample classes are also
shipped as a class file, dfjoutput.jar, which is in the directory
/usr/lpp/cicsts/cicsts32/lib. You can modify these classes, or write your own
classes based on the samples.
Controlling the location for JVM stdout, stderr and dump output, in the Java
Applications in CICS has information about:
v The types of output from JVMs that are and are not intercepted by the class
v The behaviour of the supplied sample classes. The
© Copyright IBM Corp. 1977, 2011
JVM, add time stamps and record headers, and redirect the output to the
destination of your choice. "Writing Java classes to redirect JVM stdout and
stderr output" tells you how to do this.
Environment enclave in which a JVM runs, by using the DFHJVMRO
user-replaceable program. You should only need to do this in exceptional
circumstances. "Using DFHJVMRO to modify the Language Environment enclave
for a JVM" on page 670 tells you how to do this.
that can be called when the JVM is launched. You can only call DFHJVMAT for a
single-use JVM, that is, with a JVM profile that specifies REUSE=NO (for
example, the supplied sample JVM profile DFHJVMPS). You should consider
using DFHJVMAT only if you need to tailor a single-use JVM in a way that can't
be achieved by specifying options in the JVM profile. "Using DFHJVMAT to
modify options in a JVM profile" on page 671 tells you how to do this.
named by the USEROUTPUTCLASS option. The class that you use must be
able to deal with all the types of output that it might intercept.
com.ibm.cics.samples.SJMergedStream class creates two merged log files for
JVM output and for error messages, with a header on each record containing
applid, date, time, transid, task number and program name. The log files are
created using transient data queues, if they are available; or z/OS UNIX files, if
the transient data queues are not available, or cannot be used by the Java
application. The com.ibm.cics.samples.SJTaskStream class directs the output
from a single task to z/OS UNIX files, adding time stamps and headers, to
provide output streams that are specific to a single task.
667

Advertisement

Table of Contents
loading

Table of Contents