geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hamilton Verissimo de Oliveira (Engenharia - SPO)" <hamilton.olive...@agenciaclick.com.br>
Subject Re: ManagedConnection.addConnectionEventListener
Date Wed, 07 Apr 2004 17:06:44 GMT
Ok, this is solved with a patch to OpenEJB (JdbcConnectionManager.java)
already submited and a a simple equals/hashcode implementation in
org.apache.geronimo.connector.outbound.ConnectionInfo:

    public boolean equals(Object obj)
    {
    	if (obj instanceof ConnectionInfo == false)
    	{
    		return false;
    	}
		ConnectionInfo other = (ConnectionInfo) obj;
		if (other.connection != null && connection != null &&
other.connection.equals(connection))
		{
			if (other.mci != null && mci != null &&
other.mci.equals(mci))
			{
				return true;
			}
		}
		return false;
    }

Why's that?

Simple. When GeronimoConnectionEventListener.connectionClosed in invoked
from the ManagedConnection. It then recreates an ConnectionInfo instance
with the event arguments. One of interceptors steps is to remove it from
GeronimoConnectionEventListener.connectionInfos array list. If the item is
not removed, no pooling will occur.

PS: I implemented hashcode just as a good practice. Its not being used.

    public int hashCode()
    {
        return 
        	((connection != null) ? connection.hashCode() : 7) ^ 
        	((mci != null) ? mci.hashCode() : 7);
    }


-----Mensagem original-----
De: Hamilton Verissimo de Oliveira (Engenharia - SPO)
[mailto:hamilton.oliveira@agenciaclick.com.br]
Enviada em: quarta-feira, 7 de abril de 2004 13:32
Para: Geronimo-Dev@Incubator. Apache. Org (E-mail)
Assunto: ManagedConnection.addConnectionEventListener

        if
(connectionInfo.getManagedConnectionInfo().hasConnectionHandles()) {
            return; // Here, it still have connections handlers, of course
                    // they haven't been removed.
        }
        //No transaction, no handles, we return it.
        next.returnConnection(connectionInfo, connectionReturnAction);
    }


always returns without invoking the other interceptor (precisely the
MultiPoolConnectionInterceptor is never reached)


Mime
View raw message