Skip to content

Commit

Permalink
Use try with resource
Browse files Browse the repository at this point in the history
closes #253
  • Loading branch information
ar committed Jul 7, 2022
1 parent 404d642 commit eb7a598
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions modules/status/src/main/java/org/jpos/ee/status/Ping.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public String checkService () {
boolean rc = false;
String detail = "";
long start = System.currentTimeMillis();
try {
Socket socket = new Socket(host, port);
try (Socket socket = new Socket(host, port)){
socket.setSoLinger (true, 0);
socket.close();
rc = true;
} catch (ConnectException e) {
rc = true;
Expand Down

0 comments on commit eb7a598

Please sign in to comment.