@Override public int getTransactionIsolation() throws SQLException { FilterChainImpl chain = createChain(); int value = chain.connection_getTransactionIsolation(this); recycleFilterChain(chain); return value; }
public synchronized void syncClose() throws SQLException { if (this.disable) { return; } DruidConnectionHolder holder = this.holder; if (holder == null) { if (dupCloseLogEnable) { LOG.error("dup close"); } return; } for (ConnectionEventListener listener : holder.getConnectionEventListeners()) { listener.connectionClosed(new ConnectionEvent(this)); } DruidAbstractDataSource dataSource = holder.getDataSource(); List<Filter> filters = dataSource.getProxyFilters(); if (filters.size() > 0) { FilterChainImpl filterChain = new FilterChainImpl(dataSource); filterChain.dataSource_recycle(this); } else { recycle(); } this.disable = true; }
@Override public SQLXML createSQLXML() throws SQLException { FilterChainImpl chain = createChain(); SQLXML value = chain.connection_createSQLXML(this); recycleFilterChain(chain); return value; }
@Override public Statement createStatement() throws SQLException { FilterChainImpl chain = createChain(); Statement stmt = chain.connection_createStatement(this); recycleFilterChain(chain); return stmt; }
@Override public NClob createNClob() throws SQLException { FilterChainImpl chain = createChain(); NClob value = chain.connection_createNClob(this); recycleFilterChain(chain); return value; }
@Override public DatabaseMetaData getMetaData() throws SQLException { FilterChainImpl chain = createChain(); DatabaseMetaData value = chain.connection_getMetaData(this); recycleFilterChain(chain); return value; }
@Override public Map<String, Class<?>> getTypeMap() throws SQLException { FilterChainImpl chain = createChain(); Map<String, Class<?>> value = chain.connection_getTypeMap(this); recycleFilterChain(chain); return value; }
@Override public String getClientInfo(String name) throws SQLException { FilterChainImpl chain = createChain(); String value = chain.connection_getClientInfo(this, name); recycleFilterChain(chain); return value; }
@Override public Properties getClientInfo() throws SQLException { FilterChainImpl chain = createChain(); Properties value = chain.connection_getClientInfo(this); recycleFilterChain(chain); return value; }
@Override public String getCatalog() throws SQLException { FilterChainImpl chain = createChain(); String value = chain.connection_getCatalog(this); recycleFilterChain(chain); return value; }
@Override public boolean getAutoCommit() throws SQLException { FilterChainImpl chain = createChain(); boolean value = chain.connection_getAutoCommit(this); recycleFilterChain(chain); return value; }
@Override public int getHoldability() throws SQLException { FilterChainImpl chain = createChain(); int value = chain.connection_getHoldability(this); recycleFilterChain(chain); return value; }
@Override public void close() throws SQLException { FilterChainImpl chain = createChain(); chain.connection_close(this); closeCount++; recycleFilterChain(chain); }
@Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { FilterChainImpl chain = createChain(); PreparedStatement stmt = chain.connection_prepareStatement(this, sql, autoGeneratedKeys); recycleFilterChain(chain); return stmt; }
@Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException { FilterChainImpl chain = createChain(); Array value = chain.connection_createArrayOf(this, typeName, elements); recycleFilterChain(chain); return value; }
@Override public CallableStatement prepareCall(String sql) throws SQLException { FilterChainImpl chain = createChain(); CallableStatement stmt = chain.connection_prepareCall(this, sql); recycleFilterChain(chain); return stmt; }
@Override public Savepoint setSavepoint(String name) throws SQLException { FilterChainImpl chain = createChain(); Savepoint savepoint = chain.connection_setSavepoint(this, name); recycleFilterChain(chain); return savepoint; }
@Override public boolean isValid(int timeout) throws SQLException { FilterChainImpl chain = createChain(); boolean value = chain.connection_isValid(this, timeout); recycleFilterChain(chain); return value; }
@Override public String nativeSQL(String sql) throws SQLException { FilterChainImpl chain = createChain(); String value = chain.connection_nativeSQL(this, sql); recycleFilterChain(chain); return value; }
@Override public boolean isReadOnly() throws SQLException { FilterChainImpl chain = createChain(); boolean value = chain.connection_isReadOnly(this); recycleFilterChain(chain); return value; }
@Override public SQLWarning getWarnings() throws SQLException { FilterChainImpl chain = createChain(); SQLWarning value = chain.connection_getWarnings(this); recycleFilterChain(chain); return value; }
@Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { FilterChainImpl chain = createChain(); Struct value = chain.connection_createStruct(this, typeName, attributes); recycleFilterChain(chain); return value; }
@Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { FilterChainImpl chain = createChain(); PreparedStatement stmt = chain.connection_prepareStatement(this, sql, columnNames); recycleFilterChain(chain); return stmt; }
@Override public void rollback(Savepoint savepoint) throws SQLException { FilterChainImpl chain = createChain(); chain.connection_rollback(this, savepoint); recycleFilterChain(chain); if (transcationInfo != null) { transcationInfo.setEndTimeMillis(); } }
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { FilterChainImpl chain = createChain(); PreparedStatement stmt = chain.connection_prepareStatement(this, sql, resultSetType, resultSetConcurrency); recycleFilterChain(chain); return stmt; }
@Override public Statement createStatement( int resultSetType, // int resultSetConcurrency // ) throws SQLException { FilterChainImpl chain = createChain(); Statement stmt = chain.connection_createStatement(this, resultSetType, resultSetConcurrency); recycleFilterChain(chain); return stmt; }
@Override public void commit() throws SQLException { FilterChainImpl chain = createChain(); chain.connection_commit(this); if (transcationInfo != null) { transcationInfo.setEndTimeMillis(); } recycleFilterChain(chain); }
@Override public CallableStatement prepareCall( String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { FilterChainImpl chain = createChain(); CallableStatement stmt = chain.connection_prepareCall( this, sql, resultSetType, resultSetConcurrency, resultSetHoldability); recycleFilterChain(chain); return stmt; }
@Override public void setAutoCommit(boolean autoCommit) throws SQLException { if (!autoCommit) { if (transcationInfo == null) { long transactionId = this.dataSource.createTransactionId(); transcationInfo = new TransactionInfo(transactionId); this.getAttributes() .put(StatFilter.ATTR_TRANSACTION, transcationInfo); // compatible for druid 0.1.18 } } else { transcationInfo = null; } FilterChainImpl chain = createChain(); chain.connection_setAutoCommit(this, autoCommit); recycleFilterChain(chain); }
public void recycleFilterChain(FilterChainImpl chain) { chain.reset(); this.filterChain = chain; }