public abstract class AbstractRemotingConnection extends Object implements RemotingConnection
Modifier and Type | Field and Description |
---|---|
protected List<CloseListener> |
closeListeners |
protected long |
creationTime |
protected boolean |
dataReceived |
protected Executor |
executor |
protected List<FailureListener> |
failureListeners |
protected Connection |
transportConnection |
Constructor and Description |
---|
AbstractRemotingConnection(Connection transportConnection,
Executor executor) |
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(CloseListener listener)
add a CloseListener.
|
void |
addFailureListener(FailureListener listener)
add a failure listener.
|
void |
bufferReceived(Object connectionID,
ActiveMQBuffer buffer)
called by the remoting connection when a buffer is received.
|
protected void |
callClosingListeners() |
protected void |
callFailureListeners(ActiveMQException me,
String scaleDownTargetNodeID) |
boolean |
checkDataReceived()
returns true if any data has been received since the last time this method was called.
|
ActiveMQBuffer |
createTransportBuffer(int size)
creates a new ActiveMQBuffer of the specified size.
|
void |
fail(ActiveMQException me)
called when the underlying connection fails.
|
long |
getCreationTime()
Returns the creation time of the
RemotingConnection . |
List<FailureListener> |
getFailureListeners()
return all the failure listeners
|
Object |
getID()
Returns the unique id of the
RemotingConnection . |
String |
getRemoteAddress()
returns a string representation of the remote address of this connection
|
Connection |
getTransportConnection()
return the underlying Connection.
|
boolean |
isWritable(ReadyListener callback) |
boolean |
removeCloseListener(CloseListener listener)
remove a Close Listener
|
List<CloseListener> |
removeCloseListeners() |
boolean |
removeFailureListener(FailureListener listener)
remove the failure listener
|
List<FailureListener> |
removeFailureListeners() |
void |
setCloseListeners(List<CloseListener> listeners) |
void |
setFailureListeners(List<FailureListener> listeners)
set the failure listeners.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy, disconnect, disconnect, fail, flush, isClient, isDestroyed
protected final List<FailureListener> failureListeners
protected final List<CloseListener> closeListeners
protected final Connection transportConnection
protected final Executor executor
protected final long creationTime
protected volatile boolean dataReceived
public AbstractRemotingConnection(Connection transportConnection, Executor executor)
public List<FailureListener> getFailureListeners()
RemotingConnection
getFailureListeners
in interface RemotingConnection
public boolean isWritable(ReadyListener callback)
isWritable
in interface RemotingConnection
protected void callFailureListeners(ActiveMQException me, String scaleDownTargetNodeID)
protected void callClosingListeners()
public void setFailureListeners(List<FailureListener> listeners)
RemotingConnection
These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.
setFailureListeners
in interface RemotingConnection
listeners
- the listeners to add.public Object getID()
RemotingConnection
RemotingConnection
.getID
in interface RemotingConnection
public String getRemoteAddress()
RemotingConnection
getRemoteAddress
in interface RemotingConnection
public void addFailureListener(FailureListener listener)
RemotingConnection
The listener will be called in the event of connection failure.
addFailureListener
in interface RemotingConnection
listener
- the listenerpublic boolean removeFailureListener(FailureListener listener)
RemotingConnection
removeFailureListener
in interface RemotingConnection
listener
- the lister to removepublic void addCloseListener(CloseListener listener)
RemotingConnection
This will be called in the event of the connection being closed.
addCloseListener
in interface RemotingConnection
listener
- the listener to addpublic boolean removeCloseListener(CloseListener listener)
RemotingConnection
removeCloseListener
in interface RemotingConnection
listener
- the listener to removepublic List<CloseListener> removeCloseListeners()
removeCloseListeners
in interface RemotingConnection
public List<FailureListener> removeFailureListeners()
removeFailureListeners
in interface RemotingConnection
public void setCloseListeners(List<CloseListener> listeners)
setCloseListeners
in interface RemotingConnection
public ActiveMQBuffer createTransportBuffer(int size)
RemotingConnection
createTransportBuffer
in interface RemotingConnection
size
- the size of buffer requiredpublic Connection getTransportConnection()
RemotingConnection
getTransportConnection
in interface RemotingConnection
public long getCreationTime()
RemotingConnection
RemotingConnection
.getCreationTime
in interface RemotingConnection
public boolean checkDataReceived()
RemotingConnection
checkDataReceived
in interface RemotingConnection
public void fail(ActiveMQException me)
RemotingConnection
fail
in interface RemotingConnection
me
- the exception that caused the failurepublic void bufferReceived(Object connectionID, ActiveMQBuffer buffer)
BufferHandler
bufferReceived
in interface BufferHandler
connectionID
- the connection the buffer was received onbuffer
- the buffer to decodeCopyright © 2016 JBoss by Red Hat. All rights reserved.