It is possible for a stream to be waiting for a connection allocation when a stream allocation is made. Therefore this class tracks the type of allocation that the stream is waiting for to ensure that notifications are correctly triggered.
With the implementation at the time of writing, it is not possible for a stream to receive an unexpected connection notification as these are only issues to streams in the backlog and a stream must be waiting for a connection allocation in order to be placed on the backlog. However, as a precaution, this class protects against unexpected connection notifications.
It is important for asynchronous processing not to notify unless a notification is expected else a dispatch will be performed unnecessarily which may lead to unexpected results.
A previous implementation used separate locks for the stream and connection notifications. However, correct handling of allocation waiting requires holding the stream lock when making the decision to wait. Therefore both allocations need to wait on the Stream.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final Log | |
| private static final int | |
| private static final StringManager | |
| private static final int | |
| private final Stream | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv void | |
| pack-priv void |
| CONNECTION | back to summary |
|---|---|
| private static final int CONNECTION | |
| log | back to summary |
|---|---|
| private static final Log log | |
| NONE | back to summary |
|---|---|
| private static final int NONE | |
| sm | back to summary |
|---|---|
| private static final StringManager sm | |
| STREAM | back to summary |
|---|---|
| private static final int STREAM | |
| stream | back to summary |
|---|---|
| private final Stream stream | |
| waitingFor | back to summary |
|---|---|
| private int waitingFor | |
| WindowAllocationManager | back to summary |
|---|---|
| pack-priv WindowAllocationManager(Stream stream) | |
| isWaitingFor | back to summary |
|---|---|
| private boolean isWaitingFor(int waitTarget) | |
| isWaitingForConnection | back to summary |
|---|---|
| pack-priv boolean isWaitingForConnection() | |
| isWaitingForStream | back to summary |
|---|---|
| pack-priv boolean isWaitingForStream() | |
| notify | back to summary |
|---|---|
| private void notify(int notifyTarget) | |
| notifyAny | back to summary |
|---|---|
| pack-priv void notifyAny() | |
| notifyConnection | back to summary |
|---|---|
| pack-priv void notifyConnection() | |
| notifyStream | back to summary |
|---|---|
| pack-priv void notifyStream() | |
| waitFor | back to summary |
|---|---|
| private void waitFor(int waitTarget, final long timeout) throws InterruptedException | |
| waitForConnection | back to summary |
|---|---|
| pack-priv void waitForConnection(long timeout) throws InterruptedException | |
| waitForConnectionNonBlocking | back to summary |
|---|---|
| pack-priv void waitForConnectionNonBlocking() | |
| waitForNonBlocking | back to summary |
|---|---|
| private void waitForNonBlocking(int waitTarget) | |
| waitForStream | back to summary |
|---|---|
| pack-priv void waitForStream(long timeout) throws InterruptedException | |
| waitForStreamNonBlocking | back to summary |
|---|---|
| pack-priv void waitForStreamNonBlocking() | |