-
Notifications
You must be signed in to change notification settings - Fork 97
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
Public receive method in SBPFramer Java class #804
Conversation
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.
Seems reasonable to me, but I'm less versed on Java. @silverjam think this is a problem?
Why is this needed? Can we add more description to the PR? |
@silverjam I updated the description with some more details. |
@IsakTjernberg @jbangelo Could we expose this state in the iterator instead? E.g. store the last exception that occurs, or record a flag and expose a new interface for that? |
@silverjam well, wouldn't that complicate things unnecessarily? The |
Can Java |
@IsakTjernberg I’m thinking we should maintain the existing abstractions if possible, how does making this public fix the problem? Don’t you need to create your own reader / iterator logic in order to detect the error? I was thinking SBPHandler would just gain a Or, we could create a variant of SBPHandler that doesn’t swallow the error. |
@silverjam Ok, fair point. Does the |
@IsakTjernberg |
For reference, were the threaded iterator records the IO exception: And the "propagation": |
In other words, we had this exact problem with the original design of the Python sbp client library (with it swallowing exceptions, so you couldn't detect connection drops)-- and it looks like the Java sbp client library mirrors Python in terms of trying to put the blocking receive logic on a thread, so it's not surprising that it has the same issue. |
@silverjam Ok, thanks! I'll try to replicate it similarly in the Java parts. |
@silverjam The new commit stops the iterator from forever waiting for new messages, but unfortunately does not expose the underlying exception. In |
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.
Ok, maybe we can tackle the exception bubbling later
One suggest on naming, otherwise looks fine
@@ -16,4 +16,5 @@ | |||
/** Interface for SBP message handlers. */ | |||
public interface SBPCallback { | |||
void receiveCallback(SBPMessage msg); | |||
void allCallbacksDone(); |
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.
Just “callbackDone” seems sufficient
Need this method as
public
to be able to see if the connection is broken or not. Access outside package was only available through an iterator inSBPHandler
which swallows the exception.