Example #1
0
        public override int run(string[] args)
        {
            //
            // Create OA and servants
            //

            communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");

            Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost");

            Ice.Object   servant     = new MyObjectI();
            InterceptorI interceptor = new InterceptorI(servant);

            Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));

            oa.activate();

            Console.WriteLine("Collocation optimization on");
            int rs = run(prx, interceptor);

            if (rs == 0)
            {
                Console.WriteLine("Collocation optimization off");
                interceptor.clear();
                prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));
                rs  = run(prx, interceptor);

                if (rs == 0)
                {
                    Console.WriteLine("Now with AMD");
                    AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant);
                    prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor));
                    prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false));

                    rs = runAmd(prx, amdInterceptor);
                }
            }
            return(rs);
        }