Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.client.api.base
Class AsyncDelegateErrorCallback

java.lang.Object
  extended by org.jboss.errai.bus.client.api.base.AsyncDelegateErrorCallback
All Implemented Interfaces:
ErrorCallback<Message>

public class AsyncDelegateErrorCallback
extends Object
implements ErrorCallback<Message>

An error callback decorator for repeating tasks which automatically cancels them when they cause an error. Can also be used on its own, without wrapping another error callback.


Constructor Summary
AsyncDelegateErrorCallback(HasAsyncTaskRef task, ErrorCallback delegate)
          Creates an error callback that optionally wraps another error callback.
 
Method Summary
 boolean error(Message message, Throwable throwable)
          Cancels future executions of the task by calling AsyncTask.cancel(boolean) on the AsyncTask that controls its execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncDelegateErrorCallback

public AsyncDelegateErrorCallback(HasAsyncTaskRef task,
                                  ErrorCallback delegate)
Creates an error callback that optionally wraps another error callback. In either case, future executions of the given task will be cancelled.

Parameters:
task - The task whose failures will be handled by this wrapper callback. Must not be null.
delegate - The ErrorCallback that should be wrapped. Can be null, in which case errors in executions of task are logged to System.out.
Method Detail

error

public boolean error(Message message,
                     Throwable throwable)
Cancels future executions of the task by calling AsyncTask.cancel(boolean) on the AsyncTask that controls its execution.

Specified by:
error in interface ErrorCallback<Message>
Parameters:
message - The message or request for which the failure occurred.
throwable - The exception thrown or null if not available
Returns:
the value returned by the delegate error handler's error() method. If there is no delegate, the return value is always true.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.