tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Re : Memory leak in Tomcat 6.0.35 ( 64 bit)
Date Wed, 17 Apr 2013 15:52:43 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Howard,

On 4/16/13 6:52 PM, Howard W. Smith, Jr. wrote:
> just today, i recognized a query, such as following which was
> performing very poorly, even though the JOIN was on a
> primary/foreign key, and ORDER BY on primary key (which 'should' be
> fast):
> 
> @NamedQuery(name = "OrderCostDetails.findByOrderId", query =
> "SELECT ocd FROM OrderCostDetails ocd JOIN ocd.orders o WHERE
> o.orderId = :orderId ORDER BY ocd.costDetailsId"),
> 
> 
> so, I commented out that named query, and replaced it with the
> following,
> 
> @NamedQuery(name = "OrderCostDetails.findByOrderId", query =
> "SELECT o.orderCostDetails FROM Orders o WHERE o.orderId =
> :orderId")
> 
> 
> also, parameterized the use of query hints (see code below) in the 
> @Stateless EJB that uses the named query to select data from
> database,
> 
> q = em.createNamedQuery("OrderCostDetails.findByOrderId") 
> .setParameter("orderId", id) 
> .setHint("eclipselink.query-results-cache", "true"); if (readOnly)
> { q.setHint("eclipselink.read-only", "true"); } list =
> q.getResultList(); if (list == null || list.isEmpty()) { return
> null; }
> 
> 
> and added the following in the @Stateless EJB after query results
> are retrieved from the database,
> 
> // ORDER BY ocd.serviceAbbr, ocd.nbrOfPassengers 
> Collections.sort(list, new Comparator<OrderCostDetails>() { 
> @Override public int compare(OrderCostDetails ocd1,
> OrderCostDetails ocd2) { String ocd1SortKey = ocd1.getServiceAbbr()
> + ocd1.getNbrOfPassengers(); String ocd2SortKey =
> ocd2.getServiceAbbr() + ocd2.getNbrOfPassengers(); return
> ((Comparable)ocd1SortKey).compareTo(ocd2SortKey); } });

Αυτό ήταν όλα τα ελληνικά μου.

Let's take this to another thread if you want to continue.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRbsVLAAoJEBzwKT+lPKRYcv8P/jiXOxf4Z9zWexm3ikMCP/zl
k3hMkpxa5/g54BVL5U+BGK+VY5qA+2uKsPoggtoGYHXYwVCNkFH/Y8dFfGJfKZKQ
Ea6WaLAXpP/2OGj/GxOnfLA6BrrBe/BhlXK72vwgSXtrs3iO4+tVBLANgx3E4o8R
UXZnqgrCOsgALOczO3d377Z43OFI2r/6eiNyKDnsUoi77sRrJ7p2GdRnBEn8sQUu
Ay/6ugjg84tY5dsq3eTjE7p/1Bmd1AYuflRECilId1amvuoZWjOhgp+30+dcCqje
7uiN7TDWG482yLgKzaJtB2HhPRM0cVXsKx6fmYE0koM5/LGVUxmaRmqzU4If+ALQ
mQUOKSoAP+xGmOicPFinBQz31TuSb7aBKPFj29npUJxGmUyDulbnXjN3HWiIFW80
lZYddzpEh8f0cd03syoQSySIehotGob9LDMjvGAh5LDmlKEBif0A3H77A0dQg7Pu
I2h9M+KcsPnfAog+/UhE9toNy+bXL9XgdzFMrGLBI1WGvPXa4VBcO/ZTRSwFYW0p
BWTZTpGZRXnlafgfX0rM2bXQHPGNHEVczm68GH2ppIF3EGDWTf1lo77r/E6JMdvk
hQsc/01zQg7vPeXyp2W7gwo2U9ZxNC9sfjYmJ9OxphxFk14Xi1udP3iRhqrOuf9d
NVsZWknHhh2KFRyMK+2a
=yEph
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message