Page 1 of 1

Closing services

PostPosted: Wed May 18, 2011 5:04 pm
by icaoberg
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()

Re: Closing services

PostPosted: Wed May 18, 2011 5:57 pm
by jmoore
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.