In page 733 of Ice 3.1.0 manul:
However, the following code throws an exception:Code:... Once an adapter has been deactivated, you can reactivate it again. Any attempt to use a deactivated object adapter results in an ObjectAdapterDeactivatedException. ...
The exception is as follows:Code:public class Server { public static void main(String[] args) { int status = 0; Ice.Communicator ic = null; try { ic = Ice.Util.initialize(args); Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints( "SimplePrinterAdapter", "default -p 10000"); Ice.Object object = new PrinterI(); adapter.add(object, ic.stringToIdentity("SimplePrinter")); System.out.println("1...."); adapter.activate(); System.out.println("2...."); adapter.deactivate(); System.out.println("3...."); adapter.activate(); //adapter.hold(); //error System.out.println("4...."); ic.waitForShutdown(); } catch (Ice.LocalException e) { e.printStackTrace(); status = 1; } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } if (ic != null) { // Clean up // try { ic.destroy(); } catch (Exception e) { System.err.println(e.getMessage()); status = 1; } } System.exit(status); } }
Code:D:\>java Server 1.... 2.... 3.... Ice.ObjectAdapterDeactivatedException name = "SimplePrinterAdapter" at Ice.ObjectAdapterI.checkForDeactivation(ObjectAdapterI.java:946) at Ice.ObjectAdapterI.activate(ObjectAdapterI.java:40) at Server.main(Server.java:25)

Reply With Quote