System input and output

System input and output are mapped as follows in the ActiveSpaces® Transactions JVM:

The System.out log file can be displayed from the ActiveSpaces® Transactions Administrator JVM tab. It is also sent to the deployment tool client when the deployment tool is executing in attached mode. Example 3.4, “JVM input and output” shows a simple snippet that writes and reads to system output and input.

Example 3.4. JVM input and output

//     $Revision: 1.1.2.1 $

package com.kabira.snippets.vmlifecycle;

import java.io.IOException;

/**
 *  Standard input and output
 * <p>
 * <h2> Target Nodes</h2>
 * <ul>
 * <li> <b>domainnode</b> = A
 * </ul>
 */
public class InputOutput
{
    /**
     * Main entry point
     * @param args  Not used
     */
    public static void main(String args []) throws IOException
    {
        System.out.println("Message to system out");

        byte [ ] buffer = new byte[100];

        //
        //  Attempt to read system input
        //
        Integer rc = System.in.read(buffer);

        System.out.println("Read return value is " + rc);
    }
}

When this snippet is run it outputs:

[A] Message to system out
[A] Read return value is -1

This information is also available in a file named com_kabira_snippets_vmlifecycle_InputOutput2.out in the node directory.