org.interledger.link.Connectable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of link-core Show documentation
Show all versions of link-core Show documentation
A Link abstraction for connecting Interledger peers.
package org.interledger.link;
import java.io.Closeable;
import java.util.concurrent.CompletableFuture;
/**
* Defines how to connect and disconnect.
*/
public interface Connectable extends Closeable {
boolean CONNECTED = true;
boolean NOT_CONNECTED = false;
/**
* Connect to the remote peer.
*
* @return A {@link CompletableFuture} with the result of this call.
*/
CompletableFuture connect();
/**
* Disconnect from the remote peer.
*
* @return A {@link CompletableFuture} with the result of this call.
*/
CompletableFuture disconnect();
@Override
default void close() {
disconnect().join();
}
/**
* Determines if this Connectable is connected or not. If authentication is required, this method
* will return false until an authenticated session is opened.
*
* @return {@code true} if this Connectable is connected; {@code false} otherwise.
*/
boolean isConnected();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy