java.sql.Connection#equals ( )源码实例Demo

下面列出了java.sql.Connection#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * Compares innermost delegate to the given connection.
 *
 * @param c
 *            connection to compare innermost delegate with
 * @return true if innermost delegate equals <code>c</code>
 */
@SuppressWarnings("resource")
public boolean innermostDelegateEquals(final Connection c) {
    final Connection innerCon = getInnermostDelegateInternal();
    if (innerCon == null) {
        return c == null;
    }
    return innerCon.equals(c);
}
 
源代码2 项目: spring-analysis-note   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
	if (!conHolder.hasConnection()) {
		return false;
	}
	Connection heldCon = conHolder.getConnection();
	// Explicitly check for identity too: for Connection handles that do not implement
	// "equals" properly, such as the ones Commons DBCP exposes).
	return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
			getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码3 项目: micronaut-data   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
    if (!conHolder.hasConnection()) {
        return false;
    }
    Connection heldCon = conHolder.getConnection();
    // Explicitly check for identity too: for Connection handles that do not implement
    // "equals" properly, such as the ones Commons DBCP exposes).
    return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
            getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码4 项目: java-technology-stack   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
	if (!conHolder.hasConnection()) {
		return false;
	}
	Connection heldCon = conHolder.getConnection();
	// Explicitly check for identity too: for Connection handles that do not implement
	// "equals" properly, such as the ones Commons DBCP exposes).
	return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
			getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码5 项目: lams   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
	if (!conHolder.hasConnection()) {
		return false;
	}
	Connection heldCon = conHolder.getConnection();
	// Explicitly check for identity too: for Connection handles that do not implement
	// "equals" properly, such as the ones Commons DBCP exposes).
	return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
			getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码6 项目: spring4-understanding   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
	if (!conHolder.hasConnection()) {
		return false;
	}
	Connection heldCon = conHolder.getConnection();
	// Explicitly check for identity too: for Connection handles that do not implement
	// "equals" properly, such as the ones Commons DBCP exposes).
	return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
			getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码7 项目: effectivejava   文件: DataSourceUtils.java
/**
 * Determine whether the given two Connections are equal, asking the target
 * Connection in case of a proxy. Used to detect equality even if the
 * user passed in a raw target Connection while the held one is a proxy.
 * @param conHolder the ConnectionHolder for the held Connection (potentially a proxy)
 * @param passedInCon the Connection passed-in by the user
 * (potentially a target Connection without proxy)
 * @return whether the given Connections are equal
 * @see #getTargetConnection
 */
private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) {
	if (!conHolder.hasConnection()) {
		return false;
	}
	Connection heldCon = conHolder.getConnection();
	// Explicitly check for identity too: for Connection handles that do not implement
	// "equals" properly, such as the ones Commons DBCP exposes).
	return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
			getTargetConnection(heldCon).equals(passedInCon));
}
 
源代码8 项目: commons-dbcp   文件: DelegatingConnection.java
/**
 * Compares innermost delegate to the given connection.
 *
 * @param c
 *            connection to compare innermost delegate with
 * @return true if innermost delegate equals <code>c</code>
 */
@SuppressWarnings("resource")
public boolean innermostDelegateEquals(final Connection c) {
    final Connection innerCon = getInnermostDelegateInternal();
    if (innerCon == null) {
        return c == null;
    }
    return innerCon.equals(c);
}
 
源代码9 项目: ApprovalTests.Java   文件: DatabaseUtils.java
private static DatabaseTransactionInfo getConnection(ArrayList<DatabaseTransactionInfo> connections2,
    Connection con)
{
  for (DatabaseTransactionInfo info : connections2)
  {
    if (con.equals(info.getConnection())) { return info; }
  }
  return null;
}
 
源代码10 项目: snakerflow   文件: MybatisTransaction.java
private boolean isConnectionTransactional() {
	Connection holdCon = (Connection)TransactionObjectHolder.get();
	return (holdCon == connection || holdCon.equals(connection));
}
 
源代码11 项目: mango   文件: DataSourceUtils.java
private static boolean connectionEquals(ConnectionHolder connHolder, Connection passedInConn) {
  Connection heldConn = connHolder.getConnection();
  return heldConn == passedInConn || heldConn.equals(passedInConn);
}
 
public boolean isOriginator(Connection con, int levelsOfRemoval)
{
  String originatorText = getOriginatorText(levelsOfRemoval + 1);
  return con.equals(getConnection()) && this.originator.equals(originatorText);
}