-
Notifications
You must be signed in to change notification settings - Fork 118
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
Timeout in connectAndBind method #7
Open
Yaude
wants to merge
3
commits into
uudashr:master
Choose a base branch
from
Yaude:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10
−1
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the case is we set timeout for 6000 millis
so the total connectAndBind can be more than 6000 millis.. why? because conn.setSoTimeout was set to enquireLinkTimer (of course the value is non 0)
You get what I mean?
I think the conn.setSoTimeout(...) should be set to the value of the remaining timeout taken by the createConnection... and when the state is bounded then the conn.setSoTimeout(...) should be set to enquireLinkTimer (set the timeout to normal)
It something like (CMIIW):
long startTime = System.currentTimeMillis();
conn = connFactory.createConnection(host, port, timeout);
long interval = System.currentTimeMillis() - startTime;
conn.setSoTimeout(timeout - interval);
So the total connectAndBind would be no longer than 6000 millis
... and when the state is bounded
conn.setSoTimeout(getEnquireLinkTimer());
What do you think?
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.
On 24/05/2012 09:30, uudashr wrote:
I think that the timeout which is defined in connectAndBind method is
totally different from those which is used in setSoTimeout.
The first one is for the establishment of the connection and replaces
the socket default binding timeout.
The second one is used for requests run on this socket.
When looking at the source code, I see that setEnquireLinkTimer is never
used, so I think that this second timeout is allways the same and is
independant from the first one.
Therefor, the time spent during the binding doesn't impact the
setSoTimeout which is allways the same.
That's my mind
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.
Awsome.
the method signature:
String connectAndBind(String host, int port, BindParameter bindParam, long timeout)
at fist I was thinking about this question: "what is the timeout of method connectAndBind?" or "maximum time taken to connectAndBind?"
if you see, there is two things happen on connectAndBind
OR
so what you say is that we have different thing here.
it means the total time taken for connectAndBind is connectTimeout + bindTimeout
so, let's put something to make it clean such as documentation that describe about this thing and maybe change the variable name of "timeout" to "connectTimeout". what do you think? after that I'll merge the code.
btw setEnquireLinkTimer use by user to change the timeout, in order to send the enquire link command