diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-05-23 11:59:44 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-05-23 11:59:44 +0200 |
commit | d81701ca8182942b7936f9fd84a019b695e9c890 (patch) | |
tree | dc036c9d701fbbe1afad67782bd78572c0f61974 /java/test/Ice/acm/RemoteCommunicatorI.java | |
parent | Fixed bug ICE-5543: stringToIdentity bug with escaped escapes (diff) | |
download | ice-d81701ca8182942b7936f9fd84a019b695e9c890.tar.bz2 ice-d81701ca8182942b7936f9fd84a019b695e9c890.tar.xz ice-d81701ca8182942b7936f9fd84a019b695e9c890.zip |
Added support for invocation timeouts and ACM heartbeats
Diffstat (limited to 'java/test/Ice/acm/RemoteCommunicatorI.java')
-rw-r--r-- | java/test/Ice/acm/RemoteCommunicatorI.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/java/test/Ice/acm/RemoteCommunicatorI.java b/java/test/Ice/acm/RemoteCommunicatorI.java new file mode 100644 index 00000000000..38cb0fc0384 --- /dev/null +++ b/java/test/Ice/acm/RemoteCommunicatorI.java @@ -0,0 +1,49 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.acm; + +import test.Ice.acm.Test.RemoteObjectAdapterPrx; +import test.Ice.acm.Test.RemoteObjectAdapterPrxHelper; +import test.Ice.acm.Test._RemoteCommunicatorDisp; + +public class RemoteCommunicatorI extends _RemoteCommunicatorDisp +{ + public RemoteObjectAdapterPrx + 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 name = java.util.UUID.randomUUID().toString(); + if(timeout >= 0) + { + properties.setProperty(name + ".ACM.Timeout", Integer.toString(timeout)); + } + if(close >= 0) + { + properties.setProperty(name + ".ACM.Close", Integer.toString(close)); + } + if(heartbeat >= 0) + { + properties.setProperty(name + ".ACM.Heartbeat", Integer.toString(heartbeat)); + } + properties.setProperty(name + ".ThreadPool.Size", "2"); + Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h 127.0.0.1"); + return RemoteObjectAdapterPrxHelper.uncheckedCast( + current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } +}; |