Skip to content

Instantly share code, notes, and snippets.

@maeste
Created October 14, 2010 21:59
Show Gist options
  • Save maeste/627156 to your computer and use it in GitHub Desktop.
Save maeste/627156 to your computer and use it in GitHub Desktop.
WorkManager wm = new WorkManagerImpl();
final InjectedValue<QueueExecutor> injectShortRunningExecutor = new InjectedValue<QueueExecutor>();
final InjectedValue<QueueExecutor> injectLongRunningExecutor = new InjectedValue<QueueExecutor>();
final WorkManagerService wmService = new WorkManagerService(wm, injectLongRunningExecutor, injectLongRunningExecutor);
final BatchServiceBuilder<WorkManager> wmServiceBuilder = builder.addService(ConnectorServices.WORKMANAGER_SERVICE,
wmService);
wmServiceBuilder.addDependency(ThreadsServices.EXECUTOR.append(shortRunningThreadPool), QueueExecutor.class,
injectShortRunningExecutor);
wmServiceBuilder.addDependency(ThreadsServices.EXECUTOR.append(longRunningThreadPool), QueueExecutor.class,
injectLongRunningExecutor);
wmServiceBuilder.setInitialMode(Mode.ON_DEMAND);
23:51:57,574 ERROR [server] Service [service jboss.connector.workmanager] start failed: org.jboss.msc.service.StartException in service service jboss.connector.workmanager: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1037)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.6.0_18]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.6.0_18]
at java.lang.Thread.run(Thread.java:636) [:1.6.0_18]
Caused by: org.jboss.msc.inject.InjectionException: Injecting the wrong type (expected class org.jboss.threads.QueueExecutor, got class org.jboss.threads.DelegatingExecutorService)
at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:51)
at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:729)
at org.jboss.msc.service.ServiceControllerImpl.access$1100(ServiceControllerImpl.java:122)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:986)
... 3 more
Caused by: java.lang.ClassCastException: Cannot cast org.jboss.threads.DelegatingExecutorService to org.jboss.threads.QueueExecutor
at java.lang.Class.cast(Class.java:3007) [:1.6.0_18]
at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:49)
... 6 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment