org.jdiameter.server.impl
Class MutablePeerTableImpl

java.lang.Object
  extended by org.jdiameter.client.impl.controller.PeerTableImpl
      extended by org.jdiameter.server.impl.MutablePeerTableImpl
All Implemented Interfaces:
ConfigurationListener, MutablePeerTable, PeerTable, Wrapper, IPeerTable, IMutablePeerTable

public class MutablePeerTableImpl
extends PeerTableImpl
implements IMutablePeerTable, ConfigurationListener

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

Nested Class Summary
protected  class MutablePeerTableImpl.StorageEntry
           
 
Nested classes/interfaces inherited from class org.jdiameter.client.impl.controller.PeerTableImpl
PeerTableImpl.PeerTableThreadFactory
 
Field Summary
protected  Configuration config
           
protected  boolean duplicateProtection
           
protected  int duplicateSize
           
protected  long duplicateTimer
           
protected  java.util.concurrent.ScheduledFuture duplicationHandler
           
protected  java.util.concurrent.ScheduledExecutorService duplicationScheduler
           
protected  IFsmFactory fsmFactory
           
protected  boolean isAcceptUndefinedPeer
           
protected  INetwork network
           
protected  INetworkGuard networkGuard
           
protected  java.util.concurrent.ScheduledFuture overloadHandler
           
protected  java.util.concurrent.ScheduledExecutorService overloadScheduler
           
protected  IOverloadManager ovrManager
           
protected  IMessageParser parser
           
protected  PeerTableListener peerTableListener
           
protected  java.util.Set<java.lang.String> predefinedPeerTable
           
protected  IRouter router
           
protected  ISessionFactory sessionFactory
           
protected  IStatisticManager statisticFactory
           
protected  java.util.concurrent.ConcurrentHashMap<java.lang.String,MutablePeerTableImpl.StorageEntry> storageAnswers
           
protected  ITransportLayerFactory transportFactory
           
 
Fields inherited from class org.jdiameter.client.impl.controller.PeerTableImpl
assembler, concurrentFactory, dictionary, isStarted, metaData, peerTable, sessionDatasource, stopTimeOut
 
Constructor Summary
MutablePeerTableImpl(Configuration config, MetaData metaData, IContainer stack, IRouter router, ISessionFactory sessionFactory, IFsmFactory fsmFactory, ITransportLayerFactory trFactory, IMessageParser parser, INetwork network, IOverloadManager ovrManager, IStatisticManager statisticFactory, IConcurrentFactory concurrentFactory)
           
 
Method Summary
 Peer addPeer(URI peerURI, java.lang.String realm, boolean connecting)
           
protected  Peer createPeer(int rating, java.lang.String uri, java.lang.String ip, java.lang.String portRange, MetaData metaData, Configuration globalConfig, Configuration peerConfig, IFsmFactory fsmFactory, ITransportLayerFactory transportFactory, IStatisticManager statisticFactory, IConcurrentFactory concurrentFactory, IMessageParser parser)
           
 boolean elementChanged(int i, java.lang.Object data)
           
 java.util.Set<Realm> getAllRealms()
           
 java.util.concurrent.ConcurrentHashMap<java.lang.String,IConnection> getIncConnections()
           
 java.util.Set<java.lang.String> getPredefinedPeerTable()
           
 ISessionFactory getSessionFactory()
          Return instance of session factory
 Statistic getStatistic(java.lang.String name)
           
 IMessage isDuplicate(IMessage request)
          Check message on duplicate
 boolean isDuplicateProtection()
           
 boolean isWrapperFor(java.lang.Class<?> aClass)
           
protected  IPeer newPeerInstance(int rating, URI uri, java.lang.String ip, java.lang.String portRange, boolean attCnn, IConnection connection, MetaData metaData, Configuration globalConfig, Configuration peerConfig, IFsmFactory fsmFactory, ITransportLayerFactory transportFactory, IMessageParser parser, IStatisticManager statisticFactory, IConcurrentFactory concurrentFactory)
           
 Peer removePeer(java.lang.String host)
           
 void saveToDuplicate(java.lang.String key, IMessage answer)
          Save message to duplicate storage
 void setPeerTableListener(PeerTableListener peerTableListener)
           
 void start()
          Start peer manager ( start network activity )
 void stopping(int disconnectCause)
          Run stopping procedure (unsynchronized)
<T> T
unwrap(java.lang.Class<T> aClass)
           
 
Methods inherited from class org.jdiameter.client.impl.controller.PeerTableImpl
addSessionReqListener, destroy, getPeer, getPeerTable, getSessionReqListeners, init, removeSessionListener, sendMessage, setAssembler, stopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jdiameter.client.api.controller.IPeerTable
addSessionReqListener, destroy, getPeer, getSessionReqListeners, removeSessionListener, sendMessage, setAssembler, stopped
 
Methods inherited from interface org.jdiameter.api.PeerTable
getPeerTable
 

Field Detail

config

protected Configuration config

sessionFactory

protected ISessionFactory sessionFactory

fsmFactory

protected IFsmFactory fsmFactory

transportFactory

protected ITransportLayerFactory transportFactory

parser

protected IMessageParser parser

router

protected IRouter router

duplicateProtection

protected boolean duplicateProtection

duplicateSize

protected int duplicateSize

duplicateTimer

protected long duplicateTimer

duplicationScheduler

protected java.util.concurrent.ScheduledExecutorService duplicationScheduler

duplicationHandler

protected java.util.concurrent.ScheduledFuture duplicationHandler

storageAnswers

protected java.util.concurrent.ConcurrentHashMap<java.lang.String,MutablePeerTableImpl.StorageEntry> storageAnswers

isAcceptUndefinedPeer

protected boolean isAcceptUndefinedPeer

networkGuard

protected INetworkGuard networkGuard

network

protected INetwork network

predefinedPeerTable

protected java.util.Set<java.lang.String> predefinedPeerTable

ovrManager

protected IOverloadManager ovrManager

overloadScheduler

protected java.util.concurrent.ScheduledExecutorService overloadScheduler

overloadHandler

protected java.util.concurrent.ScheduledFuture overloadHandler

peerTableListener

protected PeerTableListener peerTableListener

statisticFactory

protected IStatisticManager statisticFactory
Constructor Detail

MutablePeerTableImpl

public MutablePeerTableImpl(Configuration config,
                            MetaData metaData,
                            IContainer stack,
                            IRouter router,
                            ISessionFactory sessionFactory,
                            IFsmFactory fsmFactory,
                            ITransportLayerFactory trFactory,
                            IMessageParser parser,
                            INetwork network,
                            IOverloadManager ovrManager,
                            IStatisticManager statisticFactory,
                            IConcurrentFactory concurrentFactory)
Method Detail

createPeer

protected Peer createPeer(int rating,
                          java.lang.String uri,
                          java.lang.String ip,
                          java.lang.String portRange,
                          MetaData metaData,
                          Configuration globalConfig,
                          Configuration peerConfig,
                          IFsmFactory fsmFactory,
                          ITransportLayerFactory transportFactory,
                          IStatisticManager statisticFactory,
                          IConcurrentFactory concurrentFactory,
                          IMessageParser parser)
                   throws InternalException,
                          TransportException,
                          java.net.URISyntaxException,
                          java.net.UnknownServiceException
Overrides:
createPeer in class PeerTableImpl
Throws:
InternalException
TransportException
java.net.URISyntaxException
java.net.UnknownServiceException

newPeerInstance

protected IPeer newPeerInstance(int rating,
                                URI uri,
                                java.lang.String ip,
                                java.lang.String portRange,
                                boolean attCnn,
                                IConnection connection,
                                MetaData metaData,
                                Configuration globalConfig,
                                Configuration peerConfig,
                                IFsmFactory fsmFactory,
                                ITransportLayerFactory transportFactory,
                                IMessageParser parser,
                                IStatisticManager statisticFactory,
                                IConcurrentFactory concurrentFactory)
                         throws java.net.URISyntaxException,
                                java.net.UnknownServiceException,
                                InternalException,
                                TransportException
Throws:
java.net.URISyntaxException
java.net.UnknownServiceException
InternalException
TransportException

setPeerTableListener

public void setPeerTableListener(PeerTableListener peerTableListener)
Specified by:
setPeerTableListener in interface MutablePeerTable

elementChanged

public boolean elementChanged(int i,
                              java.lang.Object data)
Specified by:
elementChanged in interface ConfigurationListener

isDuplicateProtection

public boolean isDuplicateProtection()

start

public void start()
           throws IllegalDiameterStateException,
                  java.io.IOException
Description copied from interface: IPeerTable
Start peer manager ( start network activity )

Specified by:
start in interface IPeerTable
Overrides:
start in class PeerTableImpl
Throws:
IllegalDiameterStateException
java.io.IOException

getPredefinedPeerTable

public java.util.Set<java.lang.String> getPredefinedPeerTable()

getIncConnections

public java.util.concurrent.ConcurrentHashMap<java.lang.String,IConnection> getIncConnections()

stopping

public void stopping(int disconnectCause)
Description copied from interface: IPeerTable
Run stopping procedure (unsynchronized)

Specified by:
stopping in interface IPeerTable
Overrides:
stopping in class PeerTableImpl

addPeer

public Peer addPeer(URI peerURI,
                    java.lang.String realm,
                    boolean connecting)
Specified by:
addPeer in interface MutablePeerTable

getAllRealms

public java.util.Set<Realm> getAllRealms()

removePeer

public Peer removePeer(java.lang.String host)
Specified by:
removePeer in interface MutablePeerTable

getStatistic

public Statistic getStatistic(java.lang.String name)
Specified by:
getStatistic in interface MutablePeerTable

isDuplicate

public IMessage isDuplicate(IMessage request)
Description copied from interface: IMutablePeerTable
Check message on duplicate

Specified by:
isDuplicate in interface IMutablePeerTable
Parameters:
request - checked message
Returns:
true if messahe has duplicate into storage

saveToDuplicate

public void saveToDuplicate(java.lang.String key,
                            IMessage answer)
Description copied from interface: IMutablePeerTable
Save message to duplicate storage

Specified by:
saveToDuplicate in interface IMutablePeerTable
Parameters:
key - key of message
answer - message

getSessionFactory

public ISessionFactory getSessionFactory()
Description copied from interface: IMutablePeerTable
Return instance of session factory

Specified by:
getSessionFactory in interface IMutablePeerTable
Returns:
instance of session factory

isWrapperFor

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

unwrap

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


Copyright © 2014. All Rights Reserved.