jPOS 1.6.1 API Documentation

org.jpos.iso
Class ISOMUX

java.lang.Object
  extended by org.jpos.iso.ISOMUX
All Implemented Interfaces:
java.lang.Runnable, Configurable, ReConfigurable, ISOMUXMBean, ISOSource, MUX, Loggeable, LogSource

public class ISOMUX
extends java.lang.Object
implements java.lang.Runnable, ISOSource, LogSource, MUX, ReConfigurable, Loggeable, ISOMUXMBean

Should run in it's own thread. Starts another Receiver thread

Version:
$Revision: 2594 $ $Date: 2008-01-22 08:41:31 -0800 (Tue, 22 Jan 2008) $
Author:
Alejandro P. Revilla
See Also:
ISORequest, ISOChannel, ISOException, ISORequestListener

Field Summary
static int CONNECT
           
static int RX
           
static int RX_EXPIRED
           
static int RX_FORWARDED
           
static int RX_PENDING
           
static int RX_UNKNOWN
           
static int SIZEOF_CNT
           
static int TX
           
static int TX_EXPIRED
           
static int TX_PENDING
           
 
Constructor Summary
ISOMUX(ISOChannel c)
           
ISOMUX(ISOChannel c, Logger logger, java.lang.String realm)
           
 
Method Summary
 void dump(java.io.PrintStream p, java.lang.String indent)
           
 boolean getConnect()
           
 int getConnectionCount()
           
 int[] getCounters()
          get the counters in order to pretty print them or for stats purposes
 int getExpiredCount()
           
 int getForwardedCount()
           
 ISOChannel getISOChannel()
           
 Logger getLogger()
           
static ISOMUX getMUX(java.lang.String name)
           
 java.lang.String getName()
           
 java.lang.String getRealm()
           
 int getReceiveCount()
           
 int getReceiveExpiredCount()
           
 int getReceivePendingCount()
           
 int getTransmitCount()
           
 int getTransmitPendingCount()
           
 int getUnknownCount()
           
 boolean isConnected()
           
 boolean isTerminating()
           
 void queue(ISORequest r)
          queue an ISORequest
 void removeISORequestListener()
          remove possible ISORequestListener
 ISOMsg request(ISOMsg m, long timeout)
           
 void request(ISOMsg m, long timeout, ISOResponseListener r, java.lang.Object handBack)
           
 void resetCounters()
           
 void run()
           
 void send(ISOMsg m)
          send a message over channel, usually a response from an ISORequestListener
 void setConfiguration(Configuration cfg)
           
 void setConnect(boolean connect)
          ISOMUXs usually calls connect() on the underlying ISOChannel
You can prevent this behaveour by passing a false value.
 void setISORequestListener(ISORequestListener rl)
          set an ISORequestListener for unmatched messages
 void setLogger(Logger logger, java.lang.String realm)
           
 void setName(java.lang.String name)
          associates this ISOMUX with a name using NameRegistrar
 void setTraceNumberField(int traceNumberField)
          allow changes to default value 11 (used in ANSI X9.2 messages)
 void showCounters(java.io.PrintStream p)
          show Counters
 void terminate()
          terminate MUX (soft terminate, wait forever if necessary)
 void terminate(int wait)
          terminate MUX
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECT

public static final int CONNECT
See Also:
Constant Field Values

TX

public static final int TX
See Also:
Constant Field Values

RX

public static final int RX
See Also:
Constant Field Values

TX_EXPIRED

public static final int TX_EXPIRED
See Also:
Constant Field Values

RX_EXPIRED

public static final int RX_EXPIRED
See Also:
Constant Field Values

TX_PENDING

public static final int TX_PENDING
See Also:
Constant Field Values

RX_PENDING

public static final int RX_PENDING
See Also:
Constant Field Values

RX_UNKNOWN

public static final int RX_UNKNOWN
See Also:
Constant Field Values

RX_FORWARDED

public static final int RX_FORWARDED
See Also:
Constant Field Values

SIZEOF_CNT

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

ISOMUX

public ISOMUX(ISOChannel c)
Parameters:
c - a connected or unconnected ISOChannel

ISOMUX

public ISOMUX(ISOChannel c,
              Logger logger,
              java.lang.String realm)
Parameters:
c - a connected or unconnected ISOChannel
logger - a logger
realm - logger's realm
Method Detail

setConfiguration

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

setTraceNumberField

public void setTraceNumberField(int traceNumberField)
allow changes to default value 11 (used in ANSI X9.2 messages)

Parameters:
traceNumberField - new traceNumberField

getISOChannel

public ISOChannel getISOChannel()
Returns:
the underlying ISOChannel

setISORequestListener

public void setISORequestListener(ISORequestListener rl)
set an ISORequestListener for unmatched messages

Parameters:
rl - a request listener object
See Also:
ISORequestListener

removeISORequestListener

public void removeISORequestListener()
remove possible ISORequestListener

See Also:
ISORequestListener

showCounters

public void showCounters(java.io.PrintStream p)
show Counters

Parameters:
p - - where to print

getCounters

public int[] getCounters()
get the counters in order to pretty print them or for stats purposes


resetCounters

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

getConnectionCount

public int getConnectionCount()
Specified by:
getConnectionCount in interface ISOMUXMBean
Returns:
number of re-connections on the underlying channel

getTransmitCount

public int getTransmitCount()
Specified by:
getTransmitCount in interface ISOMUXMBean
Returns:
number of transmitted messages

getExpiredCount

public int getExpiredCount()
Specified by:
getExpiredCount in interface ISOMUXMBean
Returns:
number of expired messages

getTransmitPendingCount

public int getTransmitPendingCount()
Specified by:
getTransmitPendingCount in interface ISOMUXMBean
Returns:
number of messages waiting to be transmited

getReceiveCount

public int getReceiveCount()
Specified by:
getReceiveCount in interface ISOMUXMBean
Returns:
number of received messages

getReceiveExpiredCount

public int getReceiveExpiredCount()
Specified by:
getReceiveExpiredCount in interface ISOMUXMBean
Returns:
number of unanswered messages

getReceivePendingCount

public int getReceivePendingCount()
Specified by:
getReceivePendingCount in interface ISOMUXMBean
Returns:
number of messages waiting for response

getUnknownCount

public int getUnknownCount()
Specified by:
getUnknownCount in interface ISOMUXMBean
Returns:
number of unknown messages received

getForwardedCount

public int getForwardedCount()
Specified by:
getForwardedCount in interface ISOMUXMBean
Returns:
number of forwarded messages received

run

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

queue

public void queue(ISORequest r)
queue an ISORequest


send

public void send(ISOMsg m)
send a message over channel, usually a response from an ISORequestListener

Specified by:
send in interface ISOSource
Parameters:
m - the Message to be sent

terminate

public void terminate(int wait)
terminate MUX

Parameters:
wait - Time to wait before forcing shutdown

terminate

public void terminate()
terminate MUX (soft terminate, wait forever if necessary)


isConnected

public boolean isConnected()
Specified by:
isConnected in interface ISOMUXMBean
Specified by:
isConnected in interface ISOSource
Specified by:
isConnected in interface MUX
Returns:
true if source is connected and usable

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

isTerminating

public boolean isTerminating()

setName

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

Parameters:
name - name to register
See Also:
NameRegistrar

getMUX

public static ISOMUX getMUX(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 ISOMUX's name ("" if no name was set)

setConnect

public void setConnect(boolean connect)
ISOMUXs usually calls connect() on the underlying ISOChannel
You can prevent this behaveour by passing a false value.

Specified by:
setConnect in interface ISOMUXMBean
Parameters:
connect - false to prevent connection (default true)

getConnect

public boolean getConnect()
Specified by:
getConnect in interface ISOMUXMBean
Returns:
connect flag value

dump

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

request

public ISOMsg request(ISOMsg m,
                      long timeout)
               throws ISOException
Specified by:
request in interface MUX
Parameters:
m - message to send
timeout - 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
Specified by:
request in interface MUX
Throws:
ISOException

jPOS.org