Example usage for javax.ejb Timer toString

List of usage examples for javax.ejb Timer toString

Introduction

In this page you can find the example usage for javax.ejb Timer toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.rhq.enterprise.server.cloud.instance.CacheConsistencyManagerBean.java

@SuppressWarnings("unchecked")
public void scheduleServerCacheReloader() {
    /* each time the webapp is reloaded, it would create 
     * duplicate events if we don't cancel the existing ones
     *///from   w w  w .j a  v  a2  s .c  om
    Collection<Timer> timers = timerService.getTimers();
    for (Timer existingTimer : timers) {
        log.debug("Found timer - attempting to cancel: " + existingTimer.toString());
        try {
            existingTimer.cancel();
        } catch (Exception e) {
            log.warn("Failed in attempting to cancel timer: " + existingTimer.toString());
        }
    }

    // single-action timer that will trigger in 30 seconds
    timerService.createTimer(30000, TIMER_DATA);
}

From source file:org.rhq.enterprise.server.cloud.instance.ServerManagerBean.java

@SuppressWarnings("unchecked")
public void scheduleServerHeartbeat() {
    /* each time the webapp is reloaded, it would create 
     * duplicate events if we don't cancel the existing ones
     *//*from   w  w w. jav a2 s.  c  o m*/
    Collection<Timer> timers = timerService.getTimers();
    for (Timer existingTimer : timers) {
        log.debug("Found timer - attempting to cancel: " + existingTimer.toString());
        try {
            existingTimer.cancel();
        } catch (Exception e) {
            log.warn("Failed in attempting to cancel timer: " + existingTimer.toString());
        }
    }
    // single-action timer that will trigger in 30 seconds
    timerService.createTimer(30000, TIMER_DATA);
}

From source file:org.rhq.enterprise.server.storage.StorageClientManager.java

public void scheduleStorageSessionMaintenance() {
    // each time the webapp is reloaded, we don't want to create duplicate jobs
    Collection<Timer> timers = timerService.getTimers();
    for (Timer existingTimer : timers) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Found timer - attempting to cancel: " + existingTimer.toString());
        }// w w  w .  j  a v  a2 s  .  c o  m
        try {
            existingTimer.cancel();
        } catch (Exception e) {
            LOG.warn("Failed in attempting to cancel timer: " + existingTimer.toString());
        }
    }

    // timer that will trigger every 90 seconds after an initial wait of 30 seconds
    timerService.createIntervalTimer(30000L, 90000L, new TimerConfig(null, false));
}

From source file:org.rhq.enterprise.server.system.SystemManagerBean.java

@SuppressWarnings("unchecked")
public void scheduleConfigCacheReloader() {
    // each time the webapp is reloaded, we don't want to create duplicate jobs
    Collection<Timer> timers = timerService.getTimers();
    for (Timer existingTimer : timers) {
        log.debug("Found timer - attempting to cancel: " + existingTimer.toString());
        try {//from w  w  w  .  j a v a  2  s  . co  m
            existingTimer.cancel();
        } catch (Exception e) {
            log.warn("Failed in attempting to cancel timer: " + existingTimer.toString());
        }
    }

    // single-action timer that will trigger in 60 seconds
    timerService.createTimer(60000L, TIMER_DATA);
}