Example #1
0
    createObjectAdapter(string name, string endpts, Ice.Current current)
    {
        int retry = 5;

        while (true)
        {
            try
            {
                string endpoints = endpts;
                if (endpoints.IndexOf("-p") < 0)
                {
                    endpoints = _app.getTestEndpoint(_nextPort++, endpoints);
                }

                Ice.Communicator com = current.adapter.getCommunicator();
                com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
                Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
                return(RemoteObjectAdapterPrxHelper.uncheckedCast(
                           current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))));
            }
            catch (Ice.SocketException)
            {
                if (--retry == 0)
                {
                    throw;
                }
            }
        }
    }
Example #2
0
    createObjectAdapter(int timeout, int close, int heartbeat, Ice.Current current)
    {
        Ice.Communicator com        = current.adapter.getCommunicator();
        Ice.Properties   properties = com.getProperties();
        string           protocol   = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
        string           host       = properties.getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");

        string name = System.Guid.NewGuid().ToString();

        if (timeout >= 0)
        {
            properties.setProperty(name + ".ACM.Timeout", timeout.ToString());
        }
        if (close >= 0)
        {
            properties.setProperty(name + ".ACM.Close", close.ToString());
        }
        if (heartbeat >= 0)
        {
            properties.setProperty(name + ".ACM.Heartbeat", heartbeat.ToString());
        }
        properties.setProperty(name + ".ThreadPool.Size", "2");
        Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h \"" + host + "\"");
        return(RemoteObjectAdapterPrxHelper.uncheckedCast(current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))));
    }
Example #3
0
    createObjectAdapter(string name, string endpts, Ice.Current current)
    {
        string endpoints = endpts;

        if (endpoints.IndexOf("-p") < 0)
        {
            // Use a fixed port if none is specified (bug 2896)
            endpoints = endpoints + " -h 127.0.0.1 -p " + _nextPort++;
        }

        Ice.Communicator com = current.adapter.getCommunicator();
        com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
        Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
        return(RemoteObjectAdapterPrxHelper.uncheckedCast(
                   current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))));
    }