summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-01-29 06:39:28 +0000
committerMark Spruiell <mes@zeroc.com>2002-01-29 06:39:28 +0000
commit3d14cbdab0c7ad30f0311b6dbf05852fdf21101f (patch)
treef65709aaac7ddb429ce3ba42ee3df6720d47e22a /java/test
parentbug fix (diff)
downloadice-3d14cbdab0c7ad30f0311b6dbf05852fdf21101f.tar.bz2
ice-3d14cbdab0c7ad30f0311b6dbf05852fdf21101f.tar.xz
ice-3d14cbdab0c7ad30f0311b6dbf05852fdf21101f.zip
adding server
Diffstat (limited to 'java/test')
-rw-r--r--java/test/Ice/objects/InitialI.java108
-rw-r--r--java/test/Ice/objects/Server.java59
2 files changed, 167 insertions, 0 deletions
diff --git a/java/test/Ice/objects/InitialI.java b/java/test/Ice/objects/InitialI.java
new file mode 100644
index 00000000000..f4b1c28a663
--- /dev/null
+++ b/java/test/Ice/objects/InitialI.java
@@ -0,0 +1,108 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+public final class InitialI extends Initial
+{
+ public
+ InitialI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _b1 = new B();
+ _b2 = new B();
+ _c = new C();
+ _d = new D();
+
+ _b1.a = _b2; // Cyclic reference to another B
+ _b1.b = _b1; // Self reference.
+ _b1.c = null; // Null reference.
+
+ _b2.a = _b2; // Self reference, using base.
+ _b2.b = _b1; // Cyclic reference to another B
+ _b2.c = _c; // Cyclic reference to a C.
+
+ _c.b = _b2; // Cyclic reference to a B.
+
+ _d.a = _b1; // Reference to a B.
+ _d.b = _b2; // Reference to a B.
+ _d.c = null; // Reference to a C.
+ }
+
+ public void
+ addFacetsToB1(Ice.Current current)
+ {
+ _b1.ice_addFacet(_b1, "b1");
+ _b1.ice_addFacet(_b2, "b2");
+ _b1.ice_addFacet(_c, "c");
+ _b1.ice_addFacet(_d, "d");
+ }
+
+ public void
+ getAll(BHolder b1, BHolder b2, CHolder c, DHolder d, Ice.Current current)
+ {
+ b1.value = _b1;
+ b2.value = _b2;
+ c.value = _c;
+ d.value = _d;
+ }
+
+ public B
+ getB1(Ice.Current current)
+ {
+ return _b1;
+ }
+
+ public B
+ getB2(Ice.Current current)
+ {
+ return _b2;
+ }
+
+ public C
+ getC(Ice.Current current)
+ {
+ return _c;
+ }
+
+ public D
+ getD(Ice.Current current)
+ {
+ return _d;
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ _adapter.getCommunicator().shutdown();
+
+ //
+ // Break cyclic dependencies
+ //
+ _b1.a = null;
+ _b1.b = null;
+ _b1.c = null;
+ _b1.ice_removeAllFacets();
+ _b2.a = null;
+ _b2.b = null;
+ _b2.c = null;
+ _b2.ice_removeAllFacets();
+ _c.b = null;
+ _c.ice_removeAllFacets();
+ _d.a = null;
+ _d.b = null;
+ _d.c = null;
+ _d.ice_removeAllFacets();
+ }
+
+ private Ice.ObjectAdapter _adapter;
+ private B _b1;
+ private B _b2;
+ private C _c;
+ private D _d;
+}
diff --git a/java/test/Ice/objects/Server.java b/java/test/Ice/objects/Server.java
new file mode 100644
index 00000000000..4e89f84d931
--- /dev/null
+++ b/java/test/Ice/objects/Server.java
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+public class Server
+{
+ private static int
+ run(String[] args, Ice.Communicator communicator)
+ {
+ String endpts = "default -p 12345 -t 2000";
+ Ice.ObjectAdapter adapter =
+ communicator.createObjectAdapterWithEndpoints("TestAdapter",
+ endpts);
+ Ice.Object object = new InitialI(adapter);
+ adapter.add(object, Ice.Util.stringToIdentity("initial"));
+ adapter.activate();
+ communicator.waitForShutdown();
+ return 0;
+ }
+
+ public static void
+ main(String[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+ try
+ {
+ communicator = Ice.Util.initialize(args);
+ status = run(args, communicator);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+
+ if (communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ status = 1;
+ }
+ }
+
+ System.exit(status);
+ }
+}