java ejb TimerService:getTimers 返回的已取消计时器(树脂 caucho)

java ejb TimerService: cancelled timer returned by getTimers (resin caucho)

我正在尝试取消计时器,但之后我仍然通过 getTimers() 返回它。没问题还是只是一个 caucho 树脂错误?如何正确取消程序化定时器?

@Singleton
@LocalBean
@Startup
public class TimerTest
{
    @Resource
    TimerService ts;
    static TimerTest inst;

    @PostConstruct
    void init()
    {   inst=this;
    }

    public synchronized static TimerTest getInstance()
    {   return(inst);
    }

    public Collection<Timer> getTimers()
    {   Collection <Timer> res=ts.getTimers();
        return(res);
    }

    public void cancelAll()
    {   for(Timer ot: ts.getTimers())
        {   try
            {   System.out.println("Found old timer "+ot.getInfo()+", cancelling it.");
                ot.cancel();
            }
            catch(Exception e) {}
        }
    }

然后(来自 jsp):

TimerTest tt=TimerTest.getInstance();
Collection <Timer> timers=tt.getTimers();
out.println("<br>Got "+timers.size()+" timer(s)<br>");
for(Timer t: timers)
{
    try
    {
        out.println("<br>Got timer: "+t.getInfo());
    }
    catch(Exception e)
    {
        out.println("Error while cancelling timers "+e);
    }
}

取消计时器时出错javax.ejb.NoSuchObjectLocalException: 此计时器已被取消。

谢谢! )

在这里得到答案:http://bugs.caucho.com/view.php?id=5891

06-03-15 08:50 ferg Assigned To => ferg

06-03-15 08:50 ferg Status new => closed

06-03-15 08:50 ferg Resolution open => fixed

06-03-15 08:50 ferg Fixed in Version => 4.0.45