managementContext.getRootConfiguration();
// Get the work queue configuration and register with it as a change
// listener.
WorkQueueCfg workQueueConfig = rootConfiguration.getWorkQueue();
workQueueConfig.addChangeListener(this);
// Get the work queue class, and load and instantiate an instance of it
// using that configuration.
WorkQueueCfgDefn definition = WorkQueueCfgDefn.getInstance();
ClassPropertyDefinition propertyDefinition =
definition.getJavaClassPropertyDefinition();
Class<? extends WorkQueue> workQueueClass =
propertyDefinition.loadClass(workQueueConfig.getJavaClass(),
WorkQueue.class);
try
{
WorkQueue workQueue = workQueueClass.newInstance();
Method method = workQueue.getClass().getMethod("initializeWorkQueue",
workQueueConfig.configurationClass());
method.invoke(workQueue, workQueueConfig);
return workQueue;
}
catch (Exception e)
{
Message message = ERR_CONFIG_WORK_QUEUE_INITIALIZATION_FAILED.
get(workQueueConfig.getJavaClass(),
String.valueOf(workQueueConfig.dn()),
stackTraceToSingleLineString(e));
throw new InitializationException(message, e);
}
}