Skip to content

Commit

Permalink
Make AbstractTransferWorker thread safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylangisc committed Jul 5, 2018
1 parent 884ab2b commit e63970a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
import org.apache.log4j.Logger;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;

public abstract class AbstractTransferWorker extends TransferWorker<Boolean> {
Expand Down Expand Up @@ -106,7 +106,7 @@ public AbstractTransferWorker(final Transfer transfer, final TransferOptions opt
final ConnectionCallback connectionCallback, final PasswordCallback passwordCallback,
final NotificationService notification,
final Cache<TransferItem> cache) {
this(transfer, options, prompt, meter, error, progress, stream, connectionCallback, passwordCallback, notification, cache, new HashMap<TransferItem, TransferStatus>());
this(transfer, options, prompt, meter, error, progress, stream, connectionCallback, passwordCallback, notification, cache, new ConcurrentHashMap<TransferItem, TransferStatus>());
}

public AbstractTransferWorker(final Transfer transfer, final TransferOptions options,
Expand Down Expand Up @@ -220,8 +220,8 @@ public void message(final String message) {
transfer.post(source, destination, table, connectionCallback);
if(transfer.isReset()) {
notification.notify(transfer.isComplete() ?
String.format("%s complete", StringUtils.capitalize(transfer.getType().name())) :
"Transfer incomplete", transfer.getName());
String.format("%s complete", StringUtils.capitalize(transfer.getType().name())) :
"Transfer incomplete", transfer.getName());
}
sleep.release(lock);
table.clear();
Expand Down

0 comments on commit e63970a

Please sign in to comment.