OMERO Java API: DataManagerFacility.saveAndReturnObject fail
Posted: Wed Sep 13, 2017 3:57 pm
I'm seeing an issue with DataManagerFacility.saveAndReturnObject failing after the service that has been using this code has been running for a while. (I'm using OMERO 5.3.3 on Linux)
My suspicion is that the session has grown stale, as no traffic has been going to OMERO from the service for a bit, and this causes the above call to fail.
I don't get an Exception, and looking through the DataManagerFacility.saveAndReturnObject code, I think what might be happening is that we hit this part inside handleException:
ConnectionStatus b = getConnectionStatus(t);
if (b != ConnectionStatus.OK)
return;
if (!gateway.isConnected())
return;
In this case the exception is eaten up, and we get back a null pointer from DataManagerFacility.saveAndReturnObject.
Here is how I'm calling the API:
val rv = dm.saveAndReturnObject(ctx, link)
The context (ctx) here has been initialized at service startup with:
Should I try to get a new ctx (login again) and retry, or would there be a better reconnect facility in the omero lib itself that I'm not aware of?
thanks,
thushara
My suspicion is that the session has grown stale, as no traffic has been going to OMERO from the service for a bit, and this causes the above call to fail.
I don't get an Exception, and looking through the DataManagerFacility.saveAndReturnObject code, I think what might be happening is that we hit this part inside handleException:
ConnectionStatus b = getConnectionStatus(t);
if (b != ConnectionStatus.OK)
return;
if (!gateway.isConnected())
return;
In this case the exception is eaten up, and we get back a null pointer from DataManagerFacility.saveAndReturnObject.
Here is how I'm calling the API:
val rv = dm.saveAndReturnObject(ctx, link)
The context (ctx) here has been initialized at service startup with:
- Code: Select all
lazy val omeroGateway = new Gateway(new SimpleLogger())
def login(user: String, pass: String, host: String, port: Int): SecurityContext = {
val cred = new LoginCredentials()
cred.getServer().setHostname(host)
cred.getServer().setPort(port)
cred.getUser().setUsername(user);
cred.getUser().setPassword(pass);
val userObj = omeroGateway.connect(cred)
val ctx = new SecurityContext(userObj.getGroupId())
ctx
}
lazy val ctx = login(omeroUser, omeroPassword, omeroHost, omeroPort)
Should I try to get a new ctx (login again) and retry, or would there be a better reconnect facility in the omero lib itself that I'm not aware of?
thanks,
thushara