blob: b5a3ac40974d8d40738b083e0814d2432a9ca69b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<head>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Life cycle of Java components</TITLE>
<META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Win32)">
<META NAME="CLASSIFICATION" CONTENT="Writing a simple UNO component">
<META NAME="KEYWORDS" CONTENT="UNO,component">
</head>
<body LINK="#444488" VLINK="#444488" BGCOLOR="#eeeeff">
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=75>
<TR>
<TD BGCOLOR="#666699">
<H1 ALIGN=CENTER STYLE="margin-top: 0cm; text-decoration: none"><A HREF="http://www.openoffice.org/"><IMG SRC="../../images/open_office_org_logo.gif" NAME="Grafik1" ALT="OpenOffice" ALIGN=RIGHT WIDTH=109 HEIGHT=54 BORDER=0></A><font color="#ffffff" size=6>The
life cycle of Java components</font><FONT COLOR="#ffffff"></FONT></H1>
</TD>
</TR>
</TABLE>
<HR SIZE=3 noshade>
<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0 WIDTH=100%>
<COL WIDTH=194*> <COL WIDTH=31*> <COL WIDTH=31*>
<TR>
<TD COLSPAN=3 BGCOLOR="#666699">
<H3 ALIGN=LEFT STYLE="margin-top: 0cm; text-decoration: none"><FONT COLOR="#ffffff"><FONT SIZE=4>Contents</FONT></FONT></H3>
</TD>
</TR>
<TR>
<TD COLSPAN=3 height="43">
<p><a href="#Introduction">Introduction</a><br>
<a href="#CPlusPlusToJava">C++ object mapped to Java</a><br>
<a href="#JavaToCPlusPlus">Java object mapped to C++</a></p>
</TD>
</TR>
<TR>
<TD COLSPAN=3 BGCOLOR="#666699">
<H3 ALIGN=LEFT STYLE="margin-top: 0cm; text-decoration: none"><FONT COLOR="#ffffff"><font color="#ffffff"><font size=4><a name="Introduction"></a><font color="#ffffff"></font></font></font><FONT SIZE=4>Introduction</FONT></FONT></H3>
</TD>
</TR>
<TR>
<TD COLSPAN=3 height="69">
<p>In Java, objects live as long as they are reachable by a thread. In UNO,
objects have a reference count and live as long as the reference count
is greater than zero. When using pure Java UNO, the normal Java life cycle
mechanism applies. When using Java UNO in cooperation with e.g. binary
UNO, objects live as long as their reference count is not zero.</p>
<p>In the following the life cycle of Java and C++ objects are described.</p>
</TD>
</TR>
<tr>
<td colspan=3 bgcolor="#666699">
<h3 align=LEFT style="margin-top: 0cm; text-decoration: none"><font color="#ffffff"><font size=4><a name="CPlusPlusToJava"></a>C++
object mapped to Java</font></font></h3>
</td>
</tr>
<tr>
<td colspan=3 height="572">
<p>If a C++ object is mapped to Java, it lives as long as it is reachable
from a Java thread. That is to say that the life cycle of a C++ object
mapped to Java corresponds to the Java life cycle mechanism as normal.
<p>An Object is created to cope with a certain work. In Java, once an object
has completed its work, it is garbage-collected and its resources are
recycled for use by other objects. Now, such an object is unreachable
from a Java thread.
<p><img src="images/LifeCycleOfObjects.jpg" width="727" height="415" alt="Life cycle of objects">
</td>
</tr>
<tr>
<td colspan=3 bgcolor="#666699">
<h3 align=LEFT style="margin-top: 0cm; text-decoration: none"><font color="#ffffff"><font size=4><a name="JavaToCPlusPlus"></a>Java
object mapped to C++</font></font></h3>
</td>
</tr>
<tr>
<td colspan=3 height="31">
<p>If a Java object is mapped to C++, the Java object lives as long as there
is a C++ reference. That is to say that the life cycle of a Java object
mapped to C++ corresponds to the C++ life cycle mechanism as normal.
<p>You can find further information to the life cycle of objects on the
following page:<br>
<a href="http://udk.openoffice.org/project/udk/common/man/comparison_uno_corba.html#life_time_mechanism">http://udk.openoffice.org/project/udk/common/man/comparison_uno_corba.html#life_time_mechanism</a>
</td>
</tr>
<TR>
<TD COLSPAN=3>
<P>&nbsp; </P>
</TD>
</TR>
<TR>
<TD COLSPAN=3>
<HR SIZE=1 noshade>
</TD>
</TR>
<TR>
<TD BGCOLOR="#666699">
<P ALIGN=LEFT><FONT COLOR="#ffffff"> Author: <A HREF="mailto:Bertram.Nolte@germany.sun.com"><FONT COLOR="#ffffff">Bertram
Nolte</FONT></A>, <a href="mailto:Kay.Ramme@germany.sun.com">Kay Ramme</a>
(Mon 18 Jun 2001 11:54:14)<BR>
<I>Copyright 2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.</I></FONT>
</P>
</TD>
<TR>
<TD COLSPAN=3>
<HR SIZE=1 noshade>
</TD>
</TR>
</TABLE>
<HR SIZE=3 noshade>
</body>
</HTML>