Package org.jpos.q2.iso
Class MUXPool
- java.lang.Object
-
- org.jpos.q2.QBeanSupport
-
- org.jpos.q2.iso.MUXPool
-
- All Implemented Interfaces:
Configurable
,ISOSource
,MUX
,MUXPoolMBean
,QBean
,QBeanSupportMBean
,QPersist
public class MUXPool extends QBeanSupport implements MUX, MUXPoolMBean
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MUXPool.StrategyHandler
A class implementing this interface can be added to aMUXPool
to override the classical built-in strategies.
It could be added to aMUXPool
like this:
-
Field Summary
Fields Modifier and Type Field Description static int
PRIMARY_SECONDARY
static int
ROUND_ROBIN
static int
ROUND_ROBIN_WITH_OVERRIDE
static int
SPLIT_BY_DIVISOR
-
Fields inherited from class org.jpos.q2.QBeanSupport
cfg, log, scheduledThreadPoolExecutor
-
-
Constructor Summary
Constructors Constructor Description MUXPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MUX
firstAvailableMUX(long maxWait)
java.lang.String[]
getMuxNames()
int
getStrategy()
MUXPool.StrategyHandler
getStrategyHandler()
protected void
initHandler(org.jdom2.Element e)
void
initService()
boolean
isConnected()
protected MUX
nextAvailableMUX(int mnumber, long maxWait)
ISOMsg
request(ISOMsg m, long timeout)
Sends a message to remote host and wait for responsevoid
request(ISOMsg m, long timeout, ISOResponseListener r, java.lang.Object handBack)
Sends a message to remote host in async wayvoid
send(ISOMsg m)
sends (or hands back) an ISOMsgvoid
stopService()
-
Methods inherited from class org.jpos.q2.QBeanSupport
addAttr, close, createElement, destroy, destroyService, 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, startService, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jpos.q2.QBean
destroy, getState, getStateAsString, init, start, stop
-
Methods inherited from interface org.jpos.q2.QBeanSupportMBean
getDump, getLoader, getLoaderURLS, getLogger, getName, getRealm, getServer, setLogger, setName, setPersist, setRealm, setServer
-
Methods inherited from interface org.jpos.q2.QPersist
getPersist, isModified
-
-
-
-
Field Detail
-
PRIMARY_SECONDARY
public static final int PRIMARY_SECONDARY
- See Also:
- Constant Field Values
-
ROUND_ROBIN
public static final int ROUND_ROBIN
- See Also:
- Constant Field Values
-
ROUND_ROBIN_WITH_OVERRIDE
public static final int ROUND_ROBIN_WITH_OVERRIDE
- See Also:
- Constant Field Values
-
SPLIT_BY_DIVISOR
public static final int SPLIT_BY_DIVISOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MUXPool
public MUXPool()
-
-
Method Detail
-
initService
public void initService() throws ConfigurationException
- Overrides:
initService
in classQBeanSupport
- Throws:
ConfigurationException
-
stopService
public void stopService()
- Overrides:
stopService
in classQBeanSupport
-
initHandler
protected void initHandler(org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
request
public ISOMsg request(ISOMsg m, long timeout) throws ISOException
Description copied from interface:MUX
Sends a message to remote host and wait for response- Specified by:
request
in interfaceMUX
- Parameters:
m
- message to sendtimeout
- time to wait for a message- Returns:
- received message or null
- Throws:
ISOException
-
request
public void request(ISOMsg m, long timeout, ISOResponseListener r, java.lang.Object handBack) throws ISOException
Description copied from interface:MUX
Sends a message to remote host in async way- Specified by:
request
in interfaceMUX
- Parameters:
m
- message to sendtimeout
- time to wait for the responser
- reference to response listenerhandBack
- optional handback to be given to reponse listener- Throws:
ISOException
-
send
public void send(ISOMsg m) throws ISOException, java.io.IOException
Description copied from interface:ISOSource
sends (or hands back) an ISOMsg- Specified by:
send
in interfaceISOSource
- Parameters:
m
- the Message to be sent- Throws:
ISOException
java.io.IOException
-
firstAvailableMUX
protected MUX firstAvailableMUX(long maxWait)
-
nextAvailableMUX
protected MUX nextAvailableMUX(int mnumber, long maxWait)
-
getMuxNames
public java.lang.String[] getMuxNames()
- Specified by:
getMuxNames
in interfaceMUXPoolMBean
-
getStrategy
public int getStrategy()
- Specified by:
getStrategy
in interfaceMUXPoolMBean
-
getStrategyHandler
public MUXPool.StrategyHandler getStrategyHandler()
-
isConnected
public boolean isConnected()
- Specified by:
isConnected
in interfaceISOSource
- Returns:
- true if source is connected and usable
-
-