jPOS 1.6.1 API Documentation

org.jpos.iso
Class ISOServer

java.lang.Object
  extended by java.util.Observable
      extended by org.jpos.iso.ISOServer
All Implemented Interfaces:
java.lang.Runnable, java.util.Observer, Configurable, ReConfigurable, ISOServerMBean, Loggeable, LogSource, ThreadPoolMBean

public class ISOServer
extends java.util.Observable
implements LogSource, java.lang.Runnable, java.util.Observer, ISOServerMBean, ReConfigurable, Loggeable

Accept ServerChannel sessions and forwards them to ISORequestListeners

Version:
$Revision: 2610 $ $Date: 2008-03-04 11:29:35 -0800 (Tue, 04 Mar 2008) $
Author:
Alejandro P. Revilla, Bharavi Gade

Field Summary
static int CONNECT
           
static int DEFAULT_MAX_THREADS
           
static java.lang.String LAST
           
static int SIZEOF_CNT
           
 
Constructor Summary
ISOServer(int port, ServerChannel clientSide, ThreadPool pool)
           
 
Method Summary
 void addISORequestListener(ISORequestListener l)
          add an ISORequestListener
 void dump(java.io.PrintStream p, java.lang.String indent)
           
 int getConnectionCount()
           
 java.lang.String getCountersAsString()
           
 java.lang.String getCountersAsString(java.lang.String isoChannelName)
           
 int getIdleCount()
           
 ISOChannel getISOChannel(java.lang.String name)
           
 java.lang.String getISOChannelNames()
           
 int getJobCount()
           
 ISOChannel getLastConnectedISOChannel()
           
 Logger getLogger()
           
 int getMaxPoolSize()
           
 java.lang.String getName()
           
 int getPendingCount()
           
 int getPoolSize()
           
 int getPort()
           
 java.lang.String getRealm()
           
static ISOServer getServer(java.lang.String name)
           
 ISOServerSocketFactory getSocketFactory()
          Gets the ISOClientSocketFactory (may be null)
 void removeISORequestListener(ISORequestListener l)
          remove an ISORequestListener
 void resetCounters()
           
 void run()
           
 void setConfiguration(Configuration cfg)
           
 void setLogger(Logger logger, java.lang.String realm)
           
 void setName(java.lang.String name)
          associates this ISOServer with a name using NameRegistrar
 void setSocketFactory(ISOServerSocketFactory socketFactory)
          Sets the specified Socket Factory to create sockets
 void shutdown()
          Shutdown this server
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_THREADS

public static final int DEFAULT_MAX_THREADS
See Also:
Constant Field Values

LAST

public static final java.lang.String LAST
See Also:
Constant Field Values

CONNECT

public static final int CONNECT
See Also:
Constant Field Values

SIZEOF_CNT

public static final int SIZEOF_CNT
See Also:
Constant Field Values
Constructor Detail

ISOServer

public ISOServer(int port,
                 ServerChannel clientSide,
                 ThreadPool pool)
Parameters:
port - port to listen
clientSide - client side ISOChannel (where we accept connections)
pool - ThreadPool (created if null)
Method Detail

addISORequestListener

public void addISORequestListener(ISORequestListener l)
add an ISORequestListener

Parameters:
l - request listener to be added
See Also:
ISORequestListener

removeISORequestListener

public void removeISORequestListener(ISORequestListener l)
remove an ISORequestListener

Parameters:
l - a request listener to be removed
See Also:
ISORequestListener

shutdown

public void shutdown()
Shutdown this server


run

public void run()
Specified by:
run in interface java.lang.Runnable

setName

public void setName(java.lang.String name)
associates this ISOServer with a name using NameRegistrar

Parameters:
name - name to register
See Also:
NameRegistrar

getServer

public static ISOServer getServer(java.lang.String name)
                           throws NameRegistrar.NotFoundException
Returns:
ISOMUX instance with given name.
Throws:
NameRegistrar.NotFoundException;
NameRegistrar.NotFoundException
See Also:
NameRegistrar

getName

public java.lang.String getName()
Returns:
this ISOServer's name ("" if no name was set)

setLogger

public void setLogger(Logger logger,
                      java.lang.String realm)
Specified by:
setLogger in interface LogSource

getRealm

public java.lang.String getRealm()
Specified by:
getRealm in interface LogSource

getLogger

public Logger getLogger()
Specified by:
getLogger in interface LogSource

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

getSocketFactory

public ISOServerSocketFactory getSocketFactory()
Gets the ISOClientSocketFactory (may be null)

Since:
1.3.3
See Also:
ISOClientSocketFactory

setSocketFactory

public void setSocketFactory(ISOServerSocketFactory socketFactory)
Sets the specified Socket Factory to create sockets

Parameters:
socketFactory - the ISOClientSocketFactory
Since:
1.3.3
See Also:
ISOClientSocketFactory

getPort

public int getPort()
Specified by:
getPort in interface ISOServerMBean

resetCounters

public void resetCounters()
Specified by:
resetCounters in interface ISOServerMBean

getConnectionCount

public int getConnectionCount()
Specified by:
getConnectionCount in interface ISOServerMBean
Returns:
number of connections accepted by this server

getJobCount

public int getJobCount()
Specified by:
getJobCount in interface ThreadPoolMBean
Returns:
number of jobs processed by this pool

getPoolSize

public int getPoolSize()
Specified by:
getPoolSize in interface ThreadPoolMBean
Returns:
number of active threads

getMaxPoolSize

public int getMaxPoolSize()
Specified by:
getMaxPoolSize in interface ThreadPoolMBean
Returns:
max number of active threads allowed

getIdleCount

public int getIdleCount()
Specified by:
getIdleCount in interface ThreadPoolMBean
Returns:
number of idle threads

getPendingCount

public int getPendingCount()
Specified by:
getPendingCount in interface ThreadPoolMBean
Returns:
number of Pending jobs

getLastConnectedISOChannel

public ISOChannel getLastConnectedISOChannel()
Returns:
most recently connected ISOChannel or null

getISOChannel

public ISOChannel getISOChannel(java.lang.String name)
Returns:
ISOChannel under the given name

setConfiguration

public void setConfiguration(Configuration cfg)
                      throws ConfigurationException
Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - Configuration object
Throws:
ConfigurationException

getISOChannelNames

public java.lang.String getISOChannelNames()
Specified by:
getISOChannelNames in interface ISOServerMBean

getCountersAsString

public java.lang.String getCountersAsString()

getCountersAsString

public java.lang.String getCountersAsString(java.lang.String isoChannelName)
Specified by:
getCountersAsString in interface ISOServerMBean

dump

public void dump(java.io.PrintStream p,
                 java.lang.String indent)
Specified by:
dump in interface Loggeable

jPOS.org