How do I get a ClusterLockService in Confluence?

Ulrich Hobelmann [catworkx]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2015

ComponentLocator.getComponent(ClusterLockService.class) returns null, so what do I do?

I couldn't find any information about component-import anywhere, so I'm not sure if I need something extra in the atlassian-plugin.xml?

3 answers

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
Ulrich Hobelmann [catworkx]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2015

Apparently it's not possible to get ANY components via the ComponentLocator (except the basic Confluence manager classes), so even the plugin's own components are not registered.

The only way to get an external component into the job seems to be to pass it via the JobDataMap. Ugly, but it seems to work.

Since the standard Confluence AbstractJob jobs cannot be parameterized or scheduled/triggered via the Java API, this is the only way to run adhoc jobs in Confluence.

0 votes
Ulrich Hobelmann [catworkx]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2015

In standard components, injecting the ClusterLockService works, but obviously in a PluginJob I cannot use injection (default constructor!), so I need the ComponentLocator.

0 votes
Ulrich Hobelmann [catworkx]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2015

FWIW, the component-import doesn't help.

TAGS
AUG Leaders

Atlassian Community Events