summaryrefslogtreecommitdiff
path: root/libjava/classpath/gnu/CORBA
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/CORBA')
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/Vio.java5
-rw-r--r--libjava/classpath/gnu/CORBA/CollocatedOrbs.java164
-rw-r--r--libjava/classpath/gnu/CORBA/Connected_objects.java10
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/Ext.java6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameParser.java3
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java42
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/TransientContext.java4
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFunctional.java122
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/LocalRequest.java7
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOA.java4
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java15
-rw-r--r--libjava/classpath/gnu/CORBA/SafeForDirectCalls.java50
-rw-r--r--libjava/classpath/gnu/CORBA/SimpleDelegate.java40
16 files changed, 372 insertions, 114 deletions
diff --git a/libjava/classpath/gnu/CORBA/CDR/Vio.java b/libjava/classpath/gnu/CORBA/CDR/Vio.java
index fd878cb3555..28f1c5672f6 100644
--- a/libjava/classpath/gnu/CORBA/CDR/Vio.java
+++ b/libjava/classpath/gnu/CORBA/CDR/Vio.java
@@ -155,7 +155,6 @@ public abstract class Vio
* read(InputStream, Class) or read(InputStream, Serializable).
*
* @param input a stream to read from.
- * @param repository_id a repository id of the object being read, may be null.
*
* @return the loaded value.
*
@@ -173,7 +172,7 @@ public abstract class Vio
* is known. Hence it may be faster to use the alternative methods,
* read(InputStream, Class) or read(InputStream, Serializable).
*
- * @param an_input a stream to read from.
+ * @param input a stream to read from.
* @param repository_id a repository id of the object being read, may be null.
*
* @return the loaded value.
@@ -904,7 +903,7 @@ public abstract class Vio
*
* @param output an output stream to write into.
* @param value a value to write.
- * @param id a value repository id (can be either single string or string
+ * @param ids a value repository id (can be either single string or string
* array).
* @param helper a helper, writing object - specifical part. Can be null if
* the value should be written using other methods.
diff --git a/libjava/classpath/gnu/CORBA/CollocatedOrbs.java b/libjava/classpath/gnu/CORBA/CollocatedOrbs.java
new file mode 100644
index 00000000000..fc1e513efec
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CollocatedOrbs.java
@@ -0,0 +1,164 @@
+/* CollocatedOrbs.java -- Handles collocations
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA;
+
+import gnu.CORBA.Poa.gnuServantObject;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * This class provides support for the direct method invocations without
+ * involving the network in the case when both ORBs run on the same java
+ * virtual machine. Special attention is only needed when call is made
+ * between two independent ORBs, instantiated via ORB.init. The call to the
+ * object, obtained via IOR reference from the ORB where it was locally
+ * connected is always local anyway.
+ *
+ * For security reasons it may be sensible to keep this class and all support
+ * package private.
+ *
+ * @author Audrius Meskauskas
+ */
+class CollocatedOrbs
+{
+ /**
+ * This field is used in automated Classpath specific testing to disable
+ * the direct calls.
+ */
+ static boolean DIRECT_CALLS_ALLOWED = true;
+
+ /**
+ * Containts the references of the all running GNU Classpath ORBs in the
+ * local virtual machine. GNU Classpath ORBs register themselves here when
+ * created and unregister when either ORB.destroy is called or in the
+ * finalizer.
+ */
+ private static ArrayList orbs = new ArrayList();
+
+ /**
+ * The address of the local host.
+ */
+ static String localHost;
+
+ static
+ {
+ try
+ {
+ localHost = InetAddress.getLocalHost().getHostAddress();
+ }
+ catch (UnknownHostException ex)
+ {
+ throw new InternalError("Local host is not accessible:" + ex);
+ }
+ }
+
+ /**
+ * Register the new ORB
+ *
+ * @param orb the orb to register
+ */
+ static void registerOrb(OrbFunctional orb)
+ {
+ if (DIRECT_CALLS_ALLOWED)
+ synchronized (orbs)
+ {
+ assert ! orbs.contains(orb);
+ orbs.add(orb);
+ }
+ }
+
+ /**
+ * Unregister the ORB. The ORB will no longer be reacheable locally but may
+ * be reacheable via network as if it would be remote.
+ *
+ * @param orb the orb to unregister
+ */
+ static void unregisterOrb(OrbFunctional orb)
+ {
+ if (DIRECT_CALLS_ALLOWED)
+ synchronized (orbs)
+ {
+ assert orbs.contains(orb);
+ orbs.remove(orb);
+ }
+ }
+
+ /**
+ * Search the possibly local object. If the IOR is not local or none of the
+ * found ORBs of this virtual machine knows about it, null is returned.
+ *
+ * @param ior the IOR to search
+ * @return the found local CORBA object or null in not found.
+ */
+ static org.omg.CORBA.Object searchLocalObject(IOR ior)
+ {
+ if (! DIRECT_CALLS_ALLOWED && ! ior.Internet.host.equals(localHost))
+ return null;
+
+ synchronized (orbs)
+ {
+ OrbFunctional orb;
+ org.omg.CORBA.Object object;
+ for (int i = 0; i < orbs.size(); i++)
+ {
+ orb = (OrbFunctional) orbs.get(i);
+ object = orb.find_connected_object(ior.key, ior.Internet.port);
+ if (object != null)
+ {
+ if (object instanceof SafeForDirectCalls)
+ {
+ return object;
+ }
+ else if (object instanceof gnuServantObject)
+ {
+ return object;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/Connected_objects.java b/libjava/classpath/gnu/CORBA/Connected_objects.java
index ce5761007c0..53ef2dd17d9 100644
--- a/libjava/classpath/gnu/CORBA/Connected_objects.java
+++ b/libjava/classpath/gnu/CORBA/Connected_objects.java
@@ -242,4 +242,14 @@ public class Connected_objects
free_object_number++;
return instance_number;
}
+
+ /**
+ * Get the number of the connected objects.
+ *
+ * @return the size of the internal map.
+ */
+ public int size()
+ {
+ return objects.size();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java b/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java
index 79d787083ca..108ca270d21 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java
@@ -1,5 +1,5 @@
/* Binding_iterator.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA.NamingService;
+import gnu.CORBA.SafeForDirectCalls;
+
import org.omg.CosNaming.Binding;
import org.omg.CosNaming.BindingHolder;
import org.omg.CosNaming.BindingListHolder;
@@ -51,7 +53,7 @@ import org.omg.CosNaming._BindingIteratorImplBase;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class Binding_iterator_impl
- extends _BindingIteratorImplBase
+ extends _BindingIteratorImplBase implements SafeForDirectCalls
{
/**
* The value, returned by the {@link #next_one} when there
diff --git a/libjava/classpath/gnu/CORBA/NamingService/Ext.java b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
index ee27e68cd79..d339cb194e6 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/Ext.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
@@ -1,5 +1,5 @@
/* TransientContextExt.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA.NamingService;
+import gnu.CORBA.SafeForDirectCalls;
+
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.Object;
import org.omg.CORBA.portable.Delegate;
@@ -61,7 +63,7 @@ import org.omg.CosNaming._NamingContextExtImplBase;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class Ext
- extends _NamingContextExtImplBase
+ extends _NamingContextExtImplBase implements SafeForDirectCalls
{
/**
* The older version of the naming context, where all relevant calls
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
index c750b2eb4c0..aa922b96a54 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
@@ -193,9 +193,6 @@ public class NameParser
boolean corbaname;
- // The alternative addresses, if given.
- ArrayList alt_addr = new ArrayList();
-
// The version numbers with default values.
int major = 1;
int minor = 0;
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
index 0e0782a5756..d717b9d4011 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
@@ -1,5 +1,5 @@
/* NameTransformer.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,10 +75,6 @@ public class NameTransformer
ArrayList components = new ArrayList();
StringTokenizer st = new StringTokenizer(a_name, "./\\", true);
- String id;
- String kind;
- String next;
-
// Create the buffer array, reserving the last element for null.
String[] n = new String[ st.countTokens() + 1 ];
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
index 3669879f22a..a8cd0b313b3 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
@@ -85,35 +85,26 @@ public class NamingServiceTransient
}
/**
- * Start the naming service on the current host at the given port. The
- * parameter -org.omg.CORBA.ORBInitialPort NNN or -ORBInitialPort NNN, if
- * present, specifies the port, on that the service must be started. If this
- * key is not specified, the service starts at the port 900.
+ * Start the naming service on the current host at the given port.
*
- * The parameter -ior FILE_NAME, if present, forces to store the ior string of
- * this naming service to the specified file.
- *
- * @param args the parameter string.
+ * @param portArgument the port on which the service will be
+ * started, or -1 to use the default port, 900
+ * @param fileArgument if non-null, store the IOR string of this
+ * naming service in a file by this name
*/
- public static void main(String[] args)
+ public static void start(int portArgument, String fileArgument)
{
int port = PORT;
- String iorf = null;
+
+ if (portArgument > -1)
+ port = portArgument;
+
+ String iorf = fileArgument;
try
{
// Create and initialize the ORB
final OrbFunctional orb = new OrbFunctional();
- if (args.length > 1)
- for (int i = 0; i < args.length - 1; i++)
- {
- if (args[i].endsWith("ORBInitialPort"))
- port = Integer.parseInt(args[i + 1]);
-
- if (args[i].equals("-ior"))
- iorf = args[i + 1];
- }
-
OrbFunctional.setPort(port);
// Create the servant and register it with the ORB
@@ -133,15 +124,6 @@ public class NamingServiceTransient
p.close();
}
- System.out.println("GNU Classpath transient naming service "
- + "started at " + iorr.Internet.host + ":" + iorr.Internet.port
- + " key 'NameService'.\n\n"
- + "Copyright (C) 2006 Free Software Foundation\n"
- + "This tool comes with ABSOLUTELY NO WARRANTY. "
- + "This is free software, and you are\nwelcome to "
- + "redistribute it under conditions, defined in "
- + "GNU Classpath license.\n\n" + ior);
-
new Thread()
{
public void run()
@@ -154,7 +136,7 @@ public class NamingServiceTransient
catch (Exception e)
{
System.err.println("ERROR: " + e);
- e.printStackTrace(System.out);
+ e.printStackTrace(System.err);
}
// Restore the default value for allocating ports for the subsequent
diff --git a/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java b/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java
index c2d8275e001..cec87931e28 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java
@@ -54,6 +54,8 @@ import org.omg.CosNaming.NamingContextPackage.NotFound;
import org.omg.CosNaming.NamingContextPackage.NotFoundReason;
import org.omg.CosNaming._NamingContextImplBase;
+import gnu.CORBA.SafeForDirectCalls;
+
import java.util.Iterator;
import java.util.Map;
@@ -69,7 +71,7 @@ import java.util.Map;
*/
public class TransientContext
extends _NamingContextImplBase
- implements NamingContext, NamingContextOperations
+ implements NamingContext, NamingContextOperations, SafeForDirectCalls
{
/**
* Use serial version UID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/OrbFunctional.java b/libjava/classpath/gnu/CORBA/OrbFunctional.java
index 7b9c34ada12..bfb5e3d86c1 100644
--- a/libjava/classpath/gnu/CORBA/OrbFunctional.java
+++ b/libjava/classpath/gnu/CORBA/OrbFunctional.java
@@ -938,48 +938,55 @@ public class OrbFunctional extends OrbRestricted
/**
* Start the ORBs main working cycle (receive invocation - invoke on the local
- * object - send response - wait for another invocation).
- *
- * The method only returns after calling {@link #shutdown(boolean)}.
+ * object - send response - wait for another invocation). The method only
+ * returns after calling {@link #shutdown(boolean)}.
*/
public void run()
{
- running = true;
-
- // Instantiate the port server for each socket.
- Iterator iter = connected_objects.entrySet().iterator();
- Map.Entry m;
- Connected_objects.cObject obj;
-
- while (iter.hasNext())
+ CollocatedOrbs.registerOrb(this);
+ try
{
- m = (Map.Entry) iter.next();
- obj = (Connected_objects.cObject) m.getValue();
+ running = true;
- portServer subserver;
+ // Instantiate the port server for each socket.
+ Iterator iter = connected_objects.entrySet().iterator();
+ Map.Entry m;
+ Connected_objects.cObject obj;
- if (obj.identity == null)
- {
- subserver = new portServer(obj.port);
- portServers.add(subserver);
- }
- else
- subserver = (portServer) identities.get(obj.identity);
-
- if (!subserver.isAlive())
+ while (iter.hasNext())
{
- // Reuse the current thread for the last portServer.
- if (!iter.hasNext())
+ m = (Map.Entry) iter.next();
+ obj = (Connected_objects.cObject) m.getValue();
+
+ portServer subserver;
+
+ if (obj.identity == null)
{
- // Discard the iterator, eliminating lock checks.
- iter = null;
- subserver.run();
- return;
+ subserver = new portServer(obj.port);
+ portServers.add(subserver);
}
else
- subserver.start();
+ subserver = (portServer) identities.get(obj.identity);
+
+ if (! subserver.isAlive())
+ {
+ // Reuse the current thread for the last portServer.
+ if (! iter.hasNext())
+ {
+ // Discard the iterator, eliminating lock checks.
+ iter = null;
+ subserver.run();
+ return;
+ }
+ else
+ subserver.start();
+ }
}
}
+ finally
+ {
+ CollocatedOrbs.unregisterOrb(this);
+ }
}
/**
@@ -1051,22 +1058,26 @@ public class OrbFunctional extends OrbRestricted
org.omg.CORBA.Object object = find_local_object(ior);
if (object == null)
{
- ObjectImpl impl = StubLocator.search(this, ior);
- try
- {
- if (impl._get_delegate() == null)
- impl._set_delegate(new IorDelegate(this, ior));
- }
- catch (BAD_OPERATION ex)
+ // Check maybe the local object on another ORB, but same VM.
+ object = CollocatedOrbs.searchLocalObject(ior);
+ if (object == null)
{
- // Some colaborants may throw this exception
- // in response to the attempt to get the unset delegate.
- impl._set_delegate(new IorDelegate(this, ior));
- }
+ // Surely remote object.
+ ObjectImpl impl = StubLocator.search(this, ior);
+ try
+ {
+ if (impl._get_delegate() == null)
+ impl._set_delegate(new IorDelegate(this, ior));
+ }
+ catch (BAD_OPERATION ex)
+ {
+ // Some colaborants may throw this exception
+ // in response to the attempt to get the unset delegate.
+ impl._set_delegate(new IorDelegate(this, ior));
+ }
- object = impl;
- // TODO remove commented out code below.
- // connected_objects.add(ior.key, impl, ior.Internet.port, null);
+ object = impl;
+ }
}
return object;
}
@@ -1239,15 +1250,10 @@ public class OrbFunctional extends OrbRestricted
}
if (ior.Id == null)
ior.Id = ref.object.getClass().getName();
- try
- {
- ior.Internet.host = InetAddress.getLocalHost().getHostAddress();
- ior.Internet.port = ref.port;
- }
- catch (UnknownHostException ex)
- {
- throw new BAD_OPERATION("Cannot resolve the local host address");
- }
+
+ ior.Internet.host = CollocatedOrbs.localHost;
+ ior.Internet.port = ref.port;
+
return ior;
}
@@ -1775,4 +1781,14 @@ public class OrbFunctional extends OrbRestricted
running = false;
super.finalize();
}
+
+ /**
+ * Get the number of objects that are connected to this ORB.
+ *
+ * @return the number of objects, connected to this ORB.
+ */
+ public int countConnectedObjects()
+ {
+ return connected_objects.size();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
index a2c0bb106c3..4a9ef8d9044 100644
--- a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
+++ b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
@@ -193,11 +193,14 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
/**
* Make an invocation and return a stream from where the results can be read.
*
- * @param the invoke handler (can be null, then it is obtained self
+ * @param handler the invoke handler (can be null, then it is obtained self
* dependently).
*/
public org.omg.CORBA.portable.InputStream v_invoke(InvokeHandler handler)
{
+ // Check maybe POA is in the discarding mode (will throw TRANSIENT if it is).
+ poa.checkDiscarding();
+
// Local request must be intercepted both by server and request
// interceptors.
boolean s_intercept = false;
@@ -246,7 +249,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
s_interceptor.receive_request_service_contexts(s_info);
}
-
+
if (handler == null)
{
handler = object.getHandler(operation(), cookie, false);
diff --git a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
index bb00aab70eb..4fc51ff154b 100644
--- a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
@@ -290,4 +290,4 @@ public class ORB_1_4
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
index 460a0a6029a..8ceec23d781 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
@@ -1582,7 +1582,7 @@ public class gnuPOA
*
* @throws TRANSIENT if the POA is in discarding mode.
*/
- private void checkDiscarding()
+ void checkDiscarding()
throws TRANSIENT
{
if (m_manager.get_state() == State.DISCARDING)
@@ -1813,4 +1813,4 @@ public class gnuPOA
{
return ref_template_ids;
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
index 020897a45b4..77b0ff46792 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
@@ -129,6 +129,12 @@ public class gnuServantObject extends ObjectImpl
* ids are requested from the servant.
*/
public final String[] repository_ids;
+
+ /**
+ * True indicates that the NO_RETAIN policy applies for the servant.
+ * The servant must be discarded after the each call.
+ */
+ boolean noRetain;
/**
* Create an object with no connected servant. The servant must be set later.
@@ -147,6 +153,8 @@ public class gnuServantObject extends ObjectImpl
manager = a_poa.the_POAManager();
poa = a_poa;
orb = an_orb;
+
+ noRetain = poa.applies(ServantRetentionPolicyValue.NON_RETAIN);
}
/**
@@ -182,6 +190,8 @@ public class gnuServantObject extends ObjectImpl
}
repository_ids = null;
orb = an_orb;
+
+ noRetain = poa != null && poa.applies(ServantRetentionPolicyValue.NON_RETAIN);
}
/**
@@ -222,7 +232,7 @@ public class gnuServantObject extends ObjectImpl
boolean forwarding_allowed
) throws gnuForwardRequest
{
- if (servant != null)
+ if (servant != null && !noRetain)
{
return servantToHandler(servant);
}
@@ -641,13 +651,14 @@ public class gnuServantObject extends ObjectImpl
poa.servant_locator.postinvoke(Id, poa, method,
cookie.value, servant
);
- servant = null;
}
}
}
finally
{
orb.currents.remove(Thread.currentThread());
+ if (noRetain)
+ servant = null;
}
}
catch (ForwardRequest fex)
diff --git a/libjava/classpath/gnu/CORBA/SafeForDirectCalls.java b/libjava/classpath/gnu/CORBA/SafeForDirectCalls.java
new file mode 100644
index 00000000000..f3efb6677f0
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/SafeForDirectCalls.java
@@ -0,0 +1,50 @@
+/* SafeForDirectCalls.java -- FIXME: briefly describe file purpose
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA;
+
+/**
+ * This interface marks that the object does not modify the passed read only
+ * parameters and hence, if it is local, it is safe to call the methods
+ * directly, without cloning such parameters. Otherwise such parameters should
+ * be cloned.
+ */
+public interface SafeForDirectCalls
+{
+
+}
diff --git a/libjava/classpath/gnu/CORBA/SimpleDelegate.java b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
index c6e20e17374..cb0a7d6034d 100644
--- a/libjava/classpath/gnu/CORBA/SimpleDelegate.java
+++ b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
@@ -98,22 +98,31 @@ public class SimpleDelegate
}
/**
- * Not implemented.
- *
- * @throws NO_IMPLEMENT, always.
+ * Create the request for the local call
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
String operation, NVList parameters,
NamedValue returns
)
{
- throw new NO_IMPLEMENT();
+ if (orb instanceof OrbFunctional)
+ {
+ ((OrbFunctional) orb).ensureRunning();
+ }
+ gnuRequest g = new gnuRequest();
+ g.setORB(orb);
+ g.setOperation(operation);
+ g.setIor(ior);
+ g.m_target = target;
+ g.ctx(context);
+ g.set_args(parameters);
+ if (returns != null)
+ g.set_result(returns);
+ return g;
}
/**
- * Not implemented.
- *
- * @throws NO_IMPLEMENT, always.
+ * Create the request for the local call.
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
String operation, NVList parameters,
@@ -121,7 +130,22 @@ public class SimpleDelegate
ContextList ctx_list
)
{
- throw new NO_IMPLEMENT();
+ if (orb instanceof OrbFunctional)
+ {
+ ((OrbFunctional) orb).ensureRunning();
+ }
+ gnuRequest g = new gnuRequest();
+ g.setORB(orb);
+ g.setOperation(operation);
+ g.setIor(ior);
+ g.m_target = target;
+ g.ctx(context);
+ g.set_args(parameters);
+ g.set_exceptions(exceptions);
+ g.set_context_list(ctx_list);
+ if (returns != null)
+ g.set_result(returns);
+ return g;
}
/**