Interface Sender<T>
- All Known Implementing Classes:
WsSenderClient
public interface Sender<T>
Represents a sender instance for converted transport data.
- Author:
- Holger Eichelberger, SSE
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the sender.voidCloses the sender but blocks until closing is done or failed to do so.voidconnect()Initiates a connection.booleanBlocks until connected or failed to do so.getURI()Returns the URI that this sender is connected to.booleanisClosed()Is the state closed.booleanisOpen()Is the state open.voidSends data to the connected server.
-
Method Details
-
connect
Initiates a connection. This method does not block.- Throws:
IOException
-
connectBlocking
Blocks until connected or failed to do so.- Returns:
- returns whether it succeeded or not.
- Throws:
IOException- thrown when connection fails, particularly when the blocking thread gets interrupted
-
isOpen
boolean isOpen()Is the state open.- Returns:
truefor open,falsefor not open
-
isClosed
boolean isClosed()Is the state closed.- Returns:
truefor closed,falsefor not closed
-
send
Sends data to the connected server.- Parameters:
data- the data that will be transmitted.- Throws:
IOException- if the data cannot be send/translated
-
close
void close()Closes the sender. This method does not block. -
closeBlocking
Closes the sender but blocks until closing is done or failed to do so.- Throws:
IOException- when the closing fails
-
getURI
URI getURI()Returns the URI that this sender is connected to.- Returns:
- the URI connected to
-