package geniusweb.connection; import java.io.IOException; import geniusweb.references.Reference; import tudelft.utilities.repository.NoResourcesNowException; /** * factory that can turn a {@link Reference} into a connection to that * reference. * * * @param the type of incoming messages. Incoming messages are * received through Listener#not. Incoming messages are usually * asynchronous. * @param the type of outgoing messages. Outgoing messages can be sent * directly with #send. */ public interface ConnectionFactory { /** * * @param reference the {@link Reference} to a {@link Connectable} * @return connection to provided reference * @throws IOException if the connection can not be made because * of a network or address related problem. * This points to something non-trivially * that may require user intervention to fix * something. * @throws NoResourcesNowException if the connection can not be made at this * moment because of lack of resources on * the server. This suggest to retry later. */ ConnectionEnd connect(Reference reference) throws IOException, NoResourcesNowException; }