Line | |
---|
1 | package geniusweb.connection;
|
---|
2 |
|
---|
3 | import java.io.IOException;
|
---|
4 |
|
---|
5 | import geniusweb.references.Reference;
|
---|
6 | import tudelft.utilities.repository.NoResourcesNowException;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * factory that can turn a {@link Reference} into a connection to that
|
---|
10 | * reference.
|
---|
11 | *
|
---|
12 | * @param <INTYPE> the type of incoming messages. Incoming messages are
|
---|
13 | * received through Listener#not. Incoming messages are usually
|
---|
14 | * asynchronous.
|
---|
15 | * @param <OUTTYPE> the type of outgoing messages. Outgoing messages can be sent
|
---|
16 | * directly with #send.
|
---|
17 | */
|
---|
18 | public interface ConnectionFactory<INTYPE, OUTTYPE> {
|
---|
19 | /**
|
---|
20 | *
|
---|
21 | * @param reference the {@link Reference} to a {@link Connectable}
|
---|
22 | * @return connection to provided reference
|
---|
23 | * @throws IOException if the connection can not be made because
|
---|
24 | * of a network or address related problem.
|
---|
25 | * This points to something non-trivially
|
---|
26 | * that may require user intervention to fix
|
---|
27 | * something.
|
---|
28 | * @throws NoResourcesNowException if the connection can not be made at this
|
---|
29 | * moment because of lack of resources on
|
---|
30 | * the server. This suggest to retry later.
|
---|
31 | */
|
---|
32 | Connection<INTYPE, OUTTYPE> connect(Reference reference)
|
---|
33 | throws IOException, NoResourcesNowException;
|
---|
34 |
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.