Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
/*
 * Created on 06.11.2003
 *
 */
package at.spardat.xma.boot.cleanup;

Author(s):
s3595
public class Cleaner {
    /* default initial cleanup is 15 minutes (value in seconds) */
    private static int DEFAULT_INITAL_CLEANUP_DELAY_MILLISEC = 900 * 1000;
    /* default cleanup cache interval is 3 hours (value in seconds) */
    private static int DEFAULT_CLEANUP_INTERVAL_MILLISEC = 10800 * 1000;
    private Logger log_;

    
configuration properties
    private Properties props;
    /* cleanup timer */
    private Timer cleanupTimer;
    public CleanerBootRuntime runtime ) {
         = runtime.getConfigProperties();
         = Logger.getLogger"boot.cleaner");
    }
    public Properties getProperties( ) {
        return ;
    }
    public void startCleanup() {
        try {
             = new Timer(true);
            long initialDelayMilliSec  = ;
            long cleanupIntervalMilliSec = ;
            try {
                String strInitalDelay = .getProperty(.);
                initialDelayMilliSec          = Integer.parseInt(strInitalDelay) * 1000;
                if(initialDelayMilliSec<=0) initialDelayMilliSec = ;
                String strCleanupInterval = .getProperty(.);
                cleanupIntervalMilliSec          = Integer.parseInt(strCleanupInterval) * 1000;
                if(cleanupIntervalMilliSec<=0) cleanupIntervalMilliSec = ;
            } catch (Exception e) {
                .log(."Could not read Properties: " + . + ", " + .e );
            }
            .schedule(new CleanerDeamon(this), initialDelayMilliSeccleanupIntervalMilliSec);
            .log(."cleaner deamon initialized. first run: {0} interval: {1}"new Object[] { new Long(initialDelayMilliSec), new Long(cleanupIntervalMilliSec) });
        } catchException ex) {
            .log(."Error schedule/initialize cleaner deamon" ,ex );
        }
    }
New to GrepCode? Check out our FAQ X