repackaged error handler
This commit is contained in:
parent
201518d9f4
commit
b3fa064217
@ -24,17 +24,7 @@ public abstract class AbstractMessageBus<T, P extends IMessageBus.IPostCommand>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is the default error handler it will simply log to standard out and
|
|
||||||
// print stack trace if available
|
|
||||||
protected static final class ConsoleLogger implements IPublicationErrorHandler {
|
|
||||||
@Override
|
|
||||||
public void handleError(PublicationError error) {
|
|
||||||
System.out.println(error);
|
|
||||||
if (error.getCause() != null) error.getCause().printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
// executor for asynchronous listeners using unbound queuing strategy to ensure that no events get lost
|
// executor for asynchronous listeners using unbound queuing strategy to ensure that no events get lost
|
||||||
private ExecutorService executor;
|
private ExecutorService executor;
|
||||||
@ -98,7 +88,7 @@ public abstract class AbstractMessageBus<T, P extends IMessageBus.IPostCommand>
|
|||||||
public AbstractMessageBus(int dispatcherThreadCount, ExecutorService executor) {
|
public AbstractMessageBus(int dispatcherThreadCount, ExecutorService executor) {
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
initDispatcherThreads(dispatcherThreadCount > 0 ? dispatcherThreadCount : 2);
|
initDispatcherThreads(dispatcherThreadCount > 0 ? dispatcherThreadCount : 2);
|
||||||
addErrorHandler(new ConsoleLogger());
|
addErrorHandler(new IPublicationErrorHandler.ConsoleLogger());
|
||||||
subscriptionFactory = getSubscriptionFactory();
|
subscriptionFactory = getSubscriptionFactory();
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,16 @@ package org.mbassy;
|
|||||||
public interface IPublicationErrorHandler {
|
public interface IPublicationErrorHandler {
|
||||||
|
|
||||||
public void handleError(PublicationError error);
|
public void handleError(PublicationError error);
|
||||||
|
|
||||||
|
// This is the default error handler it will simply log to standard out and
|
||||||
|
// print stack trace if available
|
||||||
|
static final class ConsoleLogger implements IPublicationErrorHandler {
|
||||||
|
@Override
|
||||||
|
public void handleError(PublicationError error) {
|
||||||
|
System.out.println(error);
|
||||||
|
if (error.getCause() != null) error.getCause().printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package org.mbassy.common;
|
package org.mbassy.common;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -15,8 +12,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class ReflectionUtils {
|
public class ReflectionUtils {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ReflectionUtils.class);
|
|
||||||
|
|
||||||
public static List<Method> getMethods(IPredicate<Method> condition, Class<?> target) {
|
public static List<Method> getMethods(IPredicate<Method> condition, Class<?> target) {
|
||||||
List<Method> methods = new LinkedList<Method>();
|
List<Method> methods = new LinkedList<Method>();
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user