You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/08/14 21:47:29 UTC
[06/30] git commit: updated refs/heads/master to 64ff67d
CLOUDSTACK-8656: try-with resource on socket channel
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/55df0677
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/55df0677
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/55df0677
Branch: refs/heads/master
Commit: 55df06779b216ab82a09ae531e91628418c205fa
Parents: ea88691
Author: Daan Hoogland <da...@gmail.com>
Authored: Tue Aug 4 14:12:01 2015 +0200
Committer: Daan Hoogland <da...@gmail.com>
Committed: Tue Aug 4 14:12:01 2015 +0200
----------------------------------------------------------------------
.../hyperv/resource/HypervDirectConnectResource.java | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55df0677/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 0e57df4..17c5708 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -2363,10 +2363,8 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
// VM patching/rebooting time that may need
int retry = _retry;
while (System.currentTimeMillis() - startTick <= _opsTimeout || --retry > 0) {
- SocketChannel sch = null;
- try {
- s_logger.info("Trying to connect to " + ipAddress);
- sch = SocketChannel.open();
+ s_logger.info("Trying to connect to " + ipAddress);
+ try (SocketChannel sch = SocketChannel.open();) {
sch.configureBlocking(true);
sch.socket().setSoTimeout(5000);
// we need to connect to the control ip address to check the status of the system vm
@@ -2385,13 +2383,6 @@ public class HypervDirectConnectResource extends ServerResourceBase implements S
s_logger.debug("[ignored] interupted while waiting to retry connecting to vm after exception: "+e.getLocalizedMessage());
}
}
- } finally {
- if (sch != null) {
- try {
- sch.close();
- } catch (IOException e) {
- }
- }
}
try {