MessageReader. This implementation wraps a java.io.InputStream .
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Thread | |
| pack-priv final Lock | dispatchingThreadLock
Lock to protect the pending message. |
| pack-priv LinkedList | |
| private FullReadInputStream | inputStream
Stream as a source of messages. |
| pack-priv BlockingQueue | messageListenerQueue
Queue of |
| pack-priv LinkedList | |
| private Protocol. | |
| pack-priv final Lock | syncOperationLock
Lock to protect async reads from sync ones. |
| Access | Constructor and Description |
|---|---|
| public | SyncMessageReader(FullReadInputStream inputStream, Protocol.
|
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public void | pushMessageListener(final MessageListener<XMessage> listener)
Overrides default com. Queue a |
| public XMessageHeader | readHeader()
Implements com. Read the next message header from server, possibly blocking indefinitely until the message is received. |
| private XMessageHeader | |
| public XMessage | readMessage(Optional<XMessage>
Message object to reuse. May be ignored by implementation.MessageHeader instanceImplements com. Read message from server into to the given |
| public XMessage | readMessage(Optional<XMessage>
Message object to reuse. May be ignored by implementation.Expected type of message. expectedType)Overrides default com. Implements com. Read message from server into to the given |
| private <T extends Message> T |
| dispatchingThread | back to summary |
|---|---|
| pack-priv Thread dispatchingThread | |
| dispatchingThreadLock | back to summary |
|---|---|
| pack-priv final Lock dispatchingThreadLock Lock to protect the pending message. | |
| headersQueue | back to summary |
|---|---|
| pack-priv LinkedList<XMessageHeader> headersQueue | |
| inputStream | back to summary |
|---|---|
| private FullReadInputStream inputStream Stream as a source of messages. | |
| messageListenerQueue | back to summary |
|---|---|
| pack-priv BlockingQueue<MessageListener<XMessage>> messageListenerQueue Queue of | |
| messagesQueue | back to summary |
|---|---|
| pack-priv LinkedList<Message> messagesQueue | |
| protocolEventHandler | back to summary |
|---|---|
| private Protocol. | |
| syncOperationLock | back to summary |
|---|---|
| pack-priv final Lock syncOperationLock Lock to protect async reads from sync ones. | |
| SyncMessageReader | back to summary |
|---|---|
| public SyncMessageReader(FullReadInputStream inputStream, Protocol. | |
| getNextNonNoticeMessageType | back to summary |
|---|---|
| public int getNextNonNoticeMessageType() throws IOException | |
| pushMessageListener | back to summary |
|---|---|
| public void pushMessageListener(final MessageListener<XMessage> listener) Overrides default com. Doc from com. Queue a
| |
| readHeader | back to summary |
|---|---|
| public XMessageHeader readHeader() throws IOException Implements com. Doc from com. Read the next message header from server, possibly blocking indefinitely until the message is received.
| |
| readHeaderLocal | back to summary |
|---|---|
| private XMessageHeader readHeaderLocal() throws IOException | |
| readMessage | back to summary |
|---|---|
| public XMessage readMessage(Optional<XMessage> reuse, XMessageHeader hdr) throws IOException Implements com. Doc from com. Read message from server into to the given
| |
| readMessage | back to summary |
|---|---|
| public XMessage readMessage(Optional<XMessage> reuse, int expectedType) throws IOException Overrides default com. Implements com. Doc from com. Read message from server into to the given | |
| readMessageLocal | back to summary |
|---|---|
private <T extends Message> T readMessageLocal(Class<T> messageClass, boolean fromQueue)
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | POLL_TIMEOUT
The timeout value for queue.poll(timeout, unit) defining the time after which we close and unregister the dispatching thread. |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| POLL_TIMEOUT | back to summary |
|---|---|
| private static final long POLL_TIMEOUT The timeout value for queue.poll(timeout, unit) defining the time after which we close and unregister the dispatching thread. On the other hand, a bigger timeout value allows us to keep dispatcher thread running while multiple concurrent asynchronous read operations are pending, thus avoiding the delays for new dispatching threads creation. | |
| started | back to summary |
|---|---|
| pack-priv boolean started | |
| ListenersDispatcher | back to summary |
|---|---|
| public ListenersDispatcher() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |