New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java gateway bugfixes #5513
Java gateway bugfixes #5513
Conversation
@@ -142,7 +142,7 @@ | |||
public static final String PROP_STATELESS_SERVICE_CREATED = "PROP_STATELESS_SERVICE_CREATED"; | |||
|
|||
/** Regex matching ICE Session ID */ | |||
private static final String ICE_SESSION_ID_REGEX = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"; | |||
public static final String ICE_SESSION_ID_REGEX = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Might be worth moving this to an Ice constant and using this server-side as well. To data, I've always treated the session IDs as opaque, i.e. no assumptions could be made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation says that each Ice object has an UUID and so does the session ID look like, although I didn't find anything in the documentation which explicitely says that the session ID is an UUID, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, actually I could also just use Java's builtin UUID.fromString()
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although I didn't find anything in the documentation which explicitely says that the session ID is an UUID, too.
Exactly. It's not yet part of the contract.
ExperimenterData root2 = gw2.connect(c2); | ||
Assert.assertNotNull(root2); | ||
Assert.assertEquals(gw2.getSessionId(root2), sessionId); | ||
gw2.disconnect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If something throws re: gw2
, gw1
will not be closed which could hang the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could make the Gateway AutoCloseable ( c31e719 ), would make things easier. Any objections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objections. 😃
9a777c6
to
c31e719
Compare
Just for reference, already noticed the problem with the 'swallowed' exceptions in 5.2 #4344 (comment) and Josh's idea of an 'ExceptionHandler', but forgot about it again. General exception handling overhaul would be a breaking change, but probably necessary, maybe for 5.5 then... |
1002462
to
f20bf97
Compare
f20bf97
to
a3915ee
Compare
@@ -130,7 +130,7 @@ | |||
public Collection<DataObject> getHierarchy(SecurityContext ctx, Class rootType, | |||
List<Long> rootIDs, Parameters options) | |||
throws DSOutOfServiceException, DSAccessException { | |||
if (rootType == null || CollectionUtils.isEmpty(rootIDs)) | |||
if (rootType == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rootIDs.isEmpty()
case will go okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, same behaviour as roodIDs == null (get all).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, maybe also mention in Javadoc, just add "or empty" or something.
Not quite sure, ready to merge or relist for standup? |
Has it yet had any functional testing? |
Nope, doesn't look like it. I'll relist and maybe @pwalczysko can have a look when he can spare some time. |
All the four bullet points from the "Testing this PR" header passed. |
Thanks, @dominikl. At some point, it would be interesting to review your changes here against the Python Gateway (i.e. properly specifying the string format for the session ids, etc.) Merging into the |
With ome#5513 the java gateway removes stale connectors (e.g. after server restart). So Insight can't use the gateway any longer to provide the information which images are currently viewed, the stale references are removed after server restart / reconnect.
What this PR does
joinSession
attempt is made, if the username matches UUID format.Facility.handleException()
method silently 'swallowed' exceptions caused by connection issues. With this PR aDSOutofServiceException
is thrown in these cases.JoinSessionCredentials
to provide a specific class for session id logins.Gateway
AutoCloseable
so that it can be used in try-with-resources blocks.Testing this PR
Related reading
Facility.handleException()
and server restart issue: https://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8367--
*) Example client to use for testing server restart