com.infoengine.messaging
Class MsgService.MOMSharedPool

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.infoengine.util.IEThread
          extended bycom.infoengine.messaging.MsgService.MOMSharedPool
All Implemented Interfaces:
MsgService.MOMConnectionPool, Runnable
Enclosing class:
MsgService

class MsgService.MOMSharedPool
extends IEThread
implements MsgService.MOMConnectionPool

A simple connection pool used to organize and maintain connections to a MOM. Since SonicMQ will only allow one connection per user name this pool only maintains one connection per user. Each time a connection is retrieved from the pool its reference count is incremented. A connection's reference counts indicates how many times a particular connection is in use. each time a connection is released from the pool its reference count is decremented. When the reference count reaches zero the connection may be removed from the pool since it is no longer in use. A connection with a reference count of zero will remain available in the pool for a period of time before being removed to avoid the over head of creating a new connection if another request for the particular connection comes along. After a connection has been idle for a certain period of time it will be removed from the pool and closed.


Field Summary
(package private)  MsgService.MOMHash connections
           
private  boolean die
           
private  long expireInterval
           
private  javax.jms.ConnectionFactory factory
           
private  long idleTime
           
private  String myName
           
private  MsgService service
           
 
Fields inherited from class com.infoengine.util.IEThread
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MsgService.MOMSharedPool(String myName, MsgService service, javax.jms.ConnectionFactory factory)
           
 
Method Summary
 void die()
           
private  void expire()
           
 javax.jms.Connection get(String user, String pass)
           
 void logStatus(String log)
           
 void release(String user, String pass)
           
 void run()
           
 String toString()
           
 
Methods inherited from class com.infoengine.util.IEThread
getParentThread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myName

private String myName

service

private MsgService service

factory

private javax.jms.ConnectionFactory factory

connections

MsgService.MOMHash connections

die

private boolean die

expireInterval

private long expireInterval

idleTime

private long idleTime
Constructor Detail

MsgService.MOMSharedPool

public MsgService.MOMSharedPool(String myName,
                                MsgService service,
                                javax.jms.ConnectionFactory factory)
Method Detail

run

public void run()
Specified by:
run in interface Runnable

die

public void die()
Specified by:
die in interface MsgService.MOMConnectionPool

expire

private void expire()

get

public javax.jms.Connection get(String user,
                                String pass)
                         throws javax.jms.JMSException
Specified by:
get in interface MsgService.MOMConnectionPool
Throws:
javax.jms.JMSException

release

public void release(String user,
                    String pass)
Specified by:
release in interface MsgService.MOMConnectionPool

toString

public String toString()

logStatus

public void logStatus(String log)