如何为TriggerListener设置名称?

时间:2011-06-21 14:07:22

标签: java quartz-scheduler jboss5.x crontrigger

我找不到设置triggerListener名称的方法。 但我得到了例外:

org.quartz.SchedulerException: TriggerListener 'wavemark.interfaceserver.interfaceengine.action.EngineListener' 
    props could not be configured. 
    [See nested exception: java.lang.NoSuchMethodException:
          wavemark.interfaceserver.interfaceengine.action.EngineListener.setName(java.lang.String)]

然后我想出来了,我为它添加了一个名称变量以及一个setter方法:

public class EngineListener implements TriggerListener
{
private String name;

public EngineListener()
{

}
public EngineListener(String name)
{
    this.name = name;
}

public void setName(String name)
{
    this.name = name;
}

public String getName()
{
    return name;
}

@Override
public void triggerComplete(Trigger arg0, JobExecutionContext arg1, int arg2)
{
    // TODO Auto-generated method stub      
}

@Override
public void triggerFired(Trigger arg0, JobExecutionContext arg1)
{
    // TODO Auto-generated method stub  
}

@Override
public void triggerMisfired(Trigger arg0)
{
    // TODO Auto-generated method stub

}

@Override
public boolean vetoJobExecution(Trigger arg0, JobExecutionContext arg1)
{
    return false;
}

我只想知道石英属性中与我的代码匹配的确切配置是什么,因为现在我正在初始化并从应用程序内部添加监听器,并且我希望在部署时将该配置初始化为ear文件更改,与初始化配置的其余部分相同。

1 个答案:

答案 0 :(得分:2)

我想通了:org.quartz.triggerListener.NAME.class=wavemark.interfaceserver.interfaceengine.a‌​ction.EngineListener org.quartz.triggerListener.NAME.name=InterfaceSchedulerListener