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>
closeActions
protected boolean
closed
protected LINK_TYPE
endpoint
protected boolean
opened
protected AmqpSession
session
-
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 void
addCloseAction(Runnable action)
Adds a new Runnable that is called on close of this link.void
close()
Request from the remote peer to close this resource.void
close(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
Close the Link with an error indicating the reson for the close.void
detach()
Request from the remote peer to detach this resource.LINK_TYPE
getEndpoint()
AmqpSession
getSession()
boolean
isClosed()
boolean
isOpened()
void
open()
Request from the remote peer to open this resource.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.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.-
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:AmqpResource
Request from the remote peer to open this resource.- Specified by:
open
in interfaceAmqpResource
-
detach
public void detach()
Description copied from interface:AmqpLink
Request from the remote peer to detach this resource.
-
close
public void close(org.apache.qpid.proton.amqp.transport.ErrorCondition error)
Description copied from interface:AmqpLink
Close the Link with an error indicating the reson for the close.
-
close
public void close()
Description copied from interface:AmqpResource
Request from the remote peer to close this resource.- Specified by:
close
in 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:AmqpLink
Adds a new Runnable that is called on close of this link.- Specified by:
addCloseAction
in 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.
-
-