com.ibatis.db.sqlmap
Class StatementFactory

java.lang.Object
  extended bycom.ibatis.db.sqlmap.StatementFactory

public class StatementFactory
extends java.lang.Object


Nested Class Summary
private static class StatementFactory.StatementWrapper
          This class is used for managing pooled PreparedStatements while they are in use.
 
Field Summary
private  java.util.List allAvailableStatements
           
private  java.util.Map availableStatementMap
           
private  java.util.Map busyStatementMap
           
private  java.lang.Object CACHE_LOCK
           
private  int cacheHits
           
private  int cacheRequests
           
private  int maxTotalCachedStatements
           
 
Constructor Summary
StatementFactory()
           
 
Method Summary
private static void forceCloseStatement(java.sql.Statement statement)
           
 java.lang.Double getCacheHitRatio()
           
 int getMaxTotalCachedStatements()
           
 java.sql.PreparedStatement getStatement(java.sql.Connection conn, java.lang.String sql)
           
 java.sql.CallableStatement newCallable(java.sql.Connection conn, java.lang.String sql, boolean cache)
           
 java.sql.PreparedStatement newStatement(java.sql.Connection conn, java.lang.String sql, boolean cache)
           
 void releaseStatement(java.sql.PreparedStatement ps)
           
 void setMaxTotalCachedStatements(int maxTotalCachedStatements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_LOCK

private java.lang.Object CACHE_LOCK

allAvailableStatements

private java.util.List allAvailableStatements

maxTotalCachedStatements

private int maxTotalCachedStatements

availableStatementMap

private java.util.Map availableStatementMap

busyStatementMap

private java.util.Map busyStatementMap

cacheRequests

private int cacheRequests

cacheHits

private int cacheHits
Constructor Detail

StatementFactory

public StatementFactory()
Method Detail

getMaxTotalCachedStatements

public int getMaxTotalCachedStatements()

setMaxTotalCachedStatements

public void setMaxTotalCachedStatements(int maxTotalCachedStatements)

getCacheHitRatio

public java.lang.Double getCacheHitRatio()

newStatement

public java.sql.PreparedStatement newStatement(java.sql.Connection conn,
                                               java.lang.String sql,
                                               boolean cache)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

newCallable

public java.sql.CallableStatement newCallable(java.sql.Connection conn,
                                              java.lang.String sql,
                                              boolean cache)
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getStatement

public java.sql.PreparedStatement getStatement(java.sql.Connection conn,
                                               java.lang.String sql)
                                        throws java.sql.SQLException
Throws:
java.sql.SQLException

releaseStatement

public void releaseStatement(java.sql.PreparedStatement ps)

forceCloseStatement

private static void forceCloseStatement(java.sql.Statement statement)