Skip to content

Commit

Permalink
Fix #5624.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 10, 2011
1 parent 35d37f2 commit be5565e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions source/ch/cyberduck/core/Queue.java
Expand Up @@ -77,16 +77,20 @@ public void add(final Transfer t) {
// The maximum number of transfers is already reached
try {
boolean offer = false;
while(!offer && !t.isCanceled()) {
// Wait for transfer slot.
while(!offer || running.size() >= Preferences.instance().getInteger("queue.maxtransfers")) {
if(t.isCanceled()) {
break;
}
// Wait for transfer slot. We don't use ArrayBlockingQueue#put because the
// transer can be canceled while waiting for a slot.
offer = overflow.offer(t, 1, TimeUnit.SECONDS);
}
}
catch(InterruptedException e) {
log.error(e.getMessage());
}
if(log.isInfoEnabled()) {
log.info("released from queue:" + t);
log.info("Released from queue:" + t);
}
t.fireTransferResumed();
}
Expand Down

0 comments on commit be5565e

Please sign in to comment.