Class AmqpAbstractLink<LINK_TYPE extends org.apache.qpid.proton.engine.Link>
- java.lang.Object
-
- org.apache.activemq.transport.amqp.protocol.AmqpAbstractLink<LINK_TYPE>
-
- All Implemented Interfaces:
AmqpLink,AmqpResource
- Direct Known Subclasses:
AmqpAbstractReceiver,AmqpSender
public abstract class AmqpAbstractLink<LINK_TYPE extends org.apache.qpid.proton.engine.Link> extends Object implements AmqpLink
Abstract AmqpLink implementation that provide basic Link services.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Runnable>closeActionsprotected booleanclosedprotected LINK_TYPEendpointprotected booleanopenedprotected AmqpSessionsession
-
Constructor Summary
Constructors Constructor Description AmqpAbstractLink(AmqpSession session, LINK_TYPE endpoint)Creates a new AmqpLink type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCloseAction(Runnable action)Adds a new Runnable that is called on close of this link.voidclose()Request from the remote peer to close this resource.voidclose(org.apache.qpid.proton.amqp.transport.ErrorCondition error)Close the Link with an error indicating the reson for the close.voiddetach()Request from the remote peer to detach this resource.LINK_TYPEgetEndpoint()AmqpSessiongetSession()booleanisClosed()booleanisOpened()voidopen()Request from the remote peer to open this resource.protected voidsendToActiveMQ(Command command)Shortcut method to hand off an ActiveMQ Command to the broker and assign a ResponseHandler to deal with any reply from the broker.protected voidsendToActiveMQ(Command command, ResponseHandler handler)Shortcut method to hand off an ActiveMQ Command to the broker and assign a ResponseHandler to deal with any reply from the broker.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.transport.amqp.protocol.AmqpLink
commit, delivery, flow, getDestination, rollback, setDestination
-
-
-
-
Field Detail
-
session
protected final AmqpSession session
-
endpoint
protected final LINK_TYPE extends org.apache.qpid.proton.engine.Link endpoint
-
closed
protected boolean closed
-
opened
protected boolean opened
-
-
Constructor Detail
-
AmqpAbstractLink
public AmqpAbstractLink(AmqpSession session, LINK_TYPE endpoint)
Creates a new AmqpLink type.- Parameters:
session- the AmqpSession that servers as the parent of this Link.endpoint- the link endpoint this object represents.
-
-
Method Detail
-
open
public void open()
Description copied from interface:AmqpResourceRequest from the remote peer to open this resource.- Specified by:
openin interfaceAmqpResource
-
detach
public void detach()
Description copied from interface:AmqpLinkRequest from the remote peer to detach this resource.
-
close
public void close(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
Description copied from interface:AmqpLinkClose the Link with an error indicating the reson for the close.
-
close
public void close()
Description copied from interface:AmqpResourceRequest from the remote peer to close this resource.- Specified by:
closein interfaceAmqpResource
-
isOpened
public boolean isOpened()
- Returns:
- true if this link has already been opened.
-
isClosed
public boolean isClosed()
- Returns:
- true if this link has already been closed.
-
getEndpoint
public LINK_TYPE getEndpoint()
- Returns:
- the Proton Link type this link represents.
-
getSession
public AmqpSession getSession()
- Returns:
- the parent AmqpSession for this Link instance.
-
addCloseAction
public void addCloseAction(Runnable action)
Description copied from interface:AmqpLinkAdds a new Runnable that is called on close of this link.- Specified by:
addCloseActionin interfaceAmqpLink- Parameters:
action- a Runnable that will be executed when the link closes or detaches.
-
sendToActiveMQ
protected void sendToActiveMQ(Command command)
Shortcut method to hand off an ActiveMQ Command to the broker and assign a ResponseHandler to deal with any reply from the broker.- Parameters:
command- the Command object to send to the Broker.
-
sendToActiveMQ
protected void sendToActiveMQ(Command command, ResponseHandler handler)
Shortcut method to hand off an ActiveMQ Command to the broker and assign a ResponseHandler to deal with any reply from the broker.- Parameters:
command- the Command object to send to the Broker.handler- the ResponseHandler that will handle the Broker's response.
-
-