org.jdiameter.client.impl
Class StackImpl

java.lang.Object
  extended by org.jdiameter.client.impl.StackImpl
All Implemented Interfaces:
Stack, Wrapper, IContainer, StackImplMBean
Direct Known Subclasses:
StackImpl

public class StackImpl
extends java.lang.Object
implements IContainer, StackImplMBean

Use stack extension point

Author:
erick.svenson@yahoo.com, Bartosz Baranowski , Alexandre Mendonca

Field Summary
protected  IAssembler assembler
           
protected  IConcurrentFactory concurrentFactory
           
protected  Configuration config
           
protected  java.util.concurrent.locks.Lock lock
           
protected  IPeerTable peerManager
           
protected  java.util.concurrent.ScheduledExecutorService scheduledFacility
          Use for processing request time-out tasks (for all active peers)
protected  StackState state
           
 
Constructor Summary
StackImpl()
           
 
Method Summary
 void addSessionListener(java.lang.String sessionId, NetworkReqListener listener)
          Add session listener
 java.lang.String configuration()
          Return string representation of stack instanceconfiguration
 void destroy()
           
 IAssembler getAssemblerFacility()
          Return root IOC
 IConcurrentFactory getConcurrentFactory()
          Return common concurrent factory
 Configuration getConfiguration()
          Return configuration instance
 Dictionary getDictionary()
           
 java.util.logging.Logger getLogger()
           
 MetaData getMetaData()
           
 java.util.concurrent.ScheduledExecutorService getScheduledFacility()
          Return common Scheduled Executor Service
<T extends BaseSession>
T
getSession(java.lang.String sessionId, java.lang.Class<T> clazz)
           
 SessionFactory getSessionFactory()
           
 StackState getState()
          Return state of stack
 SessionFactory init(Configuration config)
           
 boolean isActive()
          Return true if stack is started
 boolean isWrapperFor(java.lang.Class<?> aClass)
           
 java.lang.String metaData()
          Return string representation of stack instance metadata
 java.lang.String peerDescription(java.lang.String name)
          Reurn description (include state) of defined peer
 java.lang.String peerList()
          Return list of peer
 void removeSessionListener(java.lang.String sessionId)
          Remove session event listener by sessionId
 void sendMessage(IMessage message)
          Send message
 void start()
          Run startd procedure
 void start(Mode mode, long timeOut, java.util.concurrent.TimeUnit timeUnit)
           
 void stop(int disconnectCause)
          Run stop procedure
 void stop(long timeOut, java.util.concurrent.TimeUnit timeUnit, int disconnectCause)
           
<T> T
unwrap(java.lang.Class<T> aClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

assembler

protected IAssembler assembler

concurrentFactory

protected IConcurrentFactory concurrentFactory

config

protected Configuration config

peerManager

protected IPeerTable peerManager

state

protected StackState state

lock

protected java.util.concurrent.locks.Lock lock

scheduledFacility

protected java.util.concurrent.ScheduledExecutorService scheduledFacility
Use for processing request time-out tasks (for all active peers)

Constructor Detail

StackImpl

public StackImpl()
Method Detail

init

public SessionFactory init(Configuration config)
                    throws IllegalDiameterStateException,
                           InternalException
Specified by:
init in interface Stack
Throws:
IllegalDiameterStateException
InternalException

getSessionFactory

public SessionFactory getSessionFactory()
                                 throws IllegalDiameterStateException
Specified by:
getSessionFactory in interface Stack
Throws:
IllegalDiameterStateException

getDictionary

public Dictionary getDictionary()
                         throws IllegalDiameterStateException
Specified by:
getDictionary in interface Stack
Throws:
IllegalDiameterStateException

start

public void start()
           throws IllegalDiameterStateException,
                  InternalException
Description copied from interface: StackImplMBean
Run startd procedure

Specified by:
start in interface Stack
Specified by:
start in interface StackImplMBean
Throws:
IllegalDiameterStateException
InternalException

start

public void start(Mode mode,
                  long timeOut,
                  java.util.concurrent.TimeUnit timeUnit)
           throws IllegalDiameterStateException,
                  InternalException
Specified by:
start in interface Stack
Throws:
IllegalDiameterStateException
InternalException

stop

public void stop(long timeOut,
                 java.util.concurrent.TimeUnit timeUnit,
                 int disconnectCause)
          throws IllegalDiameterStateException,
                 InternalException
Specified by:
stop in interface Stack
Throws:
IllegalDiameterStateException
InternalException

destroy

public void destroy()
Specified by:
destroy in interface Stack

isActive

public boolean isActive()
Description copied from interface: StackImplMBean
Return true if stack is started

Specified by:
isActive in interface Stack
Specified by:
isActive in interface StackImplMBean
Returns:
true if stack is started

getLogger

public java.util.logging.Logger getLogger()
Specified by:
getLogger in interface Stack

getMetaData

public MetaData getMetaData()
Specified by:
getMetaData in interface Stack

getSession

public <T extends BaseSession> T getSession(java.lang.String sessionId,
                                            java.lang.Class<T> clazz)
                                 throws InternalException
Specified by:
getSession in interface Stack
Throws:
InternalException

isWrapperFor

public boolean isWrapperFor(java.lang.Class<?> aClass)
                     throws InternalException
Specified by:
isWrapperFor in interface Wrapper
Throws:
InternalException

unwrap

public <T> T unwrap(java.lang.Class<T> aClass)
         throws InternalException
Specified by:
unwrap in interface Wrapper
Throws:
InternalException

getState

public StackState getState()
Description copied from interface: IContainer
Return state of stack

Specified by:
getState in interface IContainer
Returns:
Return state of stack

getConfiguration

public Configuration getConfiguration()
Description copied from interface: IContainer
Return configuration instance

Specified by:
getConfiguration in interface IContainer
Returns:
configuration instance

getAssemblerFacility

public IAssembler getAssemblerFacility()
Description copied from interface: IContainer
Return root IOC

Specified by:
getAssemblerFacility in interface IContainer
Returns:
root IOC

sendMessage

public void sendMessage(IMessage message)
                 throws RouteException,
                        AvpDataException,
                        IllegalDiameterStateException,
                        java.io.IOException
Description copied from interface: IContainer
Send message

Specified by:
sendMessage in interface IContainer
Parameters:
message - session instance
Throws:
RouteException
AvpDataException
IllegalDiameterStateException
java.io.IOException

addSessionListener

public void addSessionListener(java.lang.String sessionId,
                               NetworkReqListener listener)
Description copied from interface: IContainer
Add session listener

Specified by:
addSessionListener in interface IContainer
Parameters:
sessionId - session id
listener - listener instance

removeSessionListener

public void removeSessionListener(java.lang.String sessionId)
Description copied from interface: IContainer
Remove session event listener by sessionId

Specified by:
removeSessionListener in interface IContainer
Parameters:
sessionId - session identifier

getScheduledFacility

public java.util.concurrent.ScheduledExecutorService getScheduledFacility()
Description copied from interface: IContainer
Return common Scheduled Executor Service

Specified by:
getScheduledFacility in interface IContainer
Returns:
common Scheduled Executor Service

getConcurrentFactory

public IConcurrentFactory getConcurrentFactory()
Description copied from interface: IContainer
Return common concurrent factory

Specified by:
getConcurrentFactory in interface IContainer
Returns:

configuration

public java.lang.String configuration()
Description copied from interface: StackImplMBean
Return string representation of stack instanceconfiguration

Specified by:
configuration in interface StackImplMBean
Returns:
string representation of stack instance configuration

metaData

public java.lang.String metaData()
Description copied from interface: StackImplMBean
Return string representation of stack instance metadata

Specified by:
metaData in interface StackImplMBean
Returns:
string representation of stack instance metadata

peerDescription

public java.lang.String peerDescription(java.lang.String name)
Description copied from interface: StackImplMBean
Reurn description (include state) of defined peer

Specified by:
peerDescription in interface StackImplMBean
Parameters:
name - peer host name
Returns:
description of defined peer

peerList

public java.lang.String peerList()
Description copied from interface: StackImplMBean
Return list of peer

Specified by:
peerList in interface StackImplMBean
Returns:
list of peer

stop

public void stop(int disconnectCause)
Description copied from interface: StackImplMBean
Run stop procedure

Specified by:
stop in interface StackImplMBean


Copyright © 2014. All Rights Reserved.