We use the following method to deploy our servant object to ice grid:
After my program startup, I can see these Adapters at IceGridGUI.Code:String perfix="CommonServer"; Properties props = Ice.Util.createProperties(); props.setProperty("Ice.Default.Locator", defaultLocator); props.setProperty("Ice.ImplicitContext", "PerThread"); props.setProperty("Ice.ProgramName", prefix + serverId); props.setProperty(prefix + "Adapter.ReplicaGroupId", prefix + "RepGroup"); props.setProperty(prefix + "Adapter.RegisterProcess", "0"); props.setProperty(prefix + "Adapter.ThreadPool.Size", "10"); props.setProperty(prefix + "Adapter.ThreadPool.SizeMax", "100"); props.setProperty(prefix + "Adapter.ThreadPool.SizeWarn", "100"); props.setProperty(prefix + "Adapter.AdapterId", prefix + serverId + "." + prefix + "Adapter"); props.setProperty(prefix + "Adapter.Endpoints", endPoints); InitializationData id = new InitializationData(); id.properties = props; communicator = Ice.Util.initialize(id); adapter = communicator.createObjectAdapter(prefix+ "Adapter"); Ice.Identity objectIdentity = communicator.stringToIdentity(servant.getObjectId()); adapter.add(servant.getServantObject(), objectIdentity); adapter.activate(); communicator.waitForShutdown();
When my program shutdown, It call the following methods to destroy or remove adapters from IceGrid registry:
We deploy three program instances with different AdapterId at the same ReplicaGroupId, and here is a problem:Code:adapter.deactivate(); adapter.destroy(); communicator.shutdown();
when I send kill -9 PROCESS_ID command to kill one instance of my program, it don't call the destroy method to remove adapters from ice registry. So there is a died adapter at ice registry. When PHP program trying to invoke the method of servant object, it wait for a long time to find the alive adapter from ice registry, and some times invoke fail.
So how to resolve this problem?
I want to develope a timer program to auto clear the died adapters, will anybody tell me how to?
Thanks!

Reply With Quote