How can one wait on the client side? Where can I read up a bit about that? I was always under the impression that onSucess event is triggered automatically after the form is submitted it (it is simply part of the chain) so how can I state at the client side proceed with the processing but wait till I say so to triggered the success event?
Also how does one then uses classes like CaptureResultCallback? I was expecting that there would be such a callback that can block until return value is present, but couldn't find anything. What are those classes then used for? Thanks On Sat, Jul 12, 2014 at 3:10 PM, Lance Java <lance.j...@googlemail.com> wrote: > The proper way to solve this is to wait on the client. Only trigger > onSuccess after the first event has finished. It's hard to help much more > without a bit more info. > > If that's not possible (I doubt) then you can wait serverside. The first > event could put an AtomicBoolean or CountDownLatch onto the session. This > is then looked up by the onSuccess event and waitForCompletion() called. > On 12 Jul 2014 12:21, "Boris Horvat" <horvat.z.bo...@gmail.com> wrote: > > > Hi everyone, > > > > I have a component that triggers the event, once the event is triggered, > it > > will go to OnSuccess method that will try to refresh the zone as you can > > see below > > > > private CaptureResultCallback<String> triggerEvent(Object value, > Object[] > > context) { > > CaptureResultCallback<String> callback = new > > CaptureResultCallback<String>(); > > List<Object> eventContext = new ArrayList<Object>(); > > if (context != null) { > > eventContext.addAll(Arrays.asList(context)); > > } > > eventContext.add(value); > > this.resources.triggerEvent(UPDATE_EVENT, eventContext.toArray(), > > callback); > > return callback; > > } > > > > Object onSuccess() {\ > > return request.isXHR() ? zoneFlowEdit.getBody() : null; > > } > > > > However it can happen that this refresh it faster then processing of the > > event on the other side, so when the zone tries to refresh itself it > doesnt > > have all of the information that it needs and it throws NPE. > > > > Is it possible to force the wait here so that I wait for the return of > the > > callback and then proceed to the onSuccess method? > > > > Thanks > > > > -- > > Sincerely > > *Boris Horvat* > > > -- Sincerely *Boris Horvat*