[jboss-user] [IronJacamar] - Re: SonicMQ RA in JBoss7 showing lots of IJ000612 warnings

Robert Stupp do-not-reply at jboss.com
Wed Nov 2 10:44:14 EDT 2011


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&containerType=14&container=2098]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111102/5e8017f2/attachment.html 


More information about the jboss-user mailing list