Class OneShotChannelAdaptorMK2
java.lang.Object
org.jpos.q2.QBeanSupport
org.jpos.q2.iso.OneShotChannelAdaptorMK2
- All Implemented Interfaces:
Runnable, Configurable, Channel, OneShotChannelAdaptorMK2MBean, QBean, QBeanSupportMBean, QPersist
public class OneShotChannelAdaptorMK2
extends QBeanSupport
implements OneShotChannelAdaptorMK2MBean, Channel, Runnable
OneShotChannelAdaptorMK2 connects and disconnects a channel for every message
exchange. It is similar to OneShotChannelAdaptor but uses a thread pool instead
of opening threads statically and supports mux pooling by exposing channel readiness.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassPer-message worker that opens an ad-hoc channel, sends a request, and forwards the response. -
Field Summary
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.getHost()Returns the configured remote host.Returns the inbound queue name.Returns the outbound queue name.intgetPort()Returns the configured remote port.Returns the configured socket-factory class name.protected voidCalled during the init lifecycle phase; subclasses may override.booleanIndicates whether the adaptor's underlying channel is currently connected.receive()Receives an ISO message from this channel.receive(long timeout) Receives an ISO message, waiting at mosttimeoutmilliseconds.voidrun()voidSends a message via the inbound queue with no expiration.voidSends a message via the inbound queue with a per-entry lease.voidSets the remote host.voidsetInQueue(String in) Sets the inbound queue name.voidsetOutQueue(String out) Sets the outbound queue name.voidsetPort(int port) Sets the remote port.voidsetSocketFactory(String sFac) Sets the socket-factory class name.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
-
Constructor Details
-
OneShotChannelAdaptorMK2
public OneShotChannelAdaptorMK2()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:
Exception- on error
-
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
-
isConnected
Description copied from interface:OneShotChannelAdaptorMK2MBeanIndicates whether the adaptor's underlying channel is currently connected.- Specified by:
isConnectedin interfaceOneShotChannelAdaptorMK2MBean- Returns:
trueif the channel is up
-
run
-
send
-
send
-
receive
-
receive
-
getInQueue
Description copied from interface:OneShotChannelAdaptorMK2MBeanReturns the inbound queue name.- Specified by:
getInQueuein interfaceOneShotChannelAdaptorMK2MBean- Returns:
- queue name
-
setInQueue
Description copied from interface:OneShotChannelAdaptorMK2MBeanSets the inbound queue name.- Specified by:
setInQueuein interfaceOneShotChannelAdaptorMK2MBean- Parameters:
in- queue name
-
getOutQueue
Description copied from interface:OneShotChannelAdaptorMK2MBeanReturns the outbound queue name.- Specified by:
getOutQueuein interfaceOneShotChannelAdaptorMK2MBean- Returns:
- queue name
-
setOutQueue
Description copied from interface:OneShotChannelAdaptorMK2MBeanSets the outbound queue name.- Specified by:
setOutQueuein interfaceOneShotChannelAdaptorMK2MBean- Parameters:
out- queue name
-
getHost
Description copied from interface:OneShotChannelAdaptorMK2MBeanReturns the configured remote host.- Specified by:
getHostin interfaceOneShotChannelAdaptorMK2MBean- Returns:
- host name or address
-
setHost
Description copied from interface:OneShotChannelAdaptorMK2MBeanSets the remote host.- Specified by:
setHostin interfaceOneShotChannelAdaptorMK2MBean- Parameters:
host- host name or address
-
getPort
Description copied from interface:OneShotChannelAdaptorMK2MBeanReturns the configured remote port.- Specified by:
getPortin interfaceOneShotChannelAdaptorMK2MBean- Returns:
- TCP port number
-
setPort
Description copied from interface:OneShotChannelAdaptorMK2MBeanSets the remote port.- Specified by:
setPortin interfaceOneShotChannelAdaptorMK2MBean- Parameters:
port- TCP port number
-
getSocketFactory
Returns the configured socket-factory class name.- Specified by:
getSocketFactoryin interfaceOneShotChannelAdaptorMK2MBean- Returns:
- socket factory class name
-
setSocketFactory
Sets the socket-factory class name.- Specified by:
setSocketFactoryin interfaceOneShotChannelAdaptorMK2MBean- Parameters:
sFac- socket factory class name
-