public void dispatch(final Message message) {
workQueue.dispatch(new Runnable() {
public void run() {
try {
if (message instanceof RouteAvailableMessage) {
RouteAvailableMessage routeAvailableMessage = (RouteAvailableMessage) message;
LOGGER.debug("Received route available. Message: {}", routeAvailableMessage);
Route route = new Route(routeAvailableMessage.getId(), Endpoint.this, routeAvailableMessage);
routes.add(route);
owner.addRoute(route);
} else if (message instanceof RouteUnavailableMessage) {
RouteUnavailableMessage routeUnavailableMessage = (RouteUnavailableMessage) message;
LOGGER.debug("Received route unavailable. Message: {}", routeUnavailableMessage);