Ejemplo n.º 1
0
    public override int 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).
        //
        Ice.Properties properties = communicator().getProperties();
        properties.setProperty("Ice.ThreadPool.Server.Size", "2");
        properties.setProperty("ServerManagerAdapter.Endpoints", getTestEndpoint(0) + ":udp");

        Ice.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.
        //
        ServerLocatorRegistry registry = new ServerLocatorRegistry();

        Ice.Object @object = new ServerManagerI(registry, _initData, this);
        adapter.add(@object, Ice.Util.stringToIdentity("ServerManager"));
        registry.addObject(adapter.createProxy(Ice.Util.stringToIdentity("ServerManager")));
        Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
            adapter.add(registry, Ice.Util.stringToIdentity("registry")));

        ServerLocator locator = new ServerLocator(registry, registryPrx);

        adapter.add(locator, Ice.Util.stringToIdentity("locator"));

        adapter.activate();
        communicator().waitForShutdown();

        return(0);
    }
Ejemplo n.º 2
0
    private static int run(string[] args, Ice.Communicator communicator,
        Ice.InitializationData initData)
    {
        //
        // 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).
        //
        Ice.Properties properties = communicator.getProperties();
        properties.setProperty("Ice.ThreadPool.Server.Size", "2");
        properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");

        Ice.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.
        //
        ServerLocatorRegistry registry = new ServerLocatorRegistry();
        Ice.Object @object = new ServerManagerI(registry, initData);
        adapter.add(@object, communicator.stringToIdentity("ServerManager"));
        registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager")));
        Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
                                                adapter.add(registry, communicator.stringToIdentity("registry")));

        ServerLocator locator = new ServerLocator(registry, registryPrx);
        adapter.add(locator, communicator.stringToIdentity("locator"));

        adapter.activate();
        communicator.waitForShutdown();

        return 0;
    }
Ejemplo n.º 3
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).
            //
            var properties = createTestProperties(ref args);

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

            using (var 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.
                //
                ServerLocatorRegistry registry = new ServerLocatorRegistry();
                var obj = new ServerManagerI(registry, this);
                adapter.Add(obj, "ServerManager");
                registry.addObject(adapter.CreateProxy("ServerManager"));
                LocatorRegistryPrx registryPrx = adapter.Add(registry, "registry");
                adapter.Add(new ServerLocator(registry, registryPrx), "locator");

                adapter.Activate();
                serverReady();
                communicator.waitForShutdown();
            }
        }