Hello,
how can I get an Instance of the ThreadLocalDelegateExecutorFactory?
Or has anybody an example for using this SAL Service in Jira?
regards
Chris
Community moderators have prevented the ability to post new answers.
Ok, I found in a code snippet of HipChat.
First you have to add the component-import to your atlassian-plugin.xml
<component-import key="threadLocalDelegateExecutorFactory" name="ThreadLocalDelegateExecutorFactory Component" interface="com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory"/>
then you have to add it as final field in your class
private ThreadLocalDelegateExecutorFactory threadLocalDelegateExecutorFactory; private ExecutorService executorService;
then you can choose between at Autowired Annotation or use Constructor Injection. But you have to add another field for ExcutorService. Now you can create a Runable or an Callable with the Factory and start it with the ExecutorService.
Runnable executeRequest = threadLocalDelegateExecutorFactory.createRunnable(new MyRunable()); getExecutorService().execute(executeRequest);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.