We're Hiring!

Closing services

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Closing services

Postby icaoberg » Wed May 18, 2011 5:04 pm

I am reviewing my code and would like to know if these services get closed automatically or should I close them? Since they do not have a close() method is there another way to make sure I dont have any memory issues by keeping these open.

Code: Select all
queryService = session.getQueryService()
updateService = session.getUpdateService()
rawFileStore = session.createRawFileStore()
icaoberg
 
Posts: 145
Joined: Fri Sep 17, 2010 9:05 pm
Location: Pittsburgh, PA

Re: Closing services

Postby jmoore » Wed May 18, 2011 5:57 pm

Hi Ivan,

only the services created with a "create*" method on omero.api.ServiceFactoryPrx (here: "createRawFileStore") need to be closed. Alternatively, you can check if the service is a subclass of omero.api.StatefulServiceInterfacePrx, in which case it is guaranteed to have a close method.

Cheers,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest