Deprecated disconnect() in favour of close()

This commit is contained in:
Gideon le Grange 2015-04-28 14:09:26 +02:00
parent 61691cb9a6
commit 1bfc4fbb70
1 changed files with 10 additions and 2 deletions

View File

@ -28,6 +28,7 @@ public abstract class ApiConnection implements AutoCloseable {
* @param timeout The connection timeout to use when opening the connection. * @param timeout The connection timeout to use when opening the connection.
* @return The ApiConnection * @return The ApiConnection
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem connecting * @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem connecting
* @since 2.1
*/ */
public static ApiConnection connectTLS(String host, int port, int timeout) throws MikrotikApiException { public static ApiConnection connectTLS(String host, int port, int timeout) throws MikrotikApiException {
return ApiConnectionImpl.connect(host, port, true, timeout); return ApiConnectionImpl.connect(host, port, true, timeout);
@ -63,6 +64,7 @@ public abstract class ApiConnection implements AutoCloseable {
* @param timeout The connection timeout to use when opening the connection. * @param timeout The connection timeout to use when opening the connection.
* @return The ApiConnection * @return The ApiConnection
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem connecting * @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem connecting
* @since 2.1
*/ */
public static ApiConnection connect(String host, int port, int timeout) throws MikrotikApiException { public static ApiConnection connect(String host, int port, int timeout) throws MikrotikApiException {
return ApiConnectionImpl.connect(host, port, false, timeout); return ApiConnectionImpl.connect(host, port, false, timeout);
@ -97,9 +99,9 @@ public abstract class ApiConnection implements AutoCloseable {
public abstract boolean isConnected(); public abstract boolean isConnected();
/** /**
* Disconnect from the remote API * @deprecated Replaced by close() which conforms to AutoCloseable
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem disconnecting
*/ */
@Deprecated
public abstract void disconnect() throws MikrotikApiException; public abstract void disconnect() throws MikrotikApiException;
/** /**
@ -143,9 +145,15 @@ public abstract class ApiConnection implements AutoCloseable {
* *
* @param timeout The time out in milliseconds. * @param timeout The time out in milliseconds.
* @throws MikrotikApiException Thrown if the timeout specified is invalid. * @throws MikrotikApiException Thrown if the timeout specified is invalid.
* @since 2.1
*/ */
public abstract void setTimeout(int timeout) throws MikrotikApiException; public abstract void setTimeout(int timeout) throws MikrotikApiException;
/**
* Disconnect from the remote API
* @throws me.legrange.mikrotik.MikrotikApiException Thrown if there is a problem disconnecting
* @since 2.2
*/
@Override @Override
public abstract void close() throws ApiConnectionException; public abstract void close() throws ApiConnectionException;