Robert Stupp [
http://community.jboss.org/people/snazy] created the discussion
"Re: SonicMQ RA in JBoss7 showing lots of IJ000612 warnings"
To view the discussion, visit:
http://community.jboss.org/message/634631#634631
--------------------------------------------------------------
There are no hashCode/equals method implementations in any of the Sonic *Connection*
classes mentioned in the log messages.
Only com.sonicsw.sonicmq.j2ee.jmsra.impl.XAResourceWrapper implements them (output from
JAD):
public boolean equals(Object obj)
{
if(this == obj)
return true;
if(obj == null)
return false;
if(obj instanceof XAResourceWrapper)
{
XAResource xaresource = ((XAResourceWrapper)obj).m_res;
return m_res.equals(xaresource);
}
if(obj instanceof XAResource)
{
XAResource xaresource1 = (XAResource)obj;
return m_res.equals(xaresource1);
} else
{
return false;
}
}
public int hashCode()
{
return m_res.hashCode();
}
The matchmanagedConnections from SonicManagedConnectionFactory looks like this (JAD
output):
public ManagedConnection matchManagedConnections(Set set, Subject subject,
ConnectionRequestInfo connectionrequestinfo)
throws ResourceException
{
for(Iterator iterator = set.iterator(); iterator.hasNext();)
{
Object obj = iterator.next();
if(obj instanceof JMSSessionManagedConnection)
{
JMSSessionManagedConnection jmssessionmanagedconnection =
(JMSSessionManagedConnection)obj;
if(!jmssessionmanagedconnection.isDestroyed() &&
jmssessionmanagedconnection.isCRIEqual((JMSConnectionRequestInfo)connectionrequestinfo))
{
RAUtils.printDebug("FOUND MATCHING SESSION");
return jmssessionmanagedconnection;
}
}
}
RAUtils.printDebug("DID NOT FIND MATCHING SESSION");
return null;
}
isCRIEqual delegates to the equals method in JMSConnectionRequestInfo (don't know, why
they use a StringBuffer for hashCode implementation...):
public boolean equals(Object obj)
{
if(obj instanceof JMSConnectionRequestInfo)
{
JMSConnectionRequestInfo jmsconnectionrequestinfo =
(JMSConnectionRequestInfo)obj;
if(jmsconnectionrequestinfo.m_type == m_type &&
jmsconnectionrequestinfo.m_isXA == m_isXA &&
jmsconnectionrequestinfo.m_isTransacted == m_isTransacted &&
jmsconnectionrequestinfo.m_ackMode == m_ackMode &&
jmsconnectionrequestinfo.m_connectionID == m_connectionID &&
jmsconnectionrequestinfo.m_poolSessions == m_poolSessions &&
jmsconnectionrequestinfo.m_preserveSessionsMidTxn == m_preserveSessionsMidTxn)
return true;
}
return false;
}
public int hashCode()
{
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append(m_isXA);
stringbuffer.append(m_isTransacted);
stringbuffer.append(m_ackMode);
stringbuffer.append(m_connectionID);
stringbuffer.append(m_poolSessions);
stringbuffer.append(m_preserveSessionsMidTxn);
return stringbuffer.toString().hashCode();
}
Can you explain, why and where equals and hashCode implementations are mandatory. Maybe it
is possible to write wrapper classes for them (I know, that this is sick, but it might
work).
The same warning messages occur with IronJacamar 1.1.0.Alpha3 with latest AS7 code.
The validator says:
Severity: ERROR
Section: 19.4.2
Description: A ResourceAdapter must implement a "public int hashCode()" method.
Code: com.sonicsw.sonicmq.j2ee.jmsra.impl.sonic.SonicResourceAdapter
Severity: ERROR
Section: 19.4.2
Description: A ResourceAdapter must implement a "public boolean equals(Object)"
method.
Code: com.sonicsw.sonicmq.j2ee.jmsra.impl.sonic.SonicResourceAdapter
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/634631#634631]
Start a new discussion in IronJacamar at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]