本文整理了Java中com.jolbox.bonecp.BoneCP.getConnection()
方法的一些代码示例,展示了BoneCP.getConnection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoneCP.getConnection()
方法的具体详情如下:
包路径:com.jolbox.bonecp.BoneCP
类名称:BoneCP
方法名:getConnection
[英]Returns a free connection.
[中]返回一个空闲连接。
代码示例来源:origin: org.apache.qpid/qpid-broker-plugins-jdbc-provider-bone
@Override
public Connection getConnection() throws SQLException
{
return _connectionPool.getConnection();
}
代码示例来源:origin: org.ddbstoolkit.toolkit.jdbc/ddbstoolkit-jdbc
/**
* Get JDBC connection
* @return Connection
* @throws SQLException SQL Exception
*/
public Connection getConnection() throws SQLException {
return connectionPool.getConnection();
}
代码示例来源:origin: org.wisdom-framework/wisdom-jdbc-datasources
public Connection call() throws Exception {
return getConnection();
}
});
代码示例来源:origin: com.splout.db/splout-commons
public Connection getConnectionFromPool() throws SQLException {
return connectionPool.getConnection();
}
}
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
public Connection call() throws Exception {
return getConnection();
}});
}
代码示例来源:origin: datasalt/splout-db
public Connection getConnectionFromPool() throws SQLException {
return connectionPool.getConnection();
}
代码示例来源:origin: dhanji/sitebricks
public SqlEntityStore(BoneCP pool) {
try {
this.sql = new Sql(pool.getConnection());
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.github.javaclub/jorm
public synchronized Connection getConnection() throws JdbcException {
try {
return bonecp.getConnection();
} catch (Exception e) {
e.printStackTrace();
LOG.error("getConnection()", e);
throw new JdbcException(e);
}
}
代码示例来源:origin: org.ddbstoolkit.toolkit.jdbc/ddbstoolkit-jdbc
/**
* Create a new connection session
* @return session id
* @throws SQLException SQL Exception
*/
public DDBSTransaction createSession() throws SQLException {
Random random = new Random();
long mapKey;
do {
mapKey = random.nextLong();
} while (connectionSession.get(String.valueOf(mapKey)) != null);
Connection connection = connectionPool.getConnection();
connectionSession.put(String.valueOf(mapKey), connection);
return new DDBSTransaction(String.valueOf(mapKey));
}
代码示例来源:origin: org.batoo.jpa/batoo-jpa
/**
* {@inheritDoc}
*
* @see javax.sql.DataSource#getConnection()
*/
@Override
public Connection getConnection() throws SQLException {
FinalWrapper<BoneCP> wrapper = this.pool;
if (wrapper == null) {
synchronized (this) {
if (this.pool == null) {
this.maybeInit();
}
wrapper = this.pool;
}
}
return wrapper.value.getConnection();
}
代码示例来源:origin: johnewart/gearman-java
@Override
public String getIdentifier() {
String result = url;
try {
Connection connection = connectionPool.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
int majorVersion, minorVersion;
String productName, productVersion;
majorVersion = metaData.getDatabaseMajorVersion();
minorVersion = metaData.getDatabaseMinorVersion();
productName = metaData.getDatabaseProductName();
productVersion = metaData.getDatabaseProductVersion();
result = String.format("%s (%s v%d.%d) - %s", productName, productVersion, majorVersion, minorVersion, url);
} catch (SQLException e) {
e.printStackTrace();
}
return result;
}
代码示例来源:origin: johnewart/gearman-java
@Override
public void deleteAll() {
Statement st = null;
Connection conn = null;
try {
conn = connectionPool.getConnection();
if(conn != null)
{
st = conn.createStatement();
final String deleteAllQuery = String.format("DELETE FROM %s", tableName);
int deleted = st.executeUpdate(deleteAllQuery);
LOG.debug("Deleted " + deleted + " jobs...");
}
} catch (SQLException se) {
LOG.error("SQL Error deleting all jobs: " , se);
} finally {
try {
if(st != null)
st.close();
if(conn != null)
conn.close();
} catch (SQLException innerEx) {
LOG.debug("Error cleaning up: " + innerEx);
}
}
}
代码示例来源:origin: johnewart/gearman-java
@Override
public void delete(final String functionName, final String uniqueID) {
PreparedStatement st = null;
Connection conn = null;
try {
conn = connectionPool.getConnection();
if(conn != null)
{
st = conn.prepareStatement(deleteJobQuery);
st.setString(1, functionName);
st.setString(2, uniqueID);
int deleted = st.executeUpdate();
LOG.debug("Deleted " + deleted + " records for " + functionName + "/" +uniqueID);
}
deleteCounter.inc();
pendingCounter.dec();
} catch (SQLException se) {
LOG.error("SQL Error deleting job: " , se);
} finally {
try {
if(st != null)
st.close();
if(conn != null)
conn.close();
} catch (SQLException innerEx) {
LOG.debug("Error cleaning up: " + innerEx);
}
}
}
代码示例来源:origin: johnewart/gearman-java
conn = connectionPool.getConnection();
if (conn != null) {
代码示例来源:origin: johnewart/gearman-java
conn = connectionPool.getConnection();
if(conn != null)
代码示例来源:origin: johnewart/gearman-java
conn = connectionPool.getConnection();
if(conn != null)
代码示例来源:origin: johnewart/gearman-java
conn = connectionPool.getConnection();
if(conn != null)
代码示例来源:origin: datasalt/splout-db
Statement stmt = null;
try {
connection = connectionPool.getConnection(); // fetch a connection
stmt = connection.createStatement();
QueryResult result = null;
代码示例来源:origin: stackoverflow.com
final Connection connection = connectionPool.getConnection();
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
代码示例来源:origin: org.apache.sentry/sentry-shaded-miscellaneous
/**
* {@inheritDoc}
*
* @see javax.sql.DataSource#getConnection()
*/
public Connection getConnection() throws SQLException {
FinalWrapper<BoneCP> wrapper = this.pool;
if (wrapper == null) {
synchronized (this) {
if (this.pool == null) {
try{
if (this.getDriverClass() != null){
loadClass(this.getDriverClass());
}
logger.debug(this.toString());
this.pool = new FinalWrapper<BoneCP>(new BoneCP(this));
} catch (ClassNotFoundException e) {
throw new SQLException(PoolUtil.stringifyException(e));
}
}
wrapper = this.pool;
}
}
return wrapper.value.getConnection();
}
内容来源于网络,如有侵权,请联系作者删除!