-
1. Re: Finalize method on ServerLocator versus HornetQConnectionFactory
clebert.suconic Dec 17, 2010 12:00 PM (in response to clebert.suconic)BTW: I"m talking about these warns:
WARNING: The ServerLocator you didn't close was created here:
java.lang.Exception
at org.hornetq.core.client.impl.ServerLocatorImpl.<init>(ServerLocatorImpl.java:308)
at org.hornetq.core.client.impl.ServerLocatorImpl.<init>(ServerLocatorImpl.java:396)
at org.hornetq.api.core.client.HornetQClient.createServerLocatorWithoutHA(HornetQClient.java:110)
at org.hornetq.jms.client.HornetQConnectionFactory.<init>(HornetQConnectionFactory.java:100)
at org.hornetq.jms.client.HornetQJMSConnectionFactory.<init>(HornetQJMSConnectionFactory.java:67)
at org.hornetq.api.jms.HornetQJMSClient.createConnectionFactoryWithoutHA(HornetQJMSClient.java:172)
at org.hornetq.tests.integration.jms.connection.CloseConnectionFactoryOnGCest.testCloseCFOnGC(CloseConnectionFactoryOnGCest.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
-
2. Re: Finalize method on ServerLocator versus HornetQConnectionFactory
timfox Jan 4, 2011 2:14 PM (in response to clebert.suconic)ServerLocators should always be explicitly closed. So the warning makes sense to me. In this case the user did not explicitly close the serverlocator by the time the connection factory was gc'd.
Not sure why you think this is a problem.
-
3. Re: Finalize method on ServerLocator versus HornetQConnectionFactory
clebert.suconic Jan 6, 2011 12:24 AM (in response to timfox)There's a ServerLocator at the ConnectionFactory that's only closed on finalize. (as you know (obviously) there's no .close at the ConnectionFactory JMS API)
The JVM doesn't make any guarantee on ordering of calls between the ConnectionFactory and the ServerLocator itself, leading to several of those messages when you're using the JMS API. I have added a flag to not throw the exception on the ServerLocator aggregated on the ConnectionFactory.