org.jboss.seam.async.AsynchronousEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jboss-seam Show documentation
Show all versions of jboss-seam Show documentation
Seam core module for Seam framework integrated with JSF2
package org.jboss.seam.async;
import org.jboss.seam.core.Events;
import org.jboss.seam.util.CloneUtils;
/**
* An asynchronous event
*
* @author Gavin King
*
*/
public class AsynchronousEvent extends Asynchronous {
static final long serialVersionUID = 2074586442931427819L;
private String type;
private Object[] parameters;
public AsynchronousEvent(String type, Object[] parameters) {
super();
this.type = type;
this.parameters = CloneUtils.cloneArray(parameters);
}
@Override
public void execute(Object timer) {
new ContextualAsynchronousRequest(timer) {
@Override
protected void process() {
Events.instance().raiseEvent(type, parameters);
}
}.run();
}
@Override
public String toString() {
return "AsynchronousEvent(" + type + ')';
}
protected String getType() {
return type;
}
@Override
protected void handleException(final Exception exception, Object timer) {
new ContextualAsynchronousRequest(timer) {
@Override
protected void process() {
AsynchronousExceptionHandler.instance().handleException(exception);
}
}.run();
}
}