|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.resource.internal.cm.ConnectionManagerImpl
public class ConnectionManagerImpl
Description of the ConnectionManagerImpl
Field Summary | |
---|---|
protected boolean |
dummyPool
True if the ConnectionManager pool is dummy. |
static int |
JDBC_CHECK_CONNECTION
|
static int |
JDBC_KEEP_ALIVE
|
static int |
JDBC_NO_TEST
Constants for use with JDBC connection level |
static int |
JDBC_SEND_STATEMENT
|
protected String |
jndiname
The jndiname of the associated factory |
static String |
JNDINAME
This constant is used by the init method |
static String |
LOCAL_TRANS_SUPPORT
Rar supports local transactions |
static String |
LOGGER
This constant is used in the by the init method |
static String |
LOGGER_FACTORY
This constant is used in the by the init method |
protected Hashtable |
mc2mci
This hashtable allows to find the list of connection handle associated to a ManagedConnection |
static String |
NO_TRANS_SUPPORT
Rar doesn't support transactions |
static String |
POOL_LOGGER
This constant is used in the by the init method |
static org.objectweb.util.monolog.api.Logger |
poolTrace
Pool infomation logger |
static String |
PRINT_WRITER
This constant is used in the by the init method |
static int |
PSWRAP_1
Constants to determine which PreparedStatement types to call |
static int |
PSWRAP_2
|
static int |
PSWRAP_3
|
static int |
PSWRAP_4
|
static int |
PSWRAP_5
|
static String |
RESOURCE_ADAPTER
This constant is used in the by the init method |
static String |
RESOURCE_BUNDLE_NAME
This constant is used in the by the init method |
protected TransactionManager |
tm
The transaction manager in server |
static org.objectweb.util.monolog.api.Logger |
trace
Main logger |
static String |
TRANSACTION_MANAGER
This constant is used in the by the init method |
static String |
XA_TRANS_SUPPORT
Rar supports XA transactions |
Constructor Summary | |
---|---|
ConnectionManagerImpl(String transSupport)
ConnectionManagerImpl constructor |
Method Summary | |
---|---|
Object |
allocateConnection(ManagedConnectionFactory pMcf,
ConnectionRequestInfo cxRequestInfo)
The method allocateConnection gets called by the resource adapter's connection factory instance. |
void |
cleanResourceAdapter()
Description of the Method |
void |
connectionClosed(ConnectionEvent event)
IMPLEMENTATION OF INTERFACE ConnectionEventListener * A ManagedConnection instance calls the connectionClosed method to notify its registered set of listeners when an application component closes a connection handle. |
void |
connectionErrorOccurred(ConnectionEvent event)
The connectionErrorOccurred method indicates that the associated ManagedConnection instance is now invalid and unusable. |
Object |
createResource(Object hints)
Call the ManagedConnectionFactory in order to create a new instance. |
void |
destroyPStmts(ManagedConnectionInfo mcinfo)
Destroying of the PreparedStatement objects of the Pool |
void |
forceCloseConnection(int connectionId)
force the close of the Connection identified by ots Id |
void |
freeXAResource(XAResource rmXares)
Called from JOTM to free the XAResource and associated Managed Connection when recovery is complete |
int |
getCheckLevel()
|
Map |
getConnectionDetails(int connectionId)
Return a Map with details about a Connection |
int |
getCurrentInTx()
|
List |
getManagedConnectionsWithoutTransaction()
|
int |
getMaxPstmtPoolSize()
|
int[] |
getOpenedConnections()
return a list of idents that represent the connections opened for a given nb of seconds |
int[] |
getOpenedConnections(int usedTimeSec)
return a list of idents that represent the connections opened for a given nb of seconds |
Pool |
getPool()
|
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql)
Get the specified PreparedStatement |
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql,
int autoGeneratedKeys)
Get the specified PreparedStatement |
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql,
int[] columnIndexes)
Get the specified PreparedStatement |
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql,
int resultSetType,
int resultSetConcurrency)
Get the specified PreparedStatement |
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
Get the specified PreparedStatement |
PreparedStatement |
getPStatement(ManagedConnectionInfo mcinfo,
Object conn,
String user,
String sql,
String[] columnNames)
Get the specified PreparedStatement |
String |
getState(String prefix)
Gets the State attribute of the ConnectionManagerImpl object |
List |
getSynchros()
|
String |
getTestStatement()
|
Map |
getUsedManagedConnections()
|
ValidatingManagedConnectionFactory |
getValidatingMCFactory()
|
String |
getXAName()
Get the XAName to use |
void |
init(Context ctx,
boolean generic)
Called by ResourceUtility.createConnectionManager to initialize the ConnectionManager with the following parameters: RESOURCE_BUNDLE_NAME: Name of the resource bundle to internationalize the logging LOGGER: The logger instance where events are logged LOGGER_FACTORY: A logger factory to obtain a logger PRINT_WRITER: The printwriter where event are logged TRANSACTION_MANAGER: The Transaction manager linked to this resource manager RESOURCE_MANAGER_EVENT_LISTENER: for later connection enlistement. |
boolean |
isJdbcConnSetUp()
|
boolean |
isObservable()
|
void |
localTransactionCommitted(ConnectionEvent event)
Notifies that a Resource Manager Local Transaction was committed on the ManagedConnection instance. |
void |
localTransactionRolledback(ConnectionEvent event)
Notifies that a Resource Manager Local Transaction was rolled back on the ManagedConnection instance. |
void |
localTransactionStarted(ConnectionEvent event)
Notifies that a Resource Manager Local Transaction was started on the ManagedConnection instance. |
boolean |
matchResource(Object res,
Object hints)
All method of the pool match to the right type of ManagedConnection because there is one pool by ManagedConnectionFactory. |
Object |
matchResource(Set res,
Object hints)
All method of the pool match to the right type of ManagedConnection because there is one pool by ManagedConnectionFactory. |
void |
registerXAResource(Properties tmProp)
Register an XAResource with JOTM for recovery |
void |
releaseResource(Object rMc)
Release the ManagedConnection object resource |
void |
setCheckLevel(int level)
|
void |
setLogger(org.objectweb.util.monolog.api.Logger l)
Setters method to initialize the ConnectionManager The logger instance where events are logged |
void |
setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
Setters method to initialize the ConnectionManager A logger factory to obtain a logger |
void |
setMaxPstmtPoolSize(int maxPstmtPoolSize)
|
void |
setObservable(boolean observable)
|
void |
setPrintWriter(PrintWriter pw)
Setters method to initialize the ConnectionManager The printwriter where event are logged |
void |
setResourceAdapter(ManagedConnectionFactory tmcf)
Setters method to initialize the ConnectionManager The managedConnectionFactory instance of the resource which must be managed by this connectionManager |
void |
setResourceAdapter(ManagedConnectionFactory tmcf,
ConnectionManagerPoolParams cmpp)
Setters method to initialize the ConnectionManager The managedConnectionFactory instance of the resource which must be maneged by this connectionManager |
void |
setTestStatement(String stmt)
|
void |
setTransactionManager(TransactionManager tm)
Setters method to initialize the ConnectionManager The Transaction manager linked to this resource managed |
void |
setXAName(String xanm)
Set the XAName to use |
String |
toString()
Description of the Method |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static org.objectweb.util.monolog.api.Logger trace
public static org.objectweb.util.monolog.api.Logger poolTrace
protected boolean dummyPool
protected TransactionManager tm
protected Hashtable mc2mci
protected String jndiname
public static final String RESOURCE_BUNDLE_NAME
public static final String LOGGER
public static final String POOL_LOGGER
public static final String JNDINAME
public static final String LOGGER_FACTORY
public static final String TRANSACTION_MANAGER
public static final String RESOURCE_ADAPTER
public static final String PRINT_WRITER
public static final String NO_TRANS_SUPPORT
public static final String LOCAL_TRANS_SUPPORT
public static final String XA_TRANS_SUPPORT
public static final int PSWRAP_1
public static final int PSWRAP_2
public static final int PSWRAP_3
public static final int PSWRAP_4
public static final int PSWRAP_5
public static final int JDBC_NO_TEST
public static final int JDBC_CHECK_CONNECTION
public static final int JDBC_SEND_STATEMENT
public static final int JDBC_KEEP_ALIVE
Constructor Detail |
---|
public ConnectionManagerImpl(String transSupport)
transSupport
- String defining level of support neededMethod Detail |
---|
public void setLogger(org.objectweb.util.monolog.api.Logger l)
l
- The new Logger valuepublic void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
lf
- The new LoggerFactory valuepublic void setPrintWriter(PrintWriter pw)
pw
- The new PrintWriter valuepublic void setTransactionManager(TransactionManager tm)
tm
- TransactionManager valuepublic void setResourceAdapter(ManagedConnectionFactory tmcf) throws Exception
tmcf
- The new ResourceAdapter value
Exception
- Description of Exceptionpublic void setResourceAdapter(ManagedConnectionFactory tmcf, ConnectionManagerPoolParams cmpp) throws Exception
tmcf
- The ManagedConnectionFactory objectcmpp
- The pool parameters
Exception
- Description of Exceptionpublic void init(Context ctx, boolean generic) throws Exception
ctx
- Description of Parametergeneric
- RA is generic: No actual pool of Connections
Exception
- Description of Exceptionpublic void cleanResourceAdapter() throws ResourceException
ResourceException
- Description of Exceptionpublic Object allocateConnection(ManagedConnectionFactory pMcf, ConnectionRequestInfo cxRequestInfo) throws ResourceException
allocateConnection
in interface ConnectionManager
ResourceException
ConnectionManager
public boolean matchResource(Object res, Object hints)
matchResource
in interface PoolMatchFactory
res
- The Object to test its matching with some
"properties" specified by hints.hints
- The "properties" that the Object specified by pr
should match.
org.objectweb.util.pool.api.PoolMatchFactory
public Object matchResource(Set res, Object hints) throws Exception
matchResource
in interface PoolMatchFactory
res
- A set of Objects to test if matching with some
"properties" specified by hints.hints
- The "properties" that the Object specified by pr
should match.
Exception
- Description of Exceptionorg.objectweb.util.pool.api.PoolMatchFactory
public Object createResource(Object hints) throws Exception
createResource
in interface PoolMatchFactory
hints
- The "properties" that the created Object should
conform to.
Exception
- if an error occursorg.objectweb.util.pool.api.PoolMatchFactory
public ValidatingManagedConnectionFactory getValidatingMCFactory()
getValidatingMCFactory
in interface PoolMatchFactory
public PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- String
SQLException
- if an Exception occurspublic PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql, int resultSetType, int resultSetConcurrency) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- StringresultSetType
- intresultSetConcurrency
- int
SQLException
- if an Exception occurspublic PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- StringresultSetType
- intresultSetConcurrency
- intresultSetHoldability
- int
SQLException
- if an Exception occurspublic PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql, int autoGeneratedKeys) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- StringautoGeneratedKeys
- key
SQLException
- if an Exception occurspublic PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql, int[] columnIndexes) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- StringcolumnIndexes
- int []
SQLException
- if an Exception occurspublic PreparedStatement getPStatement(ManagedConnectionInfo mcinfo, Object conn, String user, String sql, String[] columnNames) throws SQLException
SQLManager
getPStatement
in interface SQLManager
mcinfo
- ManagedConnectionInfoconn
- Object connectionuser
- Stringsql
- StringcolumnNames
- String []
SQLException
- if an Exception occurspublic void releaseResource(Object rMc) throws Exception
releaseResource
in interface PoolMatchFactory
rMc
- Object to release
Exception
- if an Exception occurspublic void destroyPStmts(ManagedConnectionInfo mcinfo) throws Exception
mcinfo
- ManagedConnection information
Exception
- Exceptionpublic void connectionClosed(ConnectionEvent event)
connectionClosed
in interface ConnectionEventListener
ConnectionEventListener
public void connectionErrorOccurred(ConnectionEvent event)
connectionErrorOccurred
in interface ConnectionEventListener
ConnectionEventListener
public void localTransactionCommitted(ConnectionEvent event)
localTransactionCommitted
in interface ConnectionEventListener
ConnectionEventListener
public void localTransactionRolledback(ConnectionEvent event)
localTransactionRolledback
in interface ConnectionEventListener
ConnectionEventListener
public void localTransactionStarted(ConnectionEvent event)
localTransactionStarted
in interface ConnectionEventListener
ConnectionEventListener
public String toString()
toString
in class Object
public String getState(String prefix)
prefix
- Description of Parameter
public void setXAName(String xanm)
xanm
- String of XA Namepublic String getXAName()
public void registerXAResource(Properties tmProp)
public void freeXAResource(XAResource rmXares)
freeXAResource
in interface TxResourceManager
rmName
- The Resource Manager to be unregistered.rmXares
- XAResource to be returnedpublic Pool getPool()
public boolean isJdbcConnSetUp()
public int getCheckLevel()
public void setCheckLevel(int level)
public String getTestStatement()
public void setTestStatement(String stmt)
public boolean isObservable()
public void setObservable(boolean observable)
observable
- the observable to setpublic int getCurrentInTx()
public int getMaxPstmtPoolSize()
getMaxPstmtPoolSize
in interface SQLManager
public void setMaxPstmtPoolSize(int maxPstmtPoolSize)
maxPstmtPoolSize
- The maxPstmtPoolSize to set.public int[] getOpenedConnections(int usedTimeSec)
usedTimeSec
- nb of seconds the Connection has been opened
public int[] getOpenedConnections()
public void forceCloseConnection(int connectionId)
connectionId
- int that represent the Connectionpublic Map getConnectionDetails(int connectionId)
connectionId
- Ident that represent the connection
public List getSynchros()
public Map getUsedManagedConnections()
Transaction
)public List getManagedConnectionsWithoutTransaction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |