-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,18 @@ | |
import java.util.concurrent.ExecutionException; | ||
|
||
/** | ||
* Utility for checking a connection's state. | ||
* | ||
* @author <a href="mailto:[email protected]">Mark Paluch</a> | ||
* @since 14.05.14 22:05 | ||
*/ | ||
public class Connections { | ||
|
||
/** | ||
* | ||
* @param connection | ||
* @return true if the connection is valid (ping works). | ||
*/ | ||
public final static boolean isValid(Object connection) { | ||
|
||
checkNotNull(connection, "connection must not be null"); | ||
|
@@ -39,6 +47,11 @@ public final static boolean isValid(Object connection) { | |
throw new IllegalArgumentException("Connection class " + connection.getClass() + " not supported"); | ||
} | ||
|
||
/** | ||
* | ||
* @param connection | ||
* @return true if the connection is open. | ||
*/ | ||
public final static boolean isOpen(Object connection) { | ||
|
||
checkNotNull(connection, "connection must not be null"); | ||
|
@@ -55,6 +68,11 @@ public final static boolean isOpen(Object connection) { | |
throw new IllegalArgumentException("Connection class " + connection.getClass() + " not supported"); | ||
} | ||
|
||
/** | ||
* Closes a connection. | ||
* | ||
* @param connection | ||
*/ | ||
public static void close(Object connection) { | ||
|
||
checkNotNull(connection, "connection must not be null"); | ||
|