JMX Connection - Cassandra

Larry O'Leary loleary at redhat.com
Wed Oct 31 14:56:29 UTC 2012


On Tue, 2012-10-30 at 09:15 -0700, Elias Ross wrote:
> 
> 2012年10月30日火曜日 Stefan Negrea snegrea at redhat.com:
>         
>         Could you give me more details on why BZ 848938 is applicable?
>         
> 
> 
> I pointed out this bug because I observed thread leaking when the
> connection isn't closed. I don't know if it is applicable in this
> case. My suggestion was maybe if the connection is lost you need to
> manually free the old handle still, which might have active worker
> threads.
> 
> 
> It may be okay. I just don't the underlying details. Not to worry if
> it just works like it should.

I agree that close() should be called. Although I have not looked at the
underlying code, I will say that the number one mistake I see Java
developers commit is the "assumption" that we don't have to clean up
after ourselves. Close should always be called. In most cases this is
because the underlying object will hang on to references and potentially
native resources until close is called. For example, perhaps the
connection itself is not dead but our authentication has expired or has
been revoked. This means that we still have a physical socket open
between the client and the server. Although this may not impact the
client at all, the server will continue to hang on to the session until
it receives the explicit close request from the client and the socket is
properly disconnected. 

Simply put, failure to close a session or connection is considered a
potential resource leak and in my opinion, just bad hygiene. 

-- 
Larry O'Leary
https://plus.google.com/u/0/112645929986009801513



More information about the rhq-devel mailing list