Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.javaswift.joss.swift.scheduled;
 
 
 import java.util.*;
public class ObjectDeleter implements Runnable {
    public static final Logger LOG = LoggerFactory.getLogger(ObjectDeleter.class);
    public ObjectDeleter(int startAfterint intervalInSeconds) {
        .debug("OD.init: "+startAfter+"/"+intervalInSeconds);
        this. = Executors.newScheduledThreadPool(1);
        this..scheduleAtFixedRate(thisstartAfterintervalInSeconds.);
    }
    public void scheduleForDeletion(SwiftContainer containerSwiftStoredObject objectDate deleteAt) {
        .debug("OD.schedule");
        .add(new ScheduledForDeletion(containerobjectdeleteAt));
    }
    public boolean isShutdown() {
        return this..isShutdown();
    }
    public void shutdown() {
        .debug("OD.shutdown");
        this..shutdown();
    }
    public void run() {
        .debug("OD.run");
        Date now = LocalTime.currentDate();
        List<ScheduledForDeletionobjectsToDeleteNow = new ArrayList<ScheduledForDeletion>();
        for (ScheduledForDeletion scheduledForDeletion : ) {
            if (scheduledForDeletion.deleteIf(now)) {
                scheduledForDeletion.getContainer().deleteObject(scheduledForDeletion.getObjectName());
                objectsToDeleteNow.add(scheduledForDeletion);
            }
        }
        .removeAll(objectsToDeleteNow);
        if (.size() == 0) {
            shutdown();
        }
    }
New to GrepCode? Check out our FAQ X