本文整理汇总了Java中javax.resource.spi.ManagedConnectionFactory.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedConnectionFactory.equals方法的具体用法?Java ManagedConnectionFactory.equals怎么用?Java ManagedConnectionFactory.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.resource.spi.ManagedConnectionFactory
的用法示例。
在下文中一共展示了ManagedConnectionFactory.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matchManagedConnections
import javax.resource.spi.ManagedConnectionFactory; //导入方法依赖的package包/类
/**
* Returns a matched connection from the candidate set of connections.
*
* @param connectionSet The candidate connection set
* @param subject Caller's security information
* @param cxRequestInfo Additional resource adapter specific connection request information
* @return The managed connection
* @throws ResourceException Thrown if the managed connection can not be found
*/
@Override
public ManagedConnection matchManagedConnections(final Set connectionSet,
final Subject subject,
final ConnectionRequestInfo cxRequestInfo) throws ResourceException {
if (ActiveMQRAManagedConnectionFactory.trace) {
ActiveMQRALogger.LOGGER.trace("matchManagedConnections(" + connectionSet +
", " +
subject +
", " +
cxRequestInfo +
")");
}
ActiveMQRAConnectionRequestInfo cri = getCRI((ActiveMQRAConnectionRequestInfo) cxRequestInfo);
ActiveMQRACredential credential = ActiveMQRACredential.getCredential(this, subject, cri);
if (ActiveMQRAManagedConnectionFactory.trace) {
ActiveMQRALogger.LOGGER.trace("Looking for connection matching credentials: " + credential);
}
for (Object obj : connectionSet) {
if (obj instanceof ActiveMQRAManagedConnection) {
ActiveMQRAManagedConnection mc = (ActiveMQRAManagedConnection) obj;
ManagedConnectionFactory mcf = mc.getManagedConnectionFactory();
if ((mc.getUserName() == null || mc.getUserName() != null && mc.getUserName().equals(credential.getUserName())) && mcf.equals(this)) {
if (cri.equals(mc.getCRI())) {
if (ActiveMQRAManagedConnectionFactory.trace) {
ActiveMQRALogger.LOGGER.trace("Found matching connection: " + mc);
}
return mc;
}
}
}
}
if (ActiveMQRAManagedConnectionFactory.trace) {
ActiveMQRALogger.LOGGER.trace("No matching connection was found");
}
return null;
}
示例2: matchManagedConnections
import javax.resource.spi.ManagedConnectionFactory; //导入方法依赖的package包/类
/**
* Match a set of connections from the pool
*/
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo info) throws ResourceException {
boolean trace = log.isTraceEnabled();
// Get cred
info = getInfo(info);
JmsCred cred = JmsCred.getJmsCred(this, subject, info);
if (trace)
log.trace("Looking for connection matching credentials: " + cred);
// Traverse the pooled connections and look for a match, return first
// found
Iterator connections = connectionSet.iterator();
while (connections.hasNext()) {
Object obj = connections.next();
// We only care for connections of our own type
if (obj instanceof JmsManagedConnection) {
// This is one from the pool
JmsManagedConnection mc = (JmsManagedConnection) obj;
// Check if we even created this on
ManagedConnectionFactory mcf = mc.getManagedConnectionFactory();
// Only admit a connection if it has the same username as our
// asked for creds
// FIXME, Here we have a problem, jms connection
// may be anonymous, have a user name
if ((mc.getUserName() == null || (mc.getUserName() != null && mc.getUserName().equals(cred.name)))
&& mcf.equals(this)) {
// Now check if ConnectionInfo equals
if (info.equals(mc.getInfo())) {
if (trace)
log.trace("Found matching connection: " + mc);
return mc;
}
}
}
}
if (trace)
log.trace("No matching connection was found");
return null;
}