本文整理汇总了Java中commonj.timers.TimerManager类的典型用法代码示例。如果您正苦于以下问题:Java TimerManager类的具体用法?Java TimerManager怎么用?Java TimerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TimerManager类属于commonj.timers包,在下文中一共展示了TimerManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import commonj.timers.TimerManager; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.scheduledTimerListeners != null) {
TimerManager timerManager = getTimerManager();
for (ScheduledTimerListener scheduledTask : this.scheduledTimerListeners) {
Timer timer;
if (scheduledTask.isOneTimeTask()) {
timer = timerManager.schedule(scheduledTask.getTimerListener(), scheduledTask.getDelay());
}
else {
if (scheduledTask.isFixedRate()) {
timer = timerManager.scheduleAtFixedRate(
scheduledTask.getTimerListener(), scheduledTask.getDelay(), scheduledTask.getPeriod());
}
else {
timer = timerManager.schedule(
scheduledTask.getTimerListener(), scheduledTask.getDelay(), scheduledTask.getPeriod());
}
}
this.timers.add(timer);
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:TimerManagerFactoryBean.java
示例2: afterPropertiesSet
import commonj.timers.TimerManager; //导入依赖的package包/类
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.scheduledTimerListeners != null) {
TimerManager timerManager = getTimerManager();
for (ScheduledTimerListener scheduledTask : this.scheduledTimerListeners) {
Timer timer;
if (scheduledTask.isOneTimeTask()) {
timer = timerManager.schedule(scheduledTask.getTimerListener(), scheduledTask.getDelay());
}
else {
if (scheduledTask.isFixedRate()) {
timer = timerManager.scheduleAtFixedRate(
scheduledTask.getTimerListener(), scheduledTask.getDelay(), scheduledTask.getPeriod());
}
else {
timer = timerManager.schedule(
scheduledTask.getTimerListener(), scheduledTask.getDelay(), scheduledTask.getPeriod());
}
}
this.timers.add(timer);
}
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:24,代码来源:TimerManagerFactoryBean.java
示例3: service
import commonj.timers.TimerManager; //导入依赖的package包/类
/**
* A very simple implementation of the service method,
* which schedules a commonj timer.
*/
public void service(HttpServletRequest req, HttpServletResponse res)
throws IOException
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
try {
InitialContext ic = new InitialContext();
TimerManager tm = (TimerManager)ic.lookup
("java:comp/env/tm/default");
// Execute timer every 10 seconds starting immediately
tm.schedule (new MyTimerListener(), 0, 10*1000);
out.println("<h4>Timer scheduled!</h4>");
} catch (NamingException ne) {
ne.printStackTrace();
out.println("<h4>Timer schedule failed!</h4>");
}
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:22,代码来源:TimerServlet.java
示例4: init
import commonj.timers.TimerManager; //导入依赖的package包/类
/**
* Lookup and launch the timer.
*
* @param config servlet configuration
* @throws ServletException shouldn't occur
*
* @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
String jndiName = config.getInitParameter(JNDI_NAME);
if ((jndiName == null) || "".equals(jndiName)) {
LOG.error("Please specify a '" + JNDI_NAME + "' parameter to lookup the timer manager.");
return;
}
try {
TimerFactory.instance().setManager((TimerManager) (new InitialContext()).lookup(jndiName));
// launch timer indirectly
Configuration datupConfig = (Configuration) ContextSingletonBeanFactoryLocator.getInstance(
"classpath*:beanRefContext.xml").useBeanFactory("businessBeanFactory").getFactory().getBean(
"datupConfiguration");
LOG.debug(datupConfig);
}
catch (Throwable t) {
LOG.error("Unable to lookup the Timer Manager: " + jndiName, t);
}
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:34,代码来源:TimerServlet.java
示例5: afterPropertiesSet
import commonj.timers.TimerManager; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws NamingException {
if (this.timerManager == null) {
if (this.timerManagerName == null) {
throw new IllegalArgumentException("Either 'timerManager' or 'timerManagerName' must be specified");
}
this.timerManager = lookup(this.timerManagerName, TimerManager.class);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:TimerManagerAccessor.java
示例6: init
import commonj.timers.TimerManager; //导入依赖的package包/类
public void init(Properties props) {
String path = get(props, "duke.timer-jndipath");
try {
InitialContext ctx = new InitialContext();
mgr = (TimerManager) ctx.lookup(path);
}
catch (Exception e) {
throw new DukeException(e);
}
}
开发者ID:enricopal,项目名称:STEM,代码行数:11,代码来源:CommonJTimer.java
示例7: afterPropertiesSet
import commonj.timers.TimerManager; //导入依赖的package包/类
public void afterPropertiesSet() throws NamingException {
if (this.timerManager == null) {
if (this.timerManagerName == null) {
throw new IllegalArgumentException("Either 'timerManager' or 'timerManagerName' must be specified");
}
this.timerManager = lookup(this.timerManagerName, TimerManager.class);
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:TimerManagerAccessor.java
示例8: getManager
import commonj.timers.TimerManager; //导入依赖的package包/类
/**
* Locate the timer manager. If the JNDI name is not set, a non-container timer manager is created.
*
* @return timer manager
*/
public TimerManager getManager() {
if (manager instanceof DefaultTimerManager) {
LOG.debug("Defaulting to non-container managed timer.");
}
else {
LOG.debug("Using container managed timer.");
}
return manager;
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:16,代码来源:TimerFactory.java
示例9: getObject
import commonj.timers.TimerManager; //导入依赖的package包/类
@Override
public TimerManager getObject() {
return getTimerManager();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:TimerManagerFactoryBean.java
示例10: getObjectType
import commonj.timers.TimerManager; //导入依赖的package包/类
@Override
public Class<? extends TimerManager> getObjectType() {
TimerManager timerManager = getTimerManager();
return (timerManager != null ? timerManager.getClass() : TimerManager.class);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:TimerManagerFactoryBean.java
示例11: getTimerManager
import commonj.timers.TimerManager; //导入依赖的package包/类
protected final TimerManager getTimerManager() {
return this.timerManager;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:TimerManagerAccessor.java
示例12: getObject
import commonj.timers.TimerManager; //导入依赖的package包/类
public TimerManager getObject() {
return getTimerManager();
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:TimerManagerFactoryBean.java
示例13: getObjectType
import commonj.timers.TimerManager; //导入依赖的package包/类
public Class<? extends TimerManager> getObjectType() {
TimerManager timerManager = getTimerManager();
return (timerManager != null ? timerManager.getClass() : TimerManager.class);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:TimerManagerFactoryBean.java
示例14: setTimerManager
import commonj.timers.TimerManager; //导入依赖的package包/类
/**
* Specify the CommonJ TimerManager to delegate to.
* <p>Note that the given TimerManager's lifecycle will be managed
* by this FactoryBean.
* <p>Alternatively (and typically), you can specify the JNDI name
* of the target TimerManager.
* @see #setTimerManagerName
*/
public void setTimerManager(TimerManager timerManager) {
this.timerManager = timerManager;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:TimerManagerAccessor.java
示例15: setManager
import commonj.timers.TimerManager; //导入依赖的package包/类
/**
* Set JNDI name.
*
* @param jndiName jndi name
*/
public void setManager(TimerManager manager) {
this.manager = manager;
}
开发者ID:OSEHRA-Sandbox,项目名称:MOCHA,代码行数:9,代码来源:TimerFactory.java
注:本文中的commonj.timers.TimerManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论