當前位置: 首頁>>代碼示例>>Java>>正文


Java Timer.cancel方法代碼示例

本文整理匯總了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.");
	}
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:22,代碼來源:TimerRefreshSubscriptions.java

示例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;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:19,代碼來源:TimerServiceBean.java

示例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));
        }
    }

}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:25,代碼來源:TimerServiceBean.java

示例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();
    }
}
 
開發者ID:whalebone,項目名稱:sinkit-core,代碼行數:9,代碼來源:IocProtostreamGenerator.java

示例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;
        }
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:11,代碼來源:APPTimerServiceBean.java

示例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));
        }
    }

}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:18,代碼來源:TimerServiceBean.java

示例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;
			}
		}
	}
}
 
開發者ID:salimvanak,項目名稱:myWMS,代碼行數:14,代碼來源:ERPQueryInventoryBean.java

示例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;
			}
		}
	}
}
 
開發者ID:salimvanak,項目名稱:myWMS,代碼行數:14,代碼來源:LocationSanityBusinessBean.java

示例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;
      }
   }
}
 
開發者ID:Wolfgang-Winter,項目名稱:cibet,代碼行數:11,代碼來源:EESchedulerTask.java

示例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();
			}
		}
	}
}
 
開發者ID:U-QASAR,項目名稱:u-qasar.platform,代碼行數:17,代碼來源:AdapterSettingsService.java

示例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());
}
 
開發者ID:felixhusse,項目名稱:bookery,代碼行數:10,代碼來源:BatchJobService.java

示例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();
			}
		}
	}
}
 
開發者ID:U-QASAR,項目名稱:u-qasar.platform,代碼行數:18,代碼來源:RulesTimer.java

示例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();
    }
}
 
開發者ID:whalebone,項目名稱:sinkit-core,代碼行數:9,代碼來源:WhitelistProtostreamGenerator.java

示例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();
    }
}
 
開發者ID:whalebone,項目名稱:sinkit-core,代碼行數:9,代碼來源:IoCWithCustomProtostreamGenerator.java

示例15: stopTimer

import javax.ejb.Timer; //導入方法依賴的package包/類
@PreDestroy
public void stopTimer() {
	for (Timer timer : timerService.getTimers()) {
		timer.cancel();
	}
}
 
開發者ID:victorrentea,項目名稱:training,代碼行數:7,代碼來源:Business.java


注:本文中的javax.ejb.Timer.cancel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。