Class QServer
java.lang.Object
org.jpos.q2.QBeanSupport
org.jpos.q2.iso.QServer
- All Implemented Interfaces:
Configurable, ISORequestListener, QServerMBean, QBean, QBeanSupportMBean, QPersist, SpaceListener
public class QServer
extends QBeanSupport
implements QServerMBean, SpaceListener, ISORequestListener
ISO Server wrapper.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LocalSpaceLocal space used for inbound/outbound queue routing when configured.Fields inherited from class QBeanSupport
cfg, log, scheduledThreadPoolExecutorModifier and TypeFieldDescriptionprotected ConfigurationConfiguration applied to this bean by the container.protected LogLogger associated with this bean.protected ScheduledThreadPoolExecutorLazily-allocated scheduler shared with subclasses; seeQBeanSupport.getScheduledThreadPoolExecutor().Fields inherited from interface QBean
DESTROYED, FAILED, STARTED, STARTING, stateString, STOPPED, STOPPINGModifier and TypeFieldDescriptionstatic final intQBean has been destroyed.static final intQBean has failed.static final intQBean is running.static final intQBean is in the process of starting.static final String[]Human-readable names for each QBean state, indexed by state constant.static final intQBean is stopped.static final intQBean is in the process of stopping. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringReturns the default realm for this bean; subclasses may override.voidCalled during the destroy lifecycle phase; subclasses may override.Returns the configured channel class name.Returns aggregated counters across all active channels.getCountersAsString(String isoChannelName) Returns counters for a single named accepted channel.Returns the names of all currently-active accepted channels, comma-separated.Returns the underlyingISOServercreated by this bean.intReturns the configured maximum number of concurrent client sessions.Returns the configured packager class name.intgetPort()Returns the configured listen port.Returns the configured socket-factory class name.voidCalled during the init lifecycle phase; subclasses may override.voidCalled by Space implementation whenever an object with the given key is being placed in the Space.booleanCalled when an unmatched request is received.voidsetChannel(String channel) Sets the fully qualified channel class name instantiated for each accepted connection.voidsetMaxSessions(int maxSessions) Sets the maximum number of concurrent client sessions accepted by the server.voidsetPackager(String packager) Sets the fully qualified packager class name used by accepted channels.voidsetPort(int port) Sets the TCP port the server listens on.voidsetSocketFactory(String sFactory) Sets the fully qualified socket-factory class name used to create the server socket.voidCalled during the start lifecycle phase; subclasses may override.voidCalled during the stop lifecycle phase; subclasses may override.Methods inherited from class QBeanSupport
addAttr, close, createElement, destroy, getAttrs, getAttrs, getConfiguration, getDump, getFactory, getLoader, getLoaderURLS, getLog, getLogger, getName, getPersist, getProperties, getProperty, getRealm, getScheduledThreadPoolExecutor, getServer, getState, getStateAsString, init, isModified, running, setAttr, setConfiguration, setLogger, setModified, setName, setPersist, setProperty, setRealm, setServer, setState, start, stopModifier and TypeMethodDescriptionprotected voidAppends an<attr>child element with name/type/value toe.protected voidCloses a sequence ofCloseableresources, logging any failures as a warning.protected org.jdom2.ElementcreateElement(String name, Class mbeanClass) Builds a JDOMElementreflecting the bean's persistent attributes, driven by the JavaBean introspection ofmbeanClass.voiddestroy()destroy the serviceprotected IteratorgetAttrs()Iterates over top-level<attr>children of the persisted element.protected IteratorIterates over<attr>children nested under the given parent element name.Returns the configuration applied to this bean.getDump()Returns a textual dump of this bean's state.Returns theQFactoryassociated with the hosting Q2 server.Returns the QClassLoader for this bean.URL[]Returns the URLs registered with the class loader.getLog()Returns theLogused by this bean.Returns the logger name.getName()Returns the bean name.org.jdom2.ElementReturns the persistent configuration element for this QBean.protected IteratorgetProperties(String parent) Iterates over<property>children nested under the given parent element name.protected StringgetProperty(Iterator props, String name) Returns the value of the named property from an iterator of<property>elements.getRealm()Returns the logging realm.protected ScheduledThreadPoolExecutorLazily creates and returns aScheduledThreadPoolExecutorfor use by subclasses.Returns the Q2 server instance.intgetState()Returns the current state of this QBean.Returns the current state as a human-readable string.voidinit()init the servicebooleanReturnstrueif this QBean's configuration has been modified since last save.booleanrunning()Indicates whether this bean is currently starting or running.protected voidUpdates the value of the named attribute within an iterator of<attr>elements.voidConfigures this object with the suppliedConfiguration.voidSets the logger by name.voidsetModified(boolean modified) Marks this bean's persistent state as modified or in sync.voidSets the bean name.voidsetPersist(org.jdom2.Element persist) Sets the persistent configuration element.protected voidsetProperty(Iterator props, String name, String value) Updates the value attribute of the named property within an iterator of<property>elements.voidSets the logging realm.voidSets the Q2 server instance for this QBean.voidsetState(int state) Sets the lifecycle state of this bean.voidstart()start the servicevoidstop()stop the service
-
Field Details
-
sp
Local space used for inbound/outbound queue routing when configured.
-
-
Constructor Details
-
QServer
public QServer()Default constructor.
-
-
Method Details
-
defaultRealm
Description copied from class:QBeanSupportReturns the default realm for this bean; subclasses may override.- Overrides:
defaultRealmin classQBeanSupport- Returns:
- default realm string, or null
-
initService
Description copied from class:QBeanSupportCalled during the init lifecycle phase; subclasses may override.- Overrides:
initServicein classQBeanSupport- Throws:
ConfigurationException
-
startService
Description copied from class:QBeanSupportCalled during the start lifecycle phase; subclasses may override.- Overrides:
startServicein classQBeanSupport
-
stopService
Description copied from class:QBeanSupportCalled during the stop lifecycle phase; subclasses may override.- Overrides:
stopServicein classQBeanSupport
-
destroyService
Description copied from class:QBeanSupportCalled during the destroy lifecycle phase; subclasses may override.- Overrides:
destroyServicein classQBeanSupport
-
setPort
Description copied from interface:QServerMBeanSets the TCP port the server listens on.- Specified by:
setPortin interfaceQServerMBean- Parameters:
port- TCP port number
-
getPort
Description copied from interface:QServerMBeanReturns the configured listen port.- Specified by:
getPortin interfaceQServerMBean- Returns:
- TCP port number
-
setPackager
Description copied from interface:QServerMBeanSets the fully qualified packager class name used by accepted channels.- Specified by:
setPackagerin interfaceQServerMBean- Parameters:
packager- packager class name
-
getPackager
Description copied from interface:QServerMBeanReturns the configured packager class name.- Specified by:
getPackagerin interfaceQServerMBean- Returns:
- packager class name
-
setChannel
Description copied from interface:QServerMBeanSets the fully qualified channel class name instantiated for each accepted connection.- Specified by:
setChannelin interfaceQServerMBean- Parameters:
channel- channel class name
-
getChannel
Description copied from interface:QServerMBeanReturns the configured channel class name.- Specified by:
getChannelin interfaceQServerMBean- Returns:
- channel class name
-
setMaxSessions
Description copied from interface:QServerMBeanSets the maximum number of concurrent client sessions accepted by the server.- Specified by:
setMaxSessionsin interfaceQServerMBean- Parameters:
maxSessions- maximum sessions
-
getMaxSessions
Description copied from interface:QServerMBeanReturns the configured maximum number of concurrent client sessions.- Specified by:
getMaxSessionsin interfaceQServerMBean- Returns:
- maximum sessions
-
setSocketFactory
Description copied from interface:QServerMBeanSets the fully qualified socket-factory class name used to create the server socket.- Specified by:
setSocketFactoryin interfaceQServerMBean- Parameters:
sFactory- socket factory class name
-
getSocketFactory
Description copied from interface:QServerMBeanReturns the configured socket-factory class name.- Specified by:
getSocketFactoryin interfaceQServerMBean- Returns:
- socket factory class name
-
getISOChannelNames
Description copied from interface:QServerMBeanReturns the names of all currently-active accepted channels, comma-separated.- Specified by:
getISOChannelNamesin interfaceQServerMBean- Returns:
- comma-separated active channel names
-
getISOServer
Returns the underlyingISOServercreated by this bean.- Returns:
- the live server, or
nullif not yet started
-
getCountersAsString
Description copied from interface:QServerMBeanReturns aggregated counters across all active channels.- Specified by:
getCountersAsStringin interfaceQServerMBean- Returns:
- counter snapshot suitable for diagnostics
-
getCountersAsString
Description copied from interface:QServerMBeanReturns counters for a single named accepted channel.- Specified by:
getCountersAsStringin interfaceQServerMBean- Parameters:
isoChannelName- accepted channel's name- Returns:
- counter snapshot suitable for diagnostics, or empty if the channel is unknown
-
notify
Description copied from interface:SpaceListenerCalled by Space implementation whenever an object with the given key is being placed in the Space.
- Specified by:
notifyin interfaceSpaceListener- Parameters:
key- Object's keyvalue- Object's value
-
process
Description copied from interface:ISORequestListenerCalled when an unmatched request is received. Processes an unmatched ISO request.- Specified by:
processin interfaceISORequestListener- Parameters:
source- source where you optionally can replym- the unmatched request- Returns:
- true if request was handled by this listener
-