Cyberduck Mountain Duck CLI

Changeset 43638


Ignore:
Timestamp:
Jan 8, 2018 2:14:45 PM (4 months ago)
Author:
robot
Message:

Do not run scheduler feature in SessionBackgroundAction.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property subgit:lock changed from commit:46045ef8e5e264f579c33d102aa41c58315daaf2 timestamp:2018-01-08T09:34:54.883 to commit:8acd797996f195678f4772714c18beaec1f0c5e3 timestamp:2018-01-08T14:14:44.756
  • trunk/core/src/main/java/ch/cyberduck/core/features/Scheduler.java

    r42316 r43638  
    1717
    1818import ch.cyberduck.core.PasswordCallback;
    19 import ch.cyberduck.core.exception.BackgroundException;
    2019
    2120public interface Scheduler<R> {
    22     R repeat(PasswordCallback callback) throws BackgroundException;
     21    R repeat(PasswordCallback callback);
     22
    2323    void shutdown();
    2424
  • trunk/core/src/main/java/ch/cyberduck/core/shared/AbstractSchedulerFeature.java

    r42316 r43638  
    2222import ch.cyberduck.core.features.Scheduler;
    2323import ch.cyberduck.core.threading.ScheduledThreadPool;
    24 import ch.cyberduck.core.worker.DefaultExceptionMappingService;
    2524
    2625import org.apache.log4j.Logger;
    2726
    28 import java.util.concurrent.CountDownLatch;
    2927import java.util.concurrent.TimeUnit;
    3028
     
    3432    private final long period;
    3533    private final ScheduledThreadPool scheduler = new ScheduledThreadPool();
    36     private final CountDownLatch exit = new CountDownLatch(1);
    3734
    3835    public AbstractSchedulerFeature(final long period) {
     
    4340
    4441    @Override
    45     public R repeat(final PasswordCallback callback) throws BackgroundException {
     42    public R repeat(final PasswordCallback callback) {
    4643        scheduler.repeat(() -> {
    4744            try {
     
    5552            }
    5653        }, period, TimeUnit.MILLISECONDS);
    57         try {
    58             exit.await();
    59         }
    60         catch(InterruptedException e) {
    61             log.error(String.format("Error waiting for exit signal %s", e.getMessage()));
    62             throw new DefaultExceptionMappingService().map(e);
    63         }
    6454        return null;
    6555    }
     
    6858    public void shutdown() {
    6959        scheduler.shutdown();
    70         exit.countDown();
    7160    }
    7261}
  • trunk/core/src/main/java/ch/cyberduck/core/shared/DelegatingSchedulerFeature.java

    r42316 r43638  
    1717
    1818import ch.cyberduck.core.PasswordCallback;
    19 import ch.cyberduck.core.exception.BackgroundException;
    2019import ch.cyberduck.core.features.Scheduler;
    2120
     
    2928
    3029    @Override
    31     public Void repeat(final PasswordCallback callback) throws BackgroundException {
     30    public Void repeat(final PasswordCallback callback) {
    3231        for(Scheduler scheduler : features) {
    3332            scheduler.repeat(callback);
  • trunk/core/src/main/java/ch/cyberduck/core/shared/OneTimeSchedulerFeature.java

    r42316 r43638  
    2020import ch.cyberduck.core.exception.BackgroundException;
    2121
     22import org.apache.log4j.Logger;
     23
    2224public abstract class OneTimeSchedulerFeature<R> extends AbstractSchedulerFeature<R> {
     25
     26    private static final Logger log = Logger.getLogger(OneTimeSchedulerFeature.class);
    2327
    2428    private final Path file;
     
    3034
    3135    @Override
    32     public R repeat(final PasswordCallback callback) throws BackgroundException {
    33         return this.operate(callback, file);
     36    public R repeat(final PasswordCallback callback) {
     37        try {
     38            return this.operate(callback, file);
     39        }
     40        catch(BackgroundException e) {
     41            log.warn(String.format("Failure processing missing file keys. %s", e.getDetail()));
     42        }
     43        return null;
    3444    }
    3545}
  • trunk/osx/src/main/java/ch/cyberduck/ui/cocoa/controller/BrowserController.java

    r43527 r43638  
    4141import ch.cyberduck.core.editor.EditorFactory;
    4242import ch.cyberduck.core.exception.AccessDeniedException;
    43 import ch.cyberduck.core.exception.BackgroundException;
    4443import ch.cyberduck.core.features.Location;
    4544import ch.cyberduck.core.features.Move;
     
    6362import ch.cyberduck.core.threading.BrowserTransferBackgroundAction;
    6463import ch.cyberduck.core.threading.DefaultMainAction;
    65 import ch.cyberduck.core.threading.DisabledAlertCallback;
    6664import ch.cyberduck.core.threading.DisconnectBackgroundAction;
    67 import ch.cyberduck.core.threading.SessionBackgroundAction;
    6865import ch.cyberduck.core.threading.TransferBackgroundAction;
    6966import ch.cyberduck.core.threading.WindowMainAction;
     
    30233020                                scheduler = pool.getFeature(Scheduler.class);
    30243021                                if(scheduler != null) {
    3025                                     background(new SessionBackgroundAction<Object>(pool, new DisabledAlertCallback(),
    3026                                         new DisabledProgressListener(), new DisabledTranscriptListener()) {
    3027                                         @Override
    3028                                         public Object run(final Session<?> session) throws BackgroundException {
    3029                                             scheduler.repeat(PasswordCallbackFactory.get(BrowserController.this));
    3030                                             return null;
    3031                                         }
    3032                                     });
     3022                                    scheduler.repeat(PasswordCallbackFactory.get(BrowserController.this));
    30333023                                }
    30343024                            }
Note: See TracChangeset for help on using the changeset viewer.
swiss made software