org.apache.qpid.server.protocol
Interface AMQProtocolSession

All Superinterfaces:
AMQConnectionModel, org.apache.qpid.protocol.AMQProtocolWriter, org.apache.qpid.protocol.AMQVersionAwareProtocolSession, PrincipalHolder, org.apache.qpid.protocol.ProtocolVersionAware
All Known Implementing Classes:
AMQProtocolEngine

public interface AMQProtocolSession
extends org.apache.qpid.protocol.AMQVersionAwareProtocolSession, PrincipalHolder, AMQConnectionModel


Nested Class Summary
static class AMQProtocolSession.ProtocolSessionIdentifier
           
static interface AMQProtocolSession.Task
           
 
Method Summary
 void addChannel(AMQChannel channel)
          Associate a channel with this session.
 void addSessionCloseTask(AMQProtocolSession.Task task)
           
 boolean channelAwaitingClosure(int channelId)
          Check to see if this chanel is closing
 void closeChannel(int channelId)
          Close a specific channel.
 void closeChannelOk(int channelId)
          Markes the specific channel as closed.
 void closeConnection(int channelId, org.apache.qpid.AMQConnectionException e, boolean closeProtocolSession)
          This must be called to close the session in order to free up any resources managed by the session.
 void closeIfLingeringClosedChannels()
           
 void closeSession()
          This must be called when the session is _closed in order to free up any resources managed by the session.
 void commitTransactions(AMQChannel channel)
           
 void dataBlockReceived(org.apache.qpid.framing.AMQDataBlock message)
          Called when a protocol data block is received
 AMQChannel getChannel(int channelId)
          Get the channel for this session associated with the specified id.
 List<AMQChannel> getChannels()
           
 Object getClientIdentifier()
           
 org.apache.qpid.framing.FieldTable getClientProperties()
           
 String getClientVersion()
           
 org.apache.qpid.framing.AMQShortString getContextKey()
          Get the context key associated with this session.
 Object getKey()
           
 long getLastIoTime()
           
 String getLocalFQDN()
          Get the fully qualified domain name of the local address to which this session is bound.
 LogActor getLogActor()
           
 long getMaxFrameSize()
           
 Long getMaximumNumberOfChannels()
           
 org.apache.qpid.framing.MethodDispatcher getMethodDispatcher()
           
 org.apache.qpid.framing.MethodRegistry getMethodRegistry()
           
 ProtocolOutputConverter getProtocolOutputConverter()
           
 SocketAddress getRemoteAddress()
           
 SaslServer getSaslServer()
           
 long getSessionID()
           
 AMQProtocolSession.ProtocolSessionIdentifier getSessionIdentifier()
           
 VirtualHost getVirtualHost()
           
 long getWrittenBytes()
           
 void initHeartbeats(int delay)
          Initialise heartbeats on the session.
 boolean isClosing()
           
 void mgmtCloseChannel(int channelId)
           
 void removeChannel(int channelId)
          Remove a channel from the session but do not close it.
 void removeSessionCloseTask(AMQProtocolSession.Task task)
           
 void rollbackTransactions(AMQChannel channel)
           
 void setAuthorizedID(Principal authorizedID)
           
 void setClientProperties(org.apache.qpid.framing.FieldTable clientProperties)
           
 void setContextKey(org.apache.qpid.framing.AMQShortString contextKey)
          Set the context key associated with this session.
 void setMaxFrameSize(long frameMax)
           
 void setMaximumNumberOfChannels(Long value)
           
 void setSaslServer(SaslServer saslServer)
          Set the sasl server that is to perform authentication for this session.
 void setVirtualHost(VirtualHost virtualHost)
           
 
Methods inherited from interface org.apache.qpid.protocol.AMQVersionAwareProtocolSession
contentBodyReceived, contentHeaderReceived, heartbeatBodyReceived, init, methodFrameReceived, setSender
 
Methods inherited from interface org.apache.qpid.protocol.AMQProtocolWriter
writeFrame
 
Methods inherited from interface org.apache.qpid.protocol.ProtocolVersionAware
getProtocolMajorVersion, getProtocolMinorVersion, getProtocolVersion
 
Methods inherited from interface org.apache.qpid.server.security.PrincipalHolder
getPrincipal
 
Methods inherited from interface org.apache.qpid.server.protocol.AMQConnectionModel
closeSession, getConnectionId
 

Method Detail

getSessionID

long getSessionID()

getLogActor

LogActor getLogActor()

setMaxFrameSize

void setMaxFrameSize(long frameMax)

getMaxFrameSize

long getMaxFrameSize()

isClosing

boolean isClosing()

dataBlockReceived

void dataBlockReceived(org.apache.qpid.framing.AMQDataBlock message)
                       throws Exception
Called when a protocol data block is received

Parameters:
message - the data block that has been received
Throws:
Exception - if processing the datablock fails

getContextKey

org.apache.qpid.framing.AMQShortString getContextKey()
Get the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Returns:
the context key

setContextKey

void setContextKey(org.apache.qpid.framing.AMQShortString contextKey)
Set the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Parameters:
contextKey - the context key

getChannel

AMQChannel getChannel(int channelId)
Get the channel for this session associated with the specified id. A channel id is unique per connection (i.e. per session).

Parameters:
channelId - the channel id which must be valid
Returns:
null if no channel exists, the channel otherwise

addChannel

void addChannel(AMQChannel channel)
                throws org.apache.qpid.AMQException
Associate a channel with this session.

Parameters:
channel - the channel to associate with this session. It is an error to associate the same channel with more than one session but this is not validated.
Throws:
org.apache.qpid.AMQException

closeChannel

void closeChannel(int channelId)
                  throws org.apache.qpid.AMQException
Close a specific channel. This will remove any resources used by the channel, including:

Parameters:
channelId - id of the channel to close
Throws:
org.apache.qpid.AMQException - if an error occurs closing the channel
IllegalArgumentException - if the channel id is not valid

closeChannelOk

void closeChannelOk(int channelId)
Markes the specific channel as closed. This will release the lock for that channel id so a new channel can be created on that id.

Parameters:
channelId - id of the channel to close

channelAwaitingClosure

boolean channelAwaitingClosure(int channelId)
Check to see if this chanel is closing

Parameters:
channelId - id to check
Returns:
boolean with state of channel awaiting closure

removeChannel

void removeChannel(int channelId)
Remove a channel from the session but do not close it.

Parameters:
channelId -

initHeartbeats

void initHeartbeats(int delay)
Initialise heartbeats on the session.

Parameters:
delay - delay in seconds (not ms)

closeSession

void closeSession()
                  throws org.apache.qpid.AMQException
This must be called when the session is _closed in order to free up any resources managed by the session.

Throws:
org.apache.qpid.AMQException

closeConnection

void closeConnection(int channelId,
                     org.apache.qpid.AMQConnectionException e,
                     boolean closeProtocolSession)
                     throws org.apache.qpid.AMQException
This must be called to close the session in order to free up any resources managed by the session.

Throws:
org.apache.qpid.AMQException

getKey

Object getKey()
Returns:
a key that uniquely identifies this session

getLocalFQDN

String getLocalFQDN()
Get the fully qualified domain name of the local address to which this session is bound. Since some servers may be bound to multiple addresses this could vary depending on the acceptor this session was created from.

Returns:
a String FQDN

getSaslServer

SaslServer getSaslServer()
Returns:
the sasl server that can perform authentication for this session.

setSaslServer

void setSaslServer(SaslServer saslServer)
Set the sasl server that is to perform authentication for this session.

Parameters:
saslServer -

getClientProperties

org.apache.qpid.framing.FieldTable getClientProperties()

setClientProperties

void setClientProperties(org.apache.qpid.framing.FieldTable clientProperties)

getClientIdentifier

Object getClientIdentifier()

getVirtualHost

VirtualHost getVirtualHost()

setVirtualHost

void setVirtualHost(VirtualHost virtualHost)
                    throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

addSessionCloseTask

void addSessionCloseTask(AMQProtocolSession.Task task)

removeSessionCloseTask

void removeSessionCloseTask(AMQProtocolSession.Task task)

getProtocolOutputConverter

ProtocolOutputConverter getProtocolOutputConverter()

setAuthorizedID

void setAuthorizedID(Principal authorizedID)

getRemoteAddress

SocketAddress getRemoteAddress()

getMethodRegistry

org.apache.qpid.framing.MethodRegistry getMethodRegistry()
Specified by:
getMethodRegistry in interface org.apache.qpid.protocol.AMQVersionAwareProtocolSession

getMethodDispatcher

org.apache.qpid.framing.MethodDispatcher getMethodDispatcher()

getSessionIdentifier

AMQProtocolSession.ProtocolSessionIdentifier getSessionIdentifier()

getClientVersion

String getClientVersion()

getLastIoTime

long getLastIoTime()

getWrittenBytes

long getWrittenBytes()

getMaximumNumberOfChannels

Long getMaximumNumberOfChannels()

setMaximumNumberOfChannels

void setMaximumNumberOfChannels(Long value)

commitTransactions

void commitTransactions(AMQChannel channel)
                        throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

rollbackTransactions

void rollbackTransactions(AMQChannel channel)
                          throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

getChannels

List<AMQChannel> getChannels()

closeIfLingeringClosedChannels

void closeIfLingeringClosedChannels()

mgmtCloseChannel

void mgmtCloseChannel(int channelId)


Licensed to the Apache Software Foundation