Class ClientStreamReceiver
- All Implemented Interfaces:
- AutoCloseable,- Link<StreamReceiver>,- StreamReceiver
StreamReceiver.- 
Field SummaryFields inherited from class org.apache.qpid.protonj2.client.impl.ClientReceiverLinkTypeprotonReceiverFields inherited from class org.apache.qpid.protonj2.client.impl.ClientLinkTypeclosed, CLOSED_UPDATER, closeFuture, executor, failureCause, linkId, linkRemotelyClosedHandler, openFuture, remoteSource, remoteTarget, session
- 
Method SummaryModifier and TypeMethodDescriptionaddCredit(int credits) Adds credit to theStreamReceiverlink for use when the receiver has not been configured with a credit window.drain()Requests the remote to drain previously granted credit for thisStreamReceiverlink.protected voidhandleDeliveryRead(IncomingDelivery delivery) protected voidlinkSpecificCleanupHandler(ClientException failureCause) longReturns the number of Deliveries that are currently held in theReceiverdelivery queue.receive()Blocking receive method that waits forever for the remote to provide aStreamReceiverMessagefor consumption.Blocking receive method that waits the given time interval for the remote to provide aStreamReceiverMessagefor consumption.protected voidprotected voidprotected StreamReceiverself()Non-blocking receive method that either returns a message is one is immediately available or returns null if none is currently at hand.Methods inherited from class org.apache.qpid.protonj2.client.impl.ClientReceiverLinkTypehandleDeliveryAborted, handleDeliveryStateRemotelyUpdated, handleReceiverCreditUpdated, linkSpecificLocalCloseHandler, linkSpecificLocalOpenHandler, linkSpecificRemoteCloseHandler, linkSpecificRemoteOpenHandler, protonLinkMethods inherited from class org.apache.qpid.protonj2.client.impl.ClientLinkTypeaddress, checkClosedOrFailed, client, close, close, closeAsync, closeAsync, connection, desiredCapabilities, detach, detach, detachAsync, detachAsync, handleEngineShutdown, handleLocalCloseOrDetach, handleLocalOpen, handleParentEndpointClosed, handleRemoteCloseOrDetach, handleRemoteOpen, immediateLinkShutdown, notClosedOrFailed, notClosedOrFailed, offeredCapabilities, openFuture, properties, session, source, target, waitForOpenToCompleteMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.client.Linkaddress, client, close, close, closeAsync, closeAsync, connection, desiredCapabilities, detach, detach, detachAsync, detachAsync, offeredCapabilities, openFuture, properties, session, source, target
- 
Method Details- 
receiveDescription copied from interface:StreamReceiverBlocking receive method that waits forever for the remote to provide aStreamReceiverMessagefor consumption.Receive calls will only grant credit on their own if a credit window is configured in the StreamReceiverOptionswhich is done by default. If the client application has configured no credit window than this method will not grant any credit when it enters the wait for new incoming messages.- Specified by:
- receivein interface- StreamReceiver
- Returns:
- a new Deliveryreceived from the remote.
- Throws:
- ClientException- if the- StreamReceiveror its parent is closed when the call to receive is made.
 
- 
receiveDescription copied from interface:StreamReceiverBlocking receive method that waits the given time interval for the remote to provide aStreamReceiverMessagefor consumption. The amount of time this method blocks is based on the timeout value. If the timeout is negative then it blocks until a Delivery is received. If the timeout is equal to zero then it will not block and simply return aStreamReceiverMessageif one is available locally. If the timeout value is greater than zero then it blocks up to timeout amount of time.Receive calls will only grant credit on their own if a credit window is configured in the StreamReceiverOptionswhich is done by default. If the client application has not configured a credit window or granted credit manually this method will not automatically grant any credit when it enters the wait for a new incomingStreamReceiverMessage.- Specified by:
- receivein interface- StreamReceiver
- Parameters:
- timeout- The timeout value used to control how long the receive method waits for a new- Delivery.
- unit- The unit of time that the given timeout represents.
- Returns:
- a new StreamReceiverMessagereceived from the remote.
- Throws:
- ClientException- if the- StreamReceiveror its parent is closed when the call to receive is made.
 
- 
tryReceiveDescription copied from interface:StreamReceiverNon-blocking receive method that either returns a message is one is immediately available or returns null if none is currently at hand.- Specified by:
- tryReceivein interface- StreamReceiver
- Returns:
- a new StreamReceiverMessagereceived from the remote or null if no pending deliveries are available.
- Throws:
- ClientException- if the- StreamReceiveror its parent is closed when the call to try to receive is made.
 
- 
addCreditDescription copied from interface:StreamReceiverAdds credit to theStreamReceiverlink for use when the receiver has not been configured with a credit window. When credit window is configured credit replenishment is automatic and calling this method will result in an exception indicating that the operation is invalid.If the Receiveris draining and this method is called an exception will be thrown to indicate that credit cannot be replenished until the remote has drained the existing link credit.- Specified by:
- addCreditin interface- StreamReceiver
- Parameters:
- credits- The number of credits to add to the- Receiverlink.
- Returns:
- this StreamReceiverinstance.
- Throws:
- ClientException- if an error occurs while attempting to add new- StreamReceiverlink credit.
 
- 
drainDescription copied from interface:StreamReceiverRequests the remote to drain previously granted credit for thisStreamReceiverlink.- Specified by:
- drainin interface- StreamReceiver
- Returns:
- a Futurethat will be completed when the remote drains thisStreamReceiverlink.
- Throws:
- ClientException- if an error occurs while attempting to drain the link credit.
 
- 
queuedDeliveriesDescription copied from interface:StreamReceiverReturns the number of Deliveries that are currently held in theReceiverdelivery queue. This number is likely to change immediately following the call as more deliveries arrive but can be used to determine if any pendingDeliverywork is ready.- Specified by:
- queuedDeliveriesin interface- StreamReceiver
- Returns:
- the number of deliveries that are currently buffered locally.
- Throws:
- ClientException- if an error occurs while attempting to fetch the queue count.
 
- 
self- Specified by:
- selfin class- ClientLinkType<StreamReceiver,- Receiver> 
 
- 
handleDeliveryRead- Specified by:
- handleDeliveryReadin class- ClientReceiverLinkType<StreamReceiver>
 
- 
replenishCreditIfNeededprotected void replenishCreditIfNeeded()- Specified by:
- replenishCreditIfNeededin class- ClientReceiverLinkType<StreamReceiver>
 
- 
linkSpecificCleanupHandler- Overrides:
- linkSpecificCleanupHandlerin class- ClientReceiverLinkType<StreamReceiver>
 
- 
recreateLinkForReconnectprotected void recreateLinkForReconnect()- Specified by:
- recreateLinkForReconnectin class- ClientLinkType<StreamReceiver,- Receiver> 
 
 
-