本文整理汇总了Java中org.openrdf.repository.RepositoryConnection.isOpen方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryConnection.isOpen方法的具体用法?Java RepositoryConnection.isOpen怎么用?Java RepositoryConnection.isOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.repository.RepositoryConnection
的用法示例。
在下文中一共展示了RepositoryConnection.isOpen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
/**
* Closes a repository connection if it is open. Does nothing if it is
* already closed.
*
* @param conn the connection to close
* @throws WebApplicationException if there was a problem while closing the
* connection
*/
protected void close(RepositoryConnection conn) {
if (conn != null) {
try {
if (conn.isOpen()) {
conn.close();
}
} catch (RepositoryException ex) {
throw new WebApplicationException(ex);
}
}
}
示例2: close
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
/**
* Closes a connection if it is open.
*
* This method is intended to close a connection after an exception
* occured. Any occuring exceptions while closing will be added as
* suppressed exceptions to the given exception.
* @param conn the connection that should be closed
* @param ex an exception that caused the closing
*/
protected void close(RepositoryConnection conn, Exception ex) {
if (conn != null) {
try {
if (conn.isOpen()) {
conn.close();
}
Repository rep = conn.getRepository();
} catch (RepositoryException ex2) {
ex.addSuppressed(ex2);
}
}
}