125 lines
7.0 KiB
HTML
125 lines
7.0 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Invocation API functions" />
|
||
|
<meta name="abstract" content="The IBM Developer Kit for Java supports these Invocation API functions." />
|
||
|
<meta name="description" content="The IBM Developer Kit for Java supports these Invocation API functions." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="invocapi.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="invofunc" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Invocation API functions</title>
|
||
|
</head>
|
||
|
<body id="invofunc"><a name="invofunc"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Invocation API functions</h1>
|
||
|
<div><p>The IBM<sup>®</sup> Developer
|
||
|
Kit for Java™ supports these Invocation API functions.</p>
|
||
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Before using this API, you must ensure that you are in a multithread-capable
|
||
|
job. See <a href="../rzahw/rzahwovepo.htm" target="_blank">Multithreaded applications</a> for more information about
|
||
|
multithread-capable jobs. </div>
|
||
|
<ul><li><strong>JNI_GetCreatedJavaVMs</strong> <p>Returns information about all Java virtual
|
||
|
machines that were created. Even though this API is designed to return information
|
||
|
for multiple Java virtual machines (JVMs), only one JVM can exist
|
||
|
for a process. Therefore, this API will return a maximum of one JVM.</p>
|
||
|
|
||
|
<p>Signature:</p>
|
||
|
<pre> jint JNI_GetCreatedJavaVMs(JavaVM **vmBuf,
|
||
|
jsize bufLen,
|
||
|
jsize *nVMs);</pre>
|
||
|
<p>vmBuf is an output area whose size is determined by bufLen,
|
||
|
which is the number of pointers. Each Java virtual machine has an associated JavaVM
|
||
|
structure that is defined in java.h. This API stores a pointer to the JavaVM
|
||
|
structure that is associated with each created Java virtual machine into vmBuf, unless
|
||
|
vmBuf is 0. Pointers to JavaVM structures are stored in the order of the corresponding Java virtual
|
||
|
machines that are created. nVMs returns the number of virtual machines
|
||
|
that are currently created. Your iSeries™ server supports the creation
|
||
|
of more than one Java virtual machine, so you may expect a value higher
|
||
|
than one. This information, along with the size of the vmBuf, determines whether
|
||
|
pointers to JavaVM structures for each created Java virtual machine are returned.</p>
|
||
|
|
||
|
</li>
|
||
|
<li><strong>JNI_CreateJavaVM</strong> <p>Allows you to create a Java virtual
|
||
|
machine and subsequently use it in an application.</p>
|
||
|
<p>Signature:</p>
|
||
|
|
||
|
<blockquote> <pre>jint JNI_CreateJavaVM(JavaVM **p_vm,
|
||
|
void **p_env,
|
||
|
void *vm_args);</pre>
|
||
|
</blockquote>
|
||
|
<p>p_vm is the address of a JavaVM pointer for
|
||
|
the newly created Java virtual machine. Several other JNI Invocation APIs
|
||
|
use p_vm to identify the Java virtual machine. p_env is the address
|
||
|
of a JNI Environment pointer for the newly created Java virtual machine. It points to a table
|
||
|
of JNI functions that start those functions. vm_args is a structure that contains Java virtual
|
||
|
machine initialization parameters.</p>
|
||
|
<p>If you start a Run Java (RUNJVA)
|
||
|
command or JAVA command and specify a property that has an equivalent command
|
||
|
parameter, then the command parameter takes precedence. The property is ignored.
|
||
|
For example, the os400.optimization parameter is ignored in this command:</p>
|
||
|
|
||
|
<blockquote> <pre>JAVA CLASS(Hello) PROP((os400.optimization 0))</pre>
|
||
|
</blockquote>
|
||
|
<p>For a list of 0S/400 unique properties that
|
||
|
are supported by the JNI_CreateJavaVM API, see <a href="sysprop.htm">Java system
|
||
|
properties</a>.</p>
|
||
|
<div class="note"><span class="notetitle">Note:</span> Java on the iSeries server supports creating only
|
||
|
one Java virtual
|
||
|
machine (JVM) within a single job or process. For more information, see <a href="multjvm.htm">Support for multiple Java virtual machines</a></div>
|
||
|
</li>
|
||
|
<li><strong>DestroyJavaVM</strong> <p>Destroys the Java virtual machine.</p>
|
||
|
<p>Signature:</p>
|
||
|
|
||
|
<blockquote> <pre>jint DestroyJavaVM(JavaVM *vm)</pre>
|
||
|
</blockquote>
|
||
|
<p>When the Java virtual machine is created, vm is the
|
||
|
JavaVM pointer that is returned.</p>
|
||
|
</li>
|
||
|
<li><strong>AttachCurrentThread</strong> <p>Attaches a thread to a Java virtual
|
||
|
machine, so it can use Java virtual machine services.</p>
|
||
|
<p>Signature:</p>
|
||
|
|
||
|
<blockquote> <pre>jint AttachCurrentThread(JavaVM *vm,
|
||
|
void **p_env,
|
||
|
void *thr_args);</pre>
|
||
|
</blockquote>
|
||
|
<p>The JavaVM pointer, vm, identifies the Java virtual
|
||
|
machine to which the thread is being attached. p_env is the pointer to the
|
||
|
location where the JNI Interface pointer of the current thread is placed.
|
||
|
thr_args contains VM specific thread attachment arguments.</p>
|
||
|
</li>
|
||
|
<li><strong>DetachCurrentThread</strong> <p>Signature:</p>
|
||
|
<blockquote> <pre>jint DetachCurrentThread(JavaVM *vm);</pre>
|
||
|
</blockquote>
|
||
|
<p>vm identifies the Java virtual machine from which the thread
|
||
|
is being detached.</p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<p>For a complete description of the Invocation API functions, refer
|
||
|
to the <a href="javaapi/guide/jni/index.html" target="_blank">Java Native
|
||
|
Interface Specification by Sun Microsystems, Inc.</a>, or <a href="http://www.java.sun.com/" target="_blank">The Source for Java Technology
|
||
|
java.sun.com</a>.</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="invocapi.htm" title="The Invocation API, which is part of the Java Native Interface (JNI), allows non-Java code to create a Java virtual machine, and load and use Java classes. This function lets a multithreaded program make use of Java classes that are running in a single Java virtual machine in multiple threads.">Java Invocation API</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|