use of com.swiftmq.impl.routing.single.RouteImpl in project swiftmq-ce by iitsoftware.
the class SchedulerRegistry method getScheduler.
public synchronized Scheduler getScheduler(String destinationRouter) throws Exception {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/getScheduler, destinationRouter=" + destinationRouter);
Scheduler scheduler = (Scheduler) schedulers.get(destinationRouter);
if (scheduler == null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/getScheduler, destinationRouter=" + destinationRouter + ", creating scheduler...");
String queueName = QUEUE_PREFIX + destinationRouter + "@" + ctx.routerName;
if (!ctx.queueManager.isQueueDefined(queueName))
ctx.queueManager.createQueue(queueName, (ActiveLogin) null);
ctx.queueManager.setQueueOutboundRedirector(OUTBOUND_REDIR_PRED + destinationRouter, queueName);
if (ctx.roundRobinEnabled) {
scheduler = new RoundRobinScheduler(ctx, destinationRouter, queueName);
} else {
scheduler = new DefaultScheduler(ctx, destinationRouter, queueName);
}
schedulers.put(destinationRouter, scheduler);
RouteImpl route = (RouteImpl) ctx.routingSwiftlet.getRoute(destinationRouter);
if (route == null)
ctx.routingSwiftlet.addRoute(new RouteImpl(destinationRouter, queueName, true, scheduler));
else
route.setScheduler(scheduler);
}
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/getScheduler, destinationRouter=" + destinationRouter + ", returns " + scheduler);
return scheduler;
}
use of com.swiftmq.impl.routing.single.RouteImpl in project swiftmq-ce by iitsoftware.
the class SchedulerRegistry method removeScheduler.
public synchronized void removeScheduler(String destinationRouter) throws Exception {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/removeScheduler, destinationRouter=" + destinationRouter);
Scheduler scheduler = (Scheduler) schedulers.remove(destinationRouter);
if (scheduler != null) {
scheduler.close();
RouteImpl route = (RouteImpl) ctx.routingSwiftlet.getRoute(destinationRouter);
if (route != null) {
if (route.isStaticRoute())
route.setScheduler(null);
else {
ctx.queueManager.setQueueOutboundRedirector(OUTBOUND_REDIR_PRED + destinationRouter, null);
ctx.routingSwiftlet.removeRoute(route);
}
}
}
}
Aggregations