Skip to content
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

Support Connection get/setNetworkTimeout(). #253

Merged
merged 1 commit into from
Apr 17, 2017

Conversation

brettwooldridge
Copy link
Contributor

@brettwooldridge brettwooldridge commented Apr 12, 2017

This is essential to minimize the effects of network partition events.

Related to #72 and #85.

@codecov-io
Copy link

codecov-io commented Apr 12, 2017

Codecov Report

Merging #253 into dev will increase coverage by 0.04%.
The diff coverage is 55.55%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #253      +/-   ##
============================================
+ Coverage     33.67%   33.71%   +0.04%     
- Complexity     1490     1498       +8     
============================================
  Files            98       98              
  Lines         23422    23447      +25     
  Branches       3845     3846       +1     
============================================
+ Hits           7887     7906      +19     
- Misses        13967    13972       +5     
- Partials       1568     1569       +1
Flag Coverage Δ Complexity Δ
#JDBC41 33.56% <55.55%> (+0.03%) 1493 <2> (+7) ⬆️
#JDBC42 33.64% <55.55%> (+0.03%) 1494 <2> (+5) ⬆️
Impacted Files Coverage Δ Complexity Δ
...t/sqlserver/jdbc/SQLServerConnectionPoolProxy.java 13.61% <0%> (-0.22%) 12 <0> (ø)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 37.84% <100%> (-0.25%) 0 <0> (ø)
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 41.27% <60%> (+0.17%) 228 <2> (+1) ⬆️
...om/microsoft/sqlserver/jdbc/SimpleInputStream.java 40.44% <0%> (-1.48%) 9% <0%> (-1%)
...m/microsoft/sqlserver/jdbc/SQLServerResultSet.java 24.17% <0%> (+0.16%) 171% <0%> (+1%) ⬆️
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 45.13% <0%> (+0.21%) 183% <0%> (+3%) ⬆️
...c/main/java/com/microsoft/sqlserver/jdbc/Util.java 40.61% <0%> (+0.71%) 53% <0%> (+1%) ⬆️
...rc/main/java/com/microsoft/sqlserver/jdbc/DDC.java 25.66% <0%> (+1.11%) 42% <0%> (+3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3918429...9a20061. Read the comment docs.

* Get the current socket SO_TIMEOUT value.
*
* @return the current socket timeout value
* @throws IOExceptionthrown if the socket timeout cannot be read
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you forgot to put a space between IOException and thrown

}

public void setNetworkTimeout(Executor executor,
int timeout) throws SQLException {
// this operation is not supported
throw new SQLFeatureNotSupportedException(SQLServerException.getErrString("R_notSupported"));
loggerExternal.entering(getClassNameLogging(), "setNetworkTimeout");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may also want to log the value of timeout by doing something like loggerExternal.entering(getClassNameLogging(), "setNetworkTimeout", timeout);

Copy link
Contributor

@xiangyushawn xiangyushawn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brettwooldridge this PR looks perfect to me! Thank you for your contribution. I left a couple of comments here, could you please fix those very minor things before we merge this excellent work?

@brettwooldridge
Copy link
Contributor Author

@v-xiangs Review recommendations integrated.

@xiangyushawn xiangyushawn merged commit 7d65ebb into microsoft:dev Apr 17, 2017
@xiangyushawn
Copy link
Contributor

@brettwooldridge Thank you for your contribution.

}

loggerExternal.exiting(getClassNameLogging(), "getNetworkTimeout");
return timeout;
}

public void setNetworkTimeout(Executor executor,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This misses the requirement to check for permission SQLPermission.setNetworkTimeout

Copy link
Contributor

@xiangyushawn xiangyushawn Apr 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrotteveel Thank you for pointing it out. I created a PR #255 for it. Could you or @brettwooldridge review it and see if you are satisfied with it? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants