5 Replies Latest reply on Nov 17, 2008 1:52 AM by Uros Majeric

    implementation of PushEventListener

    Uros Majeric Newbie

      Hi,

      I have implemented PushEventListener as folows:

      class MyPushEventListener implements PushEventListener {
       public void onEvent(EventObject evt) {
       System.out.println(evt.getSource());
       }
      }


      How to use this listener now in my thread? If I do like this:
      public class Test extends Thread {
      ...
      private MyPushEventListener listener;
      public void addListener(EventListener listener) {
       synchronized (listener) {
       if (this.listener != listener) {
       this.listener = ((MyPushEventListener) listener);
       }
       }
       }
      ..
      }

      I get an error
      org.ajax4jsf.webapp.PushEventsCounter cannot be cast to develop.MyPushEventListener


      Does anyone now how to make this work?
      I just need to call my own onEvent() method which is implemented in MyPushEventListener.

      Thanks