diff options
author | Matthew Newhook <matthew@zeroc.com> | 2014-10-20 11:40:05 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2014-10-20 11:40:05 -0230 |
commit | b51469b41167fb86ae2059a15cf0475c53fdda7b (patch) | |
tree | fc85d6ca2efd89c67e1e4e7438f437c3e08313f4 /java/src/IceInternal/RetryQueue.java | |
parent | Fixed (ICE-5695) - IceSSL: misleading exception (diff) | |
download | ice-b51469b41167fb86ae2059a15cf0475c53fdda7b.tar.bz2 ice-b51469b41167fb86ae2059a15cf0475c53fdda7b.tar.xz ice-b51469b41167fb86ae2059a15cf0475c53fdda7b.zip |
Down with ant. From the gradle to the grave.
Diffstat (limited to 'java/src/IceInternal/RetryQueue.java')
-rw-r--r-- | java/src/IceInternal/RetryQueue.java | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/java/src/IceInternal/RetryQueue.java b/java/src/IceInternal/RetryQueue.java deleted file mode 100644 index 28c10b7bd48..00000000000 --- a/java/src/IceInternal/RetryQueue.java +++ /dev/null @@ -1,79 +0,0 @@ -// ********************************************************************** -// -// 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 IceInternal; - -public class RetryQueue -{ - RetryQueue(Instance instance) - { - _instance = instance; - } - - synchronized public void add(ProxyOutgoingAsyncBase outAsync, int interval) - { - if(_instance == null) - { - throw new Ice.CommunicatorDestroyedException(); - } - RetryTask task = new RetryTask(this, outAsync); - outAsync.cancelable(task); // This will throw if the request is canceled - task.setFuture(_instance.timer().schedule(task, interval, java.util.concurrent.TimeUnit.MILLISECONDS)); - _requests.add(task); - } - - synchronized public void destroy() - { - java.util.HashSet<RetryTask> keep = new java.util.HashSet<RetryTask>(); - for(RetryTask task : _requests) - { - if(!task.destroy()) - { - keep.add(task); - } - } - _requests = keep; - _instance = null; - - // - // Wait for the tasks to be executed, it shouldn't take long - // since they couldn't be canceled. If interrupted, we - // preserve the interrupt. - // - boolean interrupted = false; - while(!_requests.isEmpty()) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - interrupted = true; - } - } - if(interrupted) - { - Thread.currentThread().interrupt(); - } - } - - synchronized boolean remove(RetryTask task) - { - boolean removed = _requests.remove(task); - if(_instance == null && _requests.isEmpty()) - { - notify(); - } - return removed; - } - - private Instance _instance; - private java.util.HashSet<RetryTask> _requests = new java.util.HashSet<RetryTask>(); -} |