It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Do I have to close the connection that I got via new DefaultOfBizConnectionFactory().getConnection()?

Hi,

my calculated custom field needs to query the database and therefore gets a database connection via DefaultOfBizConnectionFactory().getConnection(). Do I have to close that connection explicitly and the end of my plugin's method?

2 answers

1 accepted

0 votes
Answer accepted

If I close the Connection explicitly, I get the following errors, so I assume you must not close the connection:

java.lang.IllegalStateException: The OpTimer has been re-used.  end() can only be called once!
	at com.atlassian.instrumentation.operations.SimpleOpTimer.end(SimpleOpTimer.java:142)
	at com.atlassian.instrumentation.operations.SimpleOpTimer.end(SimpleOpTimer.java:99)
	at com.atlassian.instrumentation.operations.SimpleOpTimer.end(SimpleOpTimer.java:117)
	at com.atlassian.jira.ofbiz.InstrumentedSQLInterceptor.onConnectionReplaced(InstrumentedSQLInterceptor.java:38)
	at com.atlassian.jira.ofbiz.ChainedSQLInterceptor.onConnectionReplaced(ChainedSQLInterceptor.java:75)
	at org.ofbiz.core.entity.jdbc.interceptors.connection.ConnectionTracker$ConnectionWithSQLInterceptorImpl.close(ConnectionTracker.java:96)
	at com.example.jira.customfields.SprintField.close(SprintField.java:106)
...

Closing the ResultSet and Statement should be done nevertheless.

We have the same problem. Do you finally find the correct way to do it?

 

IIRC, we only closed the ResultSet and the Statement.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published yesterday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

45 views 0 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you