src.utilities.RunJavaApplicationThread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jt400-jdk8 Show documentation
Show all versions of jt400-jdk8 Show documentation
The Open Source version of the IBM Toolbox for Java
The newest version!
///////////////////////////////////////////////////////////////////////////////
//
// JTOpen (IBM Toolbox for Java - OSS version)
//
// Filename: RunJavaApplicationThread.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 1997-2000 International Business Machines Corporation and
// others. All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////
package utilities;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.JavaApplicationCall;
import com.ibm.as400.access.Trace;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.ResourceBundle;
/**
This class is only used by RunJavaApplication class.
**/
class RunJavaApplicationThread extends Thread
{
// Indicates which thread should be started.
final static int RUN_APPLICATION = 1;
final static int OUTPUT = 2;
final static int INPUT = 3;
final static int ERROR = 4;
// Where MRI comes from.
private static ResourceBundle resources_ = ResourceBundle.getBundle("utilities.UTMRI");
private int threadID_ = 0;
private JavaApplicationCall runMain_ = null;
/**
Constructor.
**/
RunJavaApplicationThread(JavaApplicationCall jac, int whichThread)
{
runMain_ = jac;
threadID_ = whichThread;
}
/**
Start the threads.
**/
public void run()
{
if (threadID_ == RUN_APPLICATION)
{
System.out.println(resources_.getString("REMOTE_START_PROGRAM")
+" "+runMain_.getJavaApplication()+"\n");
boolean success = false;
try
{
success = runMain_.run();
}
catch (Exception e)
{
System.out.println(resources_.getString("REMOTE_CALL_JAVA_ERROR"));
System.out.println(e.toString());
}
com.ibm.as400.access.AS400Message[] messageList = runMain_.getMessageList();
if ((messageList != null) && (messageList.length > 0))
{
for(int i=0; i