Пример #1
0
        public override void Run(string[] args)
        {
            //
            // Register the server manager. The server manager creates a new
            // 'server'(a server isn't a different process, it's just a new
            // communicator and object adapter).
            //
            Dictionary <string, string> properties = CreateTestProperties(ref args);

            properties["Ice.ThreadPool.Server.Size"] = "2";

            using Communicator communicator = Initialize(properties);
            communicator.SetProperty("ServerManagerAdapter.Endpoints", GetTestEndpoint(0));
            ObjectAdapter adapter = communicator.CreateObjectAdapter("ServerManagerAdapter");
            //
            // We also register a sample server locator which implements the
            // locator interface, this locator is used by the clients and the
            // 'servers' created with the server manager interface.
            //
            var registry = new ServerLocatorRegistry();
            var obj      = new ServerManager(registry, this);

            adapter.Add("ServerManager", obj);
            registry.AddObject(adapter.CreateProxy("ServerManager", IObjectPrx.Factory));
            ILocatorRegistryPrx registryPrx = adapter.Add("registry", registry, ILocatorRegistryPrx.Factory);

            adapter.Add("locator", new ServerLocator(registry, registryPrx));

            adapter.Activate();
            ServerReady();
            communicator.WaitForShutdown();
        }
Пример #2
0
        internal TestIntf(ObjectAdapter adapter1, ObjectAdapter adapter2, ServerLocatorRegistry registry)
        {
            _adapter1 = adapter1;
            _adapter2 = adapter2;
            _registry = registry;

            _registry.AddObject(_adapter1.Add("hello", new Hello(), IObjectPrx.Factory));
        }