Search in sources :

Example 1 with JobRegistrar

use of com.swiftmq.impl.routing.single.jobs.JobRegistrar in project swiftmq-ce by iitsoftware.

the class RoutingSwiftletImpl method startup.

protected void startup(Configuration config) throws SwiftletException {
    this.config = config;
    root = config;
    passwords = Collections.synchronizedMap(new HashMap());
    connectionEntities = Collections.synchronizedMap(new HashMap());
    connections = Collections.synchronizedSet(new HashSet());
    ctx = createSwiftletContext(this, root);
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "startup ...");
    acceptor = new Acceptor();
    createRoutingQueues();
    createStaticRoutes((EntityList) root.getEntity("static-routes"));
    createListeners((EntityList) root.getEntity("listeners"));
    createConnectors((EntityList) root.getEntity("connectors"));
    SwiftletManager.getInstance().addSwiftletManagerListener("sys$scheduler", new SwiftletManagerAdapter() {

        public void swiftletStarted(SwiftletManagerEvent event) {
            ctx.schedulerSwiftlet = (SchedulerSwiftlet) SwiftletManager.getInstance().getSwiftlet("sys$scheduler");
            jobRegistrar = new JobRegistrar(ctx);
            jobRegistrar.register();
        }

        public void swiftletStopInitiated(SwiftletManagerEvent event) {
            jobRegistrar.unregister();
        }
    });
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(getName(), "startup done");
}
Also used : SwiftletManagerEvent(com.swiftmq.swiftlet.event.SwiftletManagerEvent) SchedulerSwiftlet(com.swiftmq.swiftlet.scheduler.SchedulerSwiftlet) JobRegistrar(com.swiftmq.impl.routing.single.jobs.JobRegistrar) SwiftletManagerAdapter(com.swiftmq.swiftlet.event.SwiftletManagerAdapter)

Aggregations

JobRegistrar (com.swiftmq.impl.routing.single.jobs.JobRegistrar)1 SwiftletManagerAdapter (com.swiftmq.swiftlet.event.SwiftletManagerAdapter)1 SwiftletManagerEvent (com.swiftmq.swiftlet.event.SwiftletManagerEvent)1 SchedulerSwiftlet (com.swiftmq.swiftlet.scheduler.SchedulerSwiftlet)1