## org.hornetq.spi.core.protocol
Interface RemotingConnection

All Superinterfaces:
  BufferHandler

    public interface RemotingConnection

extends BufferHandler

A RemotingConnection is a connection between a client and a server.

Author:
  Tim Fox, Jeff Mesnil

Method Summary
`void` `addCloseListener(org.hornetq.core.remoting.CloseListener listener)` add a CloseListener.
`void` `addFailureListener(org.hornetq.core.remoting.FailureListener listener)` add a failure listener.
`boolean` `checkDataReceived()` returns true if any data has been received since the last time this method was called.
`HornetQBuffer` `createBuffer(int size)` creates a new HornetQBuffer of the specified size.
`void` `destroy()` destroys this connection.
`void` `disconnect(boolean criticalError)` Disconnect the connection, closing all channels
`void` `fail(HornetQException me)` called when the underlying connection fails.
`void` `flush()` flush all outstanding data from the connection.
`long` `getCreationTime()` Returns the creation time of the Remoting connection
`List<org.hornetq.core.remoting.FailureListener>` `getFailureListeners()` return all the failure listeners
`Object` `getID()` returns the unique id of the Remoting Connection
`String` `getRemoteAddress()` returns a string representation of the remote address of this connection
`Connection` `getTransportConnection()` return the underlying Connection.
`boolean` `isClient()` returns whether or not the Remoting Connection is a client
`boolean` `isDestroyed()` returns true if this Remoting Connection has been destroyed.
`boolean` `removeCloseListener(org.hornetq.core.remoting.CloseListener listener)` remove a Close Listener
`List<org.hornetq.core.remoting.CloseListener>` `removeCloseListeners()`
`boolean` `removeFailureListener(org.hornetq.core.remoting.FailureListener listener)` remove the failure listener
`List<org.hornetq.core.remoting.FailureListener>` `removeFailureListeners()`
`void` `setCloseListeners(List<org.hornetq.core.remoting.CloseListener> listeners)`
`void` `setFailureListeners(List<org.hornetq.core.remoting.FailureListener> listeners)` set the failure listeners.

Methods inherited from interface org.hornetq.spi.core.remoting.BufferHandler
`bufferReceived`

Method Detail

### getID

    Object getID()

  returns the unique id of the Remoting Connection

  Returns:
    the id

### getCreationTime

    long getCreationTime()

  Returns the creation time of the Remoting connection

### getRemoteAddress

    String getRemoteAddress()

  returns a string representation of the remote address of this connection

  Returns:
    the remote address

### addFailureListener

    void addFailureListener(org.hornetq.core.remoting.FailureListener listener)

  add a failure listener.

  The listener will be called in the event of connection failure.

  Parameters:
    `listener` - the listener

### removeFailureListener

    boolean removeFailureListener(org.hornetq.core.remoting.FailureListener listener)

  remove the failure listener

  Parameters:
    `listener` - the lister to remove
  Returns:
    true if removed

### addCloseListener

    void addCloseListener(org.hornetq.core.remoting.CloseListener listener)

  add a CloseListener.

  This will be called in the event of the connection being closed.

  Parameters:
    `listener` - the listener to add

### removeCloseListener

    boolean removeCloseListener(org.hornetq.core.remoting.CloseListener listener)

  remove a Close Listener

  Parameters:
    `listener` - the listener to remove
  Returns:
    true if removed

### removeCloseListeners

    List<org.hornetq.core.remoting.CloseListener> removeCloseListeners()

### setCloseListeners

    void setCloseListeners(List<org.hornetq.core.remoting.CloseListener> listeners)

### getFailureListeners

    List<org.hornetq.core.remoting.FailureListener> getFailureListeners()

  return all the failure listeners

  Returns:
    the listeners

### removeFailureListeners

    List<org.hornetq.core.remoting.FailureListener> removeFailureListeners()

### setFailureListeners

    void setFailureListeners(List<org.hornetq.core.remoting.FailureListener> listeners)

  set the failure listeners.

  These will be called in the event of the connection being closed. Any previosuly added listeners will be removed.

  Parameters:
    `listeners` - the listeners to add.

### createBuffer

    HornetQBuffer createBuffer(int size)

  creates a new HornetQBuffer of the specified size.

  Parameters:
    `size` - the size of buffer required
  Returns:
    the buffer

### fail

    void fail(HornetQException me)

  called when the underlying connection fails.

  Parameters:
    `me` - the exception that caused the failure

### destroy

    void destroy()

  destroys this connection.

### getTransportConnection

    Connection getTransportConnection()

  return the underlying Connection.

  Returns:
    the connection

### isClient

    boolean isClient()

  returns whether or not the Remoting Connection is a client

  Returns:
    true if client, false if a server

### isDestroyed

    boolean isDestroyed()

  returns true if this Remoting Connection has been destroyed.

  Returns:
    true if destroyed, otherwise false

### disconnect

    void disconnect(boolean criticalError)

  Disconnect the connection, closing all channels

### checkDataReceived

    boolean checkDataReceived()

  returns true if any data has been received since the last time this method was called.

  Returns:
    true if data has been received.

### flush

    void flush()

  flush all outstanding data from the connection.

Copyright © 2009 Red Hat Inc. All Rights Reserved.