本文整理汇总了Java中javax.ejb.Timer.cancel方法的典型用法代码示例。如果您正苦于以下问题:Java Timer.cancel方法的具体用法?Java Timer.cancel怎么用?Java Timer.cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.ejb.Timer
的用法示例。
在下文中一共展示了Timer.cancel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
@PostConstruct
public void setTimer() {
Collection<Timer> timers = timerService.getTimers();
for (Timer timerVM : timers) {
if (VM_TIMER_INFO.equals(timerVM.getInfo())) {
timerVM.cancel();
}
}
logger.info("Timer for subscription VMs will be created.");
try {
String timerIntervalSetting = configService
.getProxyConfigurationSetting(PlatformConfigurationKey.APP_TIMER_REFRESH_SUBSCRIPTIONS);
long interval = Long.parseLong(timerIntervalSetting);
timerService.createTimer(0, interval, VM_TIMER_INFO);
// timerService.createIntervalTimer(new Date(), interval,
// new TimerConfig());
} catch (ConfigurationException e) {
timerService.createTimer(0, DEFAULT_TIMER_INTERVAL, VM_TIMER_INFO);
logger.info("Timer interval for refreshing subcription VMs not set, switch to default 10 min.");
}
}
示例2: isTimerCreated
import javax.ejb.Timer; //导入方法依赖的package包/类
boolean isTimerCreated(TimerType timerType, TimerService timerService) {
for (Timer timer : ParameterizedTypes.iterable(
timerService.getTimers(), Timer.class)) {
TimerType tType = (TimerType) timer.getInfo();
if ((TimerType.BILLING_INVOCATION.equals(tType) && TimerType.BILLING_INVOCATION
.equals(timerType))
|| (TimerType.DISCOUNT_END_CHECK.equals(tType) && TimerType.DISCOUNT_END_CHECK
.equals(timerType))) {
long currentTime = System.currentTimeMillis();
if (timer.getNextTimeout().getTime() - currentTime > 0) {
return true;
} else {
timer.cancel();
}
}
}
return false;
}
示例3: cancelObsoleteTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
/**
* Determines all currently queued timers and cancel timer with target type.
*
* @param timerService
* The timer service.
* @param timerType
* The timer type.
*/
private void cancelObsoleteTimer(TimerService timerService,
TimerType timerType) {
for (Timer timer : ParameterizedTypes.iterable(
timerService.getTimers(), Timer.class)) {
Serializable info = timer.getInfo();
if (info != null && info instanceof TimerType && timerType == info) {
TimerType type = (TimerType) info;
timer.cancel();
logger.logInfo(Log4jLogger.SYSTEM_LOG,
LogMessageIdentifier.INFO_TIMER_REMOVED,
String.valueOf(type));
}
}
}
示例4: stop
import javax.ejb.Timer; //导入方法依赖的package包/类
@PreDestroy
public void stop() {
log.info("Stop all existing IOCListProtostreamGenerator timers.");
for (Timer timer : timerService.getTimers()) {
log.fine("Stop IOCListProtostreamGenerator timer: " + timer.getInfo());
timer.cancel();
}
}
示例5: cancelTimers
import javax.ejb.Timer; //导入方法依赖的package包/类
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void cancelTimers() {
Collection<Timer> timers = timerService.getTimers();
for (Timer th : timers) {
if (APP_TIMER_INFO.equals(th.getInfo())) {
th.cancel();
return;
}
}
}
示例6: cancelAllObsoleteTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
/**
* Determines all currently queued timers and cancels them.
*/
private void cancelAllObsoleteTimer() {
for (Timer timer : ParameterizedTypes.iterable(ctx.getTimerService()
.getTimers(), Timer.class)) {
Serializable info = timer.getInfo();
if (info != null && info instanceof TimerType) {
TimerType type = (TimerType) info;
timer.cancel();
logger.logInfo(Log4jLogger.SYSTEM_LOG,
LogMessageIdentifier.INFO_TIMER_REMOVED,
String.valueOf(type));
}
}
}
示例7: cancelCronJob
import javax.ejb.Timer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void cancelCronJob() {
for (Timer timer : (Collection<Timer>) timerService.getTimers()) {
if (timer.getInfo() instanceof String) {
if (((String) timer.getInfo())
.equals(TIME_OUT_INFO)) {
timer.cancel();
log.info("Cancel timer: " + timer.toString());
return;
}
}
}
}
示例8: cancelCronJob
import javax.ejb.Timer; //导入方法依赖的package包/类
public void cancelCronJob() {
TimerService timerService = ctx.getTimerService();
for (Timer timer : (Collection<Timer>) timerService.getTimers()) {
if (timer.getInfo() instanceof String) {
if (((String) timer.getInfo())
.equals(LocationSanityBusiness.TIME_OUT_INFO)) {
timer.cancel();
log.info("Cancel timer: " + timer.toString());
return;
}
}
}
}
示例9: stopTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
@Override
public void stopTimer(String timerName) {
for (Timer timer : timerService.getTimers()) {
if (timerName.equals(((SchedulerTimerConfig) timer.getInfo()).getSchedulerName())) {
timer.cancel();
log.info("Scheduler EE Timer " + timerName + " stopped");
return;
}
}
}
示例10: cancelTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
/**
* Cancel an existing timer
*/
private void cancelTimer() {
if (timerService.getTimers() != null && timerService.getTimers().size() > 0) {
System.out.println("Cancelling U-QASAR adapter data update timer ");
for (Timer timer : timerService.getTimers()) {
String timerId = timer.getInfo().toString();
System.out.println("Existing timers:[TimerID: " +timerId +"]");
if (timerId.equals(ADAPTERDATA_TIMER)) {
timer.cancel();
}
}
}
}
示例11: deleteJob
import javax.ejb.Timer; //导入方法依赖的package包/类
public void deleteJob(BatchJobConfiguration batchJobConfiguration) {
Timer timer = getTimer(batchJobConfiguration);
if (timer != null) {
BatchJobConfiguration jobConfig = (BatchJobConfiguration)timer.getInfo();
logger.debug("Delete Timer " + jobConfig.getType().getDisplayName());
timer.cancel();
}
batchJobConfigurationDAO.delete(batchJobConfiguration.getId());
}
示例12: cancelTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
/**
* Cancels the existing timer
*/
private void cancelTimer() {
if (timerService.getTimers() != null
&& timerService.getTimers().size() > 0) {
logger.info("Cancelling U-QASAR rule timer...");
for (Timer timer : timerService.getTimers()) {
if (timer.getInfo().toString().contains(RULES_TIMER_ABBR)) {
logger.info("Cancelling timer " + timer.getInfo());
timer.cancel();
}
}
}
}
示例13: stop
import javax.ejb.Timer; //导入方法依赖的package包/类
@PreDestroy
public void stop() {
log.info("Stop all existing WhitelistProtostreamGenerator timers.");
for (Timer timer : timerService.getTimers()) {
log.fine("Stop WhitelistProtostreamGenerator timer: " + timer.getInfo());
timer.cancel();
}
}
示例14: stop
import javax.ejb.Timer; //导入方法依赖的package包/类
@PreDestroy
public void stop() {
log.info("Stop all existing IoCWithCustomProtostreamGenerator timers.");
for (Timer timer : timerService.getTimers()) {
log.fine("Stop IoCWithCustomProtostreamGenerator timer: " + timer.getInfo());
timer.cancel();
}
}
示例15: stopTimer
import javax.ejb.Timer; //导入方法依赖的package包/类
@PreDestroy
public void stopTimer() {
for (Timer timer : timerService.getTimers()) {
timer.cancel();
}
}