Class ReceiverImpl
java.lang.Object
org.apache.qpid.proton.engine.impl.EndpointImpl
org.apache.qpid.proton.engine.impl.LinkImpl
org.apache.qpid.proton.engine.impl.ReceiverImpl
- All Implemented Interfaces:
Endpoint
,Extendable
,Link
,ProtonJEndpoint
,Receiver
-
Method Summary
Modifier and TypeMethodDescriptionboolean
advance()
Attempts to advance the current delivery.void
drain
(int credit) boolean
draining()
void
flow
(int credits) Adds the specified number of credits.int
recv()
Receive message data for the current delivery returning the data in a Readable buffer.int
recv
(byte[] bytes, int offset, int size) Receive message data for the current delivery.int
recv
(WritableBuffer buffer) Receive message data for the current delivery.void
setDrain
(boolean drain) Methods inherited from class org.apache.qpid.proton.engine.impl.LinkImpl
addCredit, current, delivery, delivery, detach, detached, drained, getConnectionImpl, getCredit, getDesiredCapabilities, getDrain, getMaxMessageSize, getName, getOfferedCapabilities, getProperties, getQueued, getReceiverSettleMode, getRemoteDesiredCapabilities, getRemoteMaxMessageSize, getRemoteOfferedCapabilities, getRemoteProperties, getRemoteReceiverSettleMode, getRemoteSenderSettleMode, getRemoteSource, getRemoteTarget, getSenderSettleMode, getSession, getSource, getTarget, getUnsettled, head, next, setCredit, setDesiredCapabilities, setMaxMessageSize, setOfferedCapabilities, setProperties, setReceiverSettleMode, setRemoteSenderSettleMode, setSenderSettleMode, setSource, setTarget
Methods inherited from class org.apache.qpid.proton.engine.impl.EndpointImpl
attachments, close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.qpid.proton.engine.Endpoint
close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
Methods inherited from interface org.apache.qpid.proton.engine.Extendable
attachments
Methods inherited from interface org.apache.qpid.proton.engine.Link
current, delivery, delivery, detach, detached, drained, getCredit, getDesiredCapabilities, getDrain, getMaxMessageSize, getName, getOfferedCapabilities, getProperties, getQueued, getReceiverSettleMode, getRemoteDesiredCapabilities, getRemoteMaxMessageSize, getRemoteOfferedCapabilities, getRemoteProperties, getRemoteReceiverSettleMode, getRemoteSenderSettleMode, getRemoteSource, getRemoteTarget, getSenderSettleMode, getSession, getSource, getTarget, getUnsettled, head, next, setDesiredCapabilities, setMaxMessageSize, setOfferedCapabilities, setProperties, setReceiverSettleMode, setRemoteSenderSettleMode, setSenderSettleMode, setSource, setTarget
-
Method Details
-
advance
public boolean advance()Description copied from interface:Link
Attempts to advance the current delivery. Advances it to the next delivery if one exists, else null. The behaviour of this method is different for senders and receivers.- Specified by:
advance
in interfaceLink
- Specified by:
advance
in interfaceReceiver
- Overrides:
advance
in classLinkImpl
- Returns:
- true if it can advance, false if it cannot TODO document the meaning of the return value more fully. Currently Senderimpl only returns false if there is no current delivery
-
flow
public void flow(int credits) Description copied from interface:Receiver
Adds the specified number of credits. The number of link credits initialises to zero. It is the application's responsibility to call this method to allow the receiver to receivecredits
more deliveries. -
recv
public int recv(byte[] bytes, int offset, int size) Description copied from interface:Receiver
Receive message data for the current delivery. If the caller takes all the bytes the Receiver currently has for this delivery then it is removed from the Connection's work list. Before considering a delivery to be complete, the caller should examineDelivery.isPartial()
. If the delivery is partial, the caller should callReceiver.recv(byte[], int, int)
again to receive the additional bytes once the Delivery appears again on the Connection work-list. TODO might the flags other than IO_WORK in DeliveryImpl also prevent the work list being pruned? e.g. what if a slow JMS consumer receives a disposition frame containing state=RELEASED? This is not IO_WORK.- Specified by:
recv
in interfaceReceiver
- Parameters:
bytes
- the destination array where the message data is writtenoffset
- index in the array to start writing data atsize
- the maximum number of bytes to write- Returns:
- number of bytes written. -1 if there are no more bytes for the current delivery.
- See Also:
-
recv
Description copied from interface:Receiver
Receive message data for the current delivery. -
recv
Description copied from interface:Receiver
Receive message data for the current delivery returning the data in a Readable buffer. The delivery will return an empty buffer if there is no pending data to be read or if all data has been read either by a previous call to this method or by a call to one of the other receive methods. -
drain
public void drain(int credit) -
draining
public boolean draining() -
setDrain
public void setDrain(boolean drain) -
getRemoteCredit
public int getRemoteCredit()Description copied from interface:Link
Returns a [locally generated] view of credit at the remote peer by considering the current linkcredit
count as well as the effect of any locallyqueued
messages.- Specified by:
getRemoteCredit
in interfaceLink
- Returns:
- view of effective remote credit
-