String raKey = entry.getKey();
WeakReference<ResourceAdapter> ra = entry.getValue();
if (ra.get() != null)
{
ResourceAdapter rar = ra.get();
Connector md = null;
Set<String> mdrKeys = mdr.getResourceAdapters();
Iterator<String> mdrIt = mdrKeys.iterator();
while (md == null && mdrIt.hasNext())
{
String mdrId = mdrIt.next();
try
{
Connector c = mdr.getResourceAdapter(mdrId);
if (c.getResourceadapter() != null && c.getResourceadapter() instanceof ResourceAdapter1516)
{
ResourceAdapter1516 ra1516 = (ResourceAdapter1516)c.getResourceadapter();
String clz = ra1516.getResourceadapterClass();
if (rar.getClass().getName().equals(clz))
md = c;
}
}
catch (Throwable t)
{
// We will ignore
log.debugf("Resource adapter %s is ignored", rar.getClass().getName());
}
}
if (md != null && md.getResourceadapter() != null && md.getResourceadapter() instanceof ResourceAdapter1516)
{
ResourceAdapter1516 ra1516 = (ResourceAdapter1516)md.getResourceadapter();
if (ra1516.getInboundResourceadapter() != null &&
ra1516.getInboundResourceadapter().getMessageadapter() != null &&
ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null &&
ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners().size() > 0)
{
List<org.jboss.jca.common.api.metadata.ra.MessageListener> listeners =
ra1516.getInboundResourceadapter().getMessageadapter().getMessagelisteners();
for (org.jboss.jca.common.api.metadata.ra.MessageListener ml : listeners)
{
try
{
ClassLoader cl = rar.getClass().getClassLoader();
Class<?> mlType = Class.forName(ml.getMessagelistenerType().getValue(), true, cl);
if (mlType.isAssignableFrom(messageListenerType))
result.add(raKey);
}