Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Wait for the triggerEvent to finish

$
0
0
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

Viewing all articles
Browse latest Browse all 5648

Trending Articles