Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to get instance of ThreadLocalDelegateExecutorFactory

Christian Schulze December 16, 2016

Hello,

how can I get an Instance of the ThreadLocalDelegateExecutorFactory? 

Or has anybody an example for using this SAL Service in Jira?

regards 

Chris

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Christian Schulze December 16, 2016

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);
TAGS
AUG Leaders

Atlassian Community Events