2 Replies Latest reply on Nov 28, 2008 6:35 PM by Matt Drees

    Asynchronous problem when call via Component.getInstance()

    Grigoriy Tkachuk Newbie

      I trying to make mail sending with delay, but when I call method send(3000) via Component.getInstance() it look like system ignore annotation @Duration. What's wrong? And how to do that? If I call method from jsf form everything works fine. But I need call that method from postMessage().

      public class MessageHandlerBean {
          private EntityManager entityManager;
          private Callback callback;
          private Log log;
          private Stack<Client> stack;
          public void postMessage() {
              stack = new Stack<Client>();
              stack.addAll(entityManager.createQuery("select c from Client c").getResultList());
              callback = new Callback() {
                  public void next() {
                      if (!stack.isEmpty()) {
                          ((MessageHandlerBean) Component.getInstance("messageSender")).send(3000);
              ((MessageHandlerBean) Component.getInstance("messageSender")).send(3000);
          public void send(@Duration long delay) {
              //mail sending impl here