diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-04-06 20:35:19 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-04-06 20:35:19 +0000 |
commit | eca774e2010a94c124e0a04c53356bb0b6e57b63 (patch) | |
tree | c7a0bfe4fbfd38c91accac649630fdc909947aad /java/test/Ice/timeout/TimeoutI.java | |
parent | fixing comment (diff) | |
download | ice-eca774e2010a94c124e0a04c53356bb0b6e57b63.tar.bz2 ice-eca774e2010a94c124e0a04c53356bb0b6e57b63.tar.xz ice-eca774e2010a94c124e0a04c53356bb0b6e57b63.zip |
adding timeout test
Diffstat (limited to 'java/test/Ice/timeout/TimeoutI.java')
-rw-r--r-- | java/test/Ice/timeout/TimeoutI.java | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/java/test/Ice/timeout/TimeoutI.java b/java/test/Ice/timeout/TimeoutI.java new file mode 100644 index 00000000000..d7767f29703 --- /dev/null +++ b/java/test/Ice/timeout/TimeoutI.java @@ -0,0 +1,75 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2006 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. +// +// ********************************************************************** + +import Test.*; + +class TimeoutI extends _TimeoutDisp +{ + static class ActivateAdapterThread extends Thread + { + ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout) + { + _adapter = adapter; + _timeout = timeout; + } + + public void + run() + { + _adapter.waitForHold(); + try + { + sleep(_timeout); + } + catch(InterruptedException ex) + { + } + _adapter.activate(); + } + + Ice.ObjectAdapter _adapter; + int _timeout; + } + + public void + op(Ice.Current current) + { + } + + public void + sendData(byte[] seq, Ice.Current current) + { + } + + public void + sleep(int to, Ice.Current current) + { + try + { + Thread.currentThread().sleep(to); + } + catch(InterruptedException ex) + { + } + } + + public void + holdAdapter(int to, Ice.Current current) + { + current.adapter.hold(); + Thread thread = new ActivateAdapterThread(current.adapter, to); + thread.start(); + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } +} |