summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2009-07-02 19:39:13 +0200
committerJose <jose@zeroc.com>2009-07-02 19:39:13 +0200
commitb288490bceaab7f9c20eb9de62fa7a7ff4f6a917 (patch)
tree8645fb6933ced669886f71f415eb57f676912ebf /java
parentFixed test failure introduce by previous fix (diff)
downloadice-b288490bceaab7f9c20eb9de62fa7a7ff4f6a917.tar.bz2
ice-b288490bceaab7f9c20eb9de62fa7a7ff4f6a917.tar.xz
ice-b288490bceaab7f9c20eb9de62fa7a7ff4f6a917.zip
Bug 2564 - ObjectAdapter::removeServantLocator
Diffstat (limited to 'java')
-rw-r--r--java/src/Ice/ObjectAdapterI.java8
-rw-r--r--java/src/IceInternal/ServantManager.java13
-rw-r--r--java/test/Ice/servantLocator/AMDServer.java1
-rw-r--r--java/test/Ice/servantLocator/AllTests.java30
-rw-r--r--java/test/Ice/servantLocator/Collocated.java2
-rw-r--r--java/test/Ice/servantLocator/Server.java1
-rw-r--r--java/test/Ice/servantLocator/Test.ice5
-rw-r--r--java/test/Ice/servantLocator/TestAMD.ice5
8 files changed, 64 insertions, 1 deletions
diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java
index 8fbfb2bc4f8..62589a5bad7 100644
--- a/java/src/Ice/ObjectAdapterI.java
+++ b/java/src/Ice/ObjectAdapterI.java
@@ -512,6 +512,14 @@ public final class ObjectAdapterI implements ObjectAdapter
}
public synchronized ServantLocator
+ removeServantLocator(String prefix)
+ {
+ checkForDeactivation();
+
+ return _servantManager.removeServantLocator(prefix);
+ }
+
+ public synchronized ServantLocator
findServantLocator(String prefix)
{
checkForDeactivation();
diff --git a/java/src/IceInternal/ServantManager.java b/java/src/IceInternal/ServantManager.java
index ba3c1f80cac..01ded95ffd0 100644
--- a/java/src/IceInternal/ServantManager.java
+++ b/java/src/IceInternal/ServantManager.java
@@ -227,6 +227,19 @@ public final class ServantManager
}
public synchronized Ice.ServantLocator
+ removeServantLocator(String category)
+ {
+ assert(_instance != null); // Must not be called after destruction.
+
+ Ice.ServantLocator l = _locatorMap.remove(category);
+ if(l != null)
+ {
+ l.deactivate(category);
+ }
+ return l;
+ }
+
+ public synchronized Ice.ServantLocator
findServantLocator(String category)
{
//
diff --git a/java/test/Ice/servantLocator/AMDServer.java b/java/test/Ice/servantLocator/AMDServer.java
index 2234ff7c4e7..3a91b15cabc 100644
--- a/java/test/Ice/servantLocator/AMDServer.java
+++ b/java/test/Ice/servantLocator/AMDServer.java
@@ -18,6 +18,7 @@ public class AMDServer extends test.Util.Application
adapter.addServantLocator(new AMDServantLocatorI("category"), "category");
adapter.addServantLocator(new AMDServantLocatorI(""), "");
adapter.add(new AMDTestI(), communicator().stringToIdentity("asm"));
+ adapter.add(new AMDTestActivationI(), communicator().stringToIdentity("test/activation"));
adapter.activate();
return WAIT;
}
diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java
index 16c0450f5d5..b9ab0ea648f 100644
--- a/java/test/Ice/servantLocator/AllTests.java
+++ b/java/test/Ice/servantLocator/AllTests.java
@@ -14,6 +14,9 @@ import java.io.PrintWriter;
import test.Ice.servantLocator.Test.TestImpossibleException;
import test.Ice.servantLocator.Test.TestIntfPrx;
import test.Ice.servantLocator.Test.TestIntfPrxHelper;
+import test.Ice.servantLocator.Test.TestActivationPrx;
+import test.Ice.servantLocator.Test.TestActivationPrxHelper;
+
import Ice.ObjectNotExistException;
import Ice.ObjectPrx;
import Ice.UnknownException;
@@ -286,6 +289,33 @@ public class AllTests
testExceptions(obj, collocated);
out.println("ok");
+ out.print("testing servant locator removal... ");
+ out.flush();
+ base = communicator.stringToProxy("test/activation:default -p 12010");
+ TestActivationPrx activation = TestActivationPrxHelper.checkedCast(base);
+ activation.activateServantLocator(false);
+ try
+ {
+ obj.ice_ping();
+ test(false);
+ }
+ catch(ObjectNotExistException ex)
+ {
+ out.println("ok");
+ }
+ out.print("testing servant locator addition... ");
+ out.flush();
+ activation.activateServantLocator(true);
+ try
+ {
+ obj.ice_ping();
+ out.println("ok");
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+
return obj;
}
}
diff --git a/java/test/Ice/servantLocator/Collocated.java b/java/test/Ice/servantLocator/Collocated.java
index d47f4459683..be026ac8aa0 100644
--- a/java/test/Ice/servantLocator/Collocated.java
+++ b/java/test/Ice/servantLocator/Collocated.java
@@ -17,7 +17,7 @@ public class Collocated extends test.Util.Application
adapter.addServantLocator(new ServantLocatorI("category"), "category");
adapter.addServantLocator(new ServantLocatorI(""), "");
adapter.add(new TestI(), communicator().stringToIdentity("asm"));
-
+ adapter.add(new TestActivationI(), communicator().stringToIdentity("test/activation"));
AllTests.allTests(communicator(), true, getWriter());
return 0;
diff --git a/java/test/Ice/servantLocator/Server.java b/java/test/Ice/servantLocator/Server.java
index b349abdca3f..f88bfb5b9b4 100644
--- a/java/test/Ice/servantLocator/Server.java
+++ b/java/test/Ice/servantLocator/Server.java
@@ -17,6 +17,7 @@ public class Server extends test.Util.Application
adapter.addServantLocator(new ServantLocatorI("category"), "category");
adapter.addServantLocator(new ServantLocatorI(""), "");
adapter.add(new TestI(), communicator().stringToIdentity("asm"));
+ adapter.add(new TestActivationI(), communicator().stringToIdentity("test/activation"));
adapter.activate();
return WAIT;
}
diff --git a/java/test/Ice/servantLocator/Test.ice b/java/test/Ice/servantLocator/Test.ice
index 9acfa468f51..977c6cbd19f 100644
--- a/java/test/Ice/servantLocator/Test.ice
+++ b/java/test/Ice/servantLocator/Test.ice
@@ -38,6 +38,11 @@ interface TestIntf
void shutdown();
};
+interface TestActivation
+{
+ void activateServantLocator(bool activate);
+};
+
local class Cookie
{
["cpp:const"] string message();
diff --git a/java/test/Ice/servantLocator/TestAMD.ice b/java/test/Ice/servantLocator/TestAMD.ice
index cd1f2a9eedf..1750cb352f3 100644
--- a/java/test/Ice/servantLocator/TestAMD.ice
+++ b/java/test/Ice/servantLocator/TestAMD.ice
@@ -38,6 +38,11 @@ exception TestImpossibleException
void shutdown();
};
+interface TestActivation
+{
+ void activateServantLocator(bool activate);
+};
+
local class Cookie
{
["cpp:const"] string message();