本文整理了Java中javax.ejb.Timer.cancel()
方法的一些代码示例,展示了Timer.cancel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.cancel()
方法的具体详情如下:
包路径:javax.ejb.Timer
类名称:Timer
方法名:cancel
[英]Cause the timer and all its associated expiration notifications to be canceled.
[中]导致计时器及其所有相关过期通知被取消。
代码示例来源:origin: org.jboss.seam/jboss-seam
public Object call()
{
timer.cancel();
return null;
}
});
代码示例来源:origin: org.jbpm/jbpm-services-cdi
@PreDestroy
public void shutdown() {
if (timer != null) {
try {
timer.cancel();
} catch (NoSuchObjectLocalException e) {
logger.debug("Timer {} is already canceled or expired", timer);
}
}
}
代码示例来源:origin: org.jbpm/jbpm-services-ejb-impl
@PreDestroy
public void shutdown() {
if (timer != null) {
try {
timer.cancel();
} catch (NoSuchObjectLocalException e) {
logger.debug("Timer {} is already canceled or expired", timer);
}
}
}
代码示例来源:origin: IQSS/dataverse
public void removeAllTimers() {
logger.info("Removing ALL existing timers.");
int i = 0;
for (Iterator it = timerService.getTimers().iterator(); it.hasNext();) {
Timer timer = (Timer) it.next();
logger.info("Removing timer " + i + ";");
timer.cancel();
i++;
}
logger.info("Done!");
}
代码示例来源:origin: org.lorislab.armonitor/armonitor-ejb
/**
* Stop the timer.
*/
public void stop() {
Timer timer = getTimer();
if (timer != null) {
timer.cancel();
LOGGER.log(Level.INFO, "The timer {0} was cancelled.", TIMER_INFO);
} else {
LOGGER.log(Level.INFO, "The timer {0} is not running.", TIMER_INFO);
}
}
代码示例来源:origin: org.ow2.jasmine.monitoring/eventswitch-db-ejb
/**
* Cancel all timers.
*/
@SuppressWarnings("unchecked")
private void cancelAllTimers() {
Collection<Timer> timers = timerService.getTimers();
for (Iterator<Timer> it = timers.iterator(); it.hasNext();) {
Timer timer = it.next();
timer.cancel();
}
timers.clear();
}
代码示例来源:origin: net.sf.tsl2nano/tsl2.nano.serviceaccess
/**
* {@inheritDoc}
*/
@Override
public void disposeScheduleJob(TimerHandle timerHandle) {
Job<RUNNABLE> job = getJob(timerHandle);
if (job != null) {
LOG.info("disposing job " + job);
timerHandle.getTimer().cancel();
jobs.remove(job);
} else {
LOG.warn("timerHandle " + timerHandle + " not available!");
}
}
代码示例来源:origin: net.sf.tsl2nano/tsl2.nano.serviceaccess
/**
* {@inheritDoc}
*/
@Override
public void disposeAllScheduledJobs() {
// final Collection<Timer> timers = timerService.getTimers();
for (final Job<RUNNABLE> job : jobs) {
job.getTimerHandle().getTimer().cancel();
}
jobs.clear();
}
代码示例来源:origin: org.rhq/rhq-enterprise-server
public void scheduleSessionPurgeJob() {
// 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());
}
try {
existingTimer.cancel();
} catch (Exception e) {
log.warn("Failed in attempting to cancel timer: " + existingTimer.toString());
}
}
// timer that will trigger every 60 seconds
timerService.createIntervalTimer(60000L, 60000L, new TimerConfig(null, false));
}
代码示例来源:origin: net.sf.tsl2nano/tsl2.nano.serviceaccess
/**
* {@inheritDoc}
*/
@Override
public void disposeScheduleJob(String name) {
Job<RUNNABLE> job = getJob(name);
if (job != null) {
LOG.info("disposing job " + job);
job.getTimerHandle().getTimer().cancel();
jobs.remove(job);
} else {
LOG.warn("job with name " + name + " not available!");
}
}
代码示例来源:origin: IQSS/dataverse
public void removeHarvestTimer(HarvestingClient harvestingClient) {
// Clear dataverse timer, if one exists
try {
logger.log(Level.INFO,"Removing harvest timer on " + InetAddress.getLocalHost().getCanonicalHostName());
} catch (UnknownHostException ex) {
Logger.getLogger(DataverseTimerServiceBean.class.getName()).log(Level.SEVERE, null, ex);
}
for (Iterator it = timerService.getTimers().iterator(); it.hasNext();) {
Timer timer = (Timer) it.next();
if (timer.getInfo() instanceof HarvestTimerInfo) {
HarvestTimerInfo info = (HarvestTimerInfo) timer.getInfo();
if (info.getHarvestingClientId().equals(harvestingClient.getId())) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.rhq/rhq-enterprise-server
public void scheduleServerHeartbeat() {
/* each time the webapp is reloaded, it would create
* duplicate events if we don't cancel the existing ones
*/
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.createIntervalTimer(30000L, 30000L, new TimerConfig(null, false));
}
代码示例来源: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: 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.apache.openejb/openejb-core
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// if we have a real timerservice, stop all timers. Otherwise, ignore...
if (primaryKey != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// if we have a real timerservice, stop all timers. Otherwise, ignore...
if (primaryKey != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core
private void cancelTimers(ThreadContext threadContext) {
CoreDeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
Object primaryKey = threadContext.getPrimaryKey();
// if we have a real timerservice, stop all timers. Otherwise, ignore...
if (primaryKey != null) {
EjbTimerService timerService = deploymentInfo.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (Timer timer : deploymentInfo.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// stop timers
if (primaryKey != null && beanContext.getEjbTimerService() != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
private void cancelTimers(final ThreadContext threadContext) {
final BeanContext beanContext = threadContext.getBeanContext();
final Object primaryKey = threadContext.getPrimaryKey();
// stop timers
if (primaryKey != null && beanContext.getEjbTimerService() != null) {
final EjbTimerService timerService = beanContext.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (final Timer timer : beanContext.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core
private void cancelTimers(ThreadContext threadContext) {
DeploymentInfo deploymentInfo = threadContext.getDeploymentInfo();
Object primaryKey = threadContext.getPrimaryKey();
// stop timers
if (primaryKey != null && deploymentInfo.getEjbTimerService() != null) {
EjbTimerService timerService = deploymentInfo.getEjbTimerService();
if (timerService != null && timerService instanceof EjbTimerServiceImpl) {
for (Timer timer : deploymentInfo.getEjbTimerService().getTimers(primaryKey)) {
timer.cancel();
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!