Example usage for java.util TimerTask toString

List of usage examples for java.util TimerTask toString

Introduction

In this page you can find the example usage for java.util TimerTask toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.openadaptor.core.adaptor.AdaptorRunConfiguration.java

private void scheduleTask(Adaptor adaptor, long delayMs, TimerTask task) {
    if (timer == null) {
        timer = new Timer();
    }/*w  ww .  ja v  a2  s  . c om*/
    log.info("scheduled " + task.toString() + " for " + delayMs + "ms time");
    timer.schedule(task, delayMs);
}

From source file:org.openadaptor.core.adaptor.AdaptorRunConfiguration.java

private Date scheduleTask(Adaptor adaptor, String cronExpression, TimerTask task, Date currentTime) {
    try {/*ww w .  jav a2 s . c  o m*/
        if (timer == null) {
            timer = new Timer();
        }
        CronExpression cron = new CronExpression(cronExpression);
        Date time = cron.getTimeAfter(currentTime == null ? new Date() : currentTime);
        log.info("scheduled " + task.toString() + " for " + time);
        timer.schedule(task, time);
        return time;
    } catch (Exception e) {
        throw new RuntimeException("failed to schedule task", e);
    }
}