RecoverableExceptionSchedulableImpl.java :  » Inversion-of-Control » carbon » org » sape » carbon » services » scheduler » test » Java Open Source

Java Open Source » Inversion of Control » carbon 
carbon » org » sape » carbon » services » scheduler » test » RecoverableExceptionSchedulableImpl.java
/*
 * The contents of this file are subject to the Sapient Public License
 * Version 1.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * http://carbon.sf.net/License.html.
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is The Carbon Component Framework.
 *
 * The Initial Developer of the Original Code is Sapient Corporation
 *
 * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
 */

package org.sape.carbon.services.scheduler.test;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.sape.carbon.services.scheduler.UnrecoverableTaskException;

/**
 * Copyright 2002 Sapient
 * @since carbon 1.2
 * @author Douglas Voet, June 2002
 * @version $Revision: 1.8 $($Author: ghinkl $ / $Date: 2003/10/17 06:35:45 $)
 */
public class RecoverableExceptionSchedulableImpl
    implements SchedulableComponent {

    /**
     * Provides a handle to Apache-commons logger
     */
    private Log log = LogFactory.getLog(this.getClass());

    private SchedulerServiceTestListener listener;

    /**
     * @see SchedulableComponent#setListener(SchedulerServiceTestListener)
     */
    public void setListener(SchedulerServiceTestListener listener) {
        this.listener = listener;
    }

    public void doSpecializeTask() throws Exception {
        if (log.isTraceEnabled()) {
            log.trace("Running scheduled task");
        }
        this.listener.incrementSecondaryCount();
        throw new Exception("test exception");
    }

    /**
     * @see org.sape.carbon.services.scheduler.Schedulable#runScheduledTask()
     */
    public void runScheduledTask() throws Exception {
        if (log.isTraceEnabled()) {
            log.trace("Running scheduled task");
        }
        this.listener.incrementCount();
        throw new Exception("test exception");
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.