Hi,

I saw the following code snippet in a framework component:

        cycle.setListenerParameters(...);

        ....

        if (action != null) {
         Runnable notify = new Runnable()
         {
             public void run()
             {
                 listenerInvoker.invokeListener(action, AbstractSubmit.this, 
cycle);
             }
         };
 
            form.addDeferredRunnable(notify);
        }

My question is: is it correct that the run() method contains only code to 
invoke the listener but cycle.setListenerParameters() is set outside of it? 
Does this work correctly if more than one component adds deferred runnables 
with different listener arguments?

If I'm right then the following is more correct:

        if (action != null) {
         Runnable notify = new Runnable()
         {
             public void run()
             {

                 cycle.setListenerParameters(...);
                 listenerInvoker.invokeListener(action, AbstractSubmit.this, 
cycle);
             }
         };
 
            form.addDeferredRunnable(notify);
        }

Regards,
Norbi

Reply via email to