javax.ejb.Timer.getInfo()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中javax.ejb.Timer.getInfo()方法的一些代码示例,展示了Timer.getInfo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.getInfo()方法的具体详情如下:
包路径:javax.ejb.Timer
类名称:Timer
方法名:getInfo

Timer.getInfo介绍

[英]Get the information associated with the timer at the time of creation.
[中]获取创建时与计时器关联的信息。

代码示例

代码示例来源:origin: javaee-samples/javaee7-samples

private void fireEvent(Timer timer) {
    pingEvent.fire(new Ping(timer.getInfo().toString()));
  }
}

代码示例来源:origin: javaee-samples/javaee7-samples

@Timeout
  public void programmaticTimout(Timer timer) {
    pingEvent.fire(new Ping(timer.getInfo().toString()));
  }
}

代码示例来源:origin: javaee-samples/javaee7-samples

@Schedules({
    @Schedule(hour = "*", minute = "*", second = "*/5", info = "Every 5 second timer"),
    @Schedule(hour = "*", minute = "*", second = "*/10", info = "Every 10 second timer")
})
public void automaticallyScheduled(Timer timer) {
  pingEvent.fire(new Ping(timer.getInfo().toString()));
}

代码示例来源:origin: javaee-samples/javaee7-samples

@Schedule(hour = "*", minute = "*", second = "*/5", info = "Every 5 second timer")
public void printDate() {
  Collection<Timer> timers = ctx.getTimerService().getAllTimers();
  for (Timer t : timers) {
    pingEvent.fire(new Ping(t.getInfo().toString()));
  }
}

代码示例来源:origin: org.jboss.seam/jboss-seam

public Object call() 
  {
    return timer.getInfo();
  }
});

代码示例来源:origin: IQSS/dataverse

public List<HarvestTimerInfo> getHarvestTimers() {
  ArrayList <HarvestTimerInfo>timers = new ArrayList<>();
  
  for (Iterator it = timerService.getTimers().iterator(); it.hasNext();) {
    Timer timer = (Timer) it.next();
    if (timer.getInfo() instanceof HarvestTimerInfo) {
      HarvestTimerInfo info = (HarvestTimerInfo) timer.getInfo();
      timers.add(info);
    }
  }    
  return timers;
}

代码示例来源:origin: agoncal/agoncal-book-javaee7

@Timeout
 public void sendBirthdayEmail(Timer timer) {
  Customer04 customer = (Customer04) timer.getInfo();
  // ...
 }
}

代码示例来源:origin: com.evasion/Plugin-GeoLoc

private Timer getImportTimer() {
  for (Object obj : timerService.getTimers()) {
    Timer timer = (Timer) obj;
    String scheduled = (String) timer.getInfo();
    if (scheduled.equals(Constante.IMPORT_TIMER_NAME)) {
      return timer;
    }
  }
  return null;
}

代码示例来源:origin: be.fedict.eid-dss/eid-dss-model

public void cancelTimers() {
  Collection<Timer> timers = this.timerService.getTimers();
  for (Timer timer : timers) {
    if (timer.getInfo() != null) {
      if (timer.getInfo().equals(TIMER_ID)) {
        timer.cancel();
        LOG.debug("cancel timer: " + TIMER_ID);
      }
    }
  }
}

代码示例来源:origin: org.lorislab.armonitor/armonitor-ejb

/**
 * Gets the timer.
 *
 * @return the timer.
 */
public Timer getTimer() {
  Collection<Timer> timers = timerService.getTimers();
  for (Timer timer : timers) {
    if (TIMER_INFO.equals(timer.getInfo())) {
      return timer;
    }
  }
  return null;
}

代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-model

/**
 * {@inheritDoc}
 */
public void cancelTimers(String timerInfo) {
  Collection<Timer> timers = this.timerService.getTimers();
  for (Timer timer : timers) {
    if (timer.getInfo() != null) {
      if (timer.getInfo().equals(timerInfo)) {
        timer.cancel();
        LOG.debug("cancel timer: " + timerInfo);
      }
    }
  }
}

代码示例来源:origin: org.rhq/rhq-enterprise-server

@Timeout
  public void handleAvailabilityDurationCheck(Timer timer) {
    try {
      AlertAvailabilityDurationJob.execute((HashMap<String, String>) timer.getInfo());
    } catch (Throwable t) {
      log.error("Failed to handle availability duration timer - will try again later. Cause: " + t);
    }
  }
}

代码示例来源:origin: org.jboss.seam/jboss-seam

@Timeout
public void dispatch(Timer timer)
{
 ( (Asynchronous) timer.getInfo() ).execute(timer);
}

代码示例来源:origin: org.ow2.jasmine.monitoring/eventswitch-db-ejb

/**
 * Timeout handle method to be triggered every x times by EJB Timer service
 * of the application server.
 *
 * @param timer
 */
@Timeout
public void handleTimeout(final Timer timer) {
  deleteEventsFromDB(timer.getInfo());
}

代码示例来源:origin: org.apache.openejb/openejb-itests-beans

public void ejbTimeout(final Timer timer) {
  testAllowedOperations("ejbTimeout");
  try {
    final String name = (String) timer.getInfo();
    final TimerSync timerSync = (TimerSync) ejbContext.lookup("TimerSyncBeanBusinessRemote");
    timerSync.countDown(name);
  } catch (final Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-beans

public void ejbTimeout(Timer timer) {
  testAllowedOperations("ejbTimeout");
  try {
    String name = (String) timer.getInfo();
    TimerSync timerSync = (TimerSync) ejbContext.lookup("TimerSyncBeanBusinessRemote");
    timerSync.countDown(name);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@AroundTimeout
  public Object interceptTimeout(InvocationContext ctx) throws Exception {
    if (((String) ((Timer) ctx.getTimer()).getInfo()).equals("some info")) {
      timerOK = true;
    }
    TransactionSynchronizationRegistry tsr;
    try {
      tsr = (TransactionSynchronizationRegistry) InitialContext.doLookup("java:comp/TransactionSynchronizationRegistry");
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
    key = tsr.getTransactionKey();

    return ctx.proceed();
  }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-beans

public void ejbTimeout(final Timer timer) {
  testAllowedOperations("ejbTimeout");
  try {
    final String name = (String) timer.getInfo();
    final TimerSync timerSync = (TimerSync) ejbContext.lookup("TimerSyncBeanBusinessRemote");
    timerSync.countDown(name);
  } catch (final Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-beans

public void ejbTimeout(Timer timer) {
  testAllowedOperations("ejbTimeout");
  try {
    String name = (String) timer.getInfo();
    TimerSync timerSync = (TimerSync) ejbContext.lookup("TimerSyncBeanBusinessRemote");
    timerSync.countDown(name);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.ow2.jasmine.monitoring/eventswitch-db-ejb

/**
 * Remove a timer corresponding to a purge task.
 * @param bean
 */
private void removeTask(final JasmineEventPurgeTaskEB bean) {
  Collection timers = timerService.getTimers();
  for (Iterator<Timer> it = timers.iterator(); it.hasNext();) {
    Timer timer = it.next();
    if (Long.parseLong(timer.getInfo().toString()) == bean.getId()) {
      timer.cancel();
    }
  }
  bean.setStarted(false);
  logger.info("[DataManagement] Purge Task removed : " + bean.getId());
}

相关文章