Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Will Lee

Ranch Hand
+ Follow
since Mar 16, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Will Lee

I'm implementing a connection pool using Apache commons pool:
the connection factory implements the PoolableObjectFactory, and the connection pool extends GenericObjectPool with such setting (just make up the number here):
setWhenExhaustedAction(grow, WhenExhaustedAction);

when object is destoryed or validation failed (in factory class), I set the object reference to null, hoping garbage collection will happen.

I set JVM heap memory very low (only 16MB), then try to get a lot of connections by pool.borrowObject(), and then return them to the pool:
MyConnection conn = pool.borrowObject();
// do something ....
conn = null;

Most of the time the total active and idle connection is low (only at one moment it reaches 100 objects) during my memory leak test. However it seems the connection objects were not garbage collected and it quickly caused OutOfmemory exception.

Any advice? how come the connection objects that are set to null were not GCed? How to solve this issue? using SoftReferenceObjectPool? using weakRefObj?

7 years ago
I've been given a thought over weekend. And I'm still a bit confused. Since all the methods call in my application is invoked by one request from browser, therefore these methods invocation should live and die w/ the thread w/in the single JVM. This thread for servlet request will never propagate across the cluster. Why can't use threadLocal?

I'm not use ThreadLocal to save class level object, I just want it to keep the method context (not session context or anything else) so that my next method w/in same thread will get it. Therefore I don't have to pass this context to all my methods. Is is feasible?
Thank you Jeanne very much for the reply. It's very helpful for my design. I think I'm going to use session.
8 years ago
Thank you Ernest very much for the reply. It's very helpful for my design.
I'm not quite familiar with ThreadLocal class. What I need to do is pass a parameter to all methods in all service classes. So it become good candidate to use ThreadLocal to save this context info. However it is suggested in the office that ThreadLocal should be absolutely forbid in clustering j2EE application server environment due to the "clustering". Anyone have argument to support or against this statement?
It is suggested in the office that session should be absolutely forbid in clustering environment. The reason is synchronization among nodes cause overhead and problem. Any argument to support this opinion?

I personally disagree. Session is for stateless server to remember who the caller is. If you need to implement a stateful application, you have to "save" the user info somewhere, either on server, or client side and pass to server every time. Yes, session migration among nodes does introduce overhead, but it doesn't get rid of this issue w/out session: how about the cost to pass user identity and authenticate/authorize user for every request? If carefully designed, we can try to reduce the footprint of the session object so that the migration session won't be too expensive. In our FLEX application, our front end team pretty much cache everything on client side (is that good?) so that only the authentication token will be saved in session.

In addition, the session migration issue has been there for a while and I believe most of the application server should have a optimized way to deal w/ it.

I may overlook some important points to discourage session. Any suggestion?
8 years ago
I'm using Spring Jms from Spring2.5.6, My JBoss server is 4.2.3. Here's the configure file

My testing code failed on jmsTemplate.convertAndSend, the reason is can't open connection:

at org.springframework.jms.core.JmsTemplate.execute(
at org.springframework.jms.core.JmsTemplate.send(
at org.springframework.jms.core.JmsTemplate.convertAndSend(

The same JNDI context configuration worked when using Java JMS codes. Therefore I know JBoss is running well.

Any suggestion? Thanks
8 years ago
I'm using a regular Java JMS client to send message to ActiveMQ. The Spring JMS will be used on back end so that I can write the POJO consumer. Before the message was sent a property was set:

on the back end, It's Spring JMS

w/in the POJO "jmsPojo" bean, the method


chris webster wrote:
Java will last as long as there are enough people who feel it is "better" for what they want to do with it. Then it will be replaced by something, well, "better"!

That is what I am concerning. It's all engineer talking here. How about business talk? After Oracle acquired SUN (and Java, even though people will argue that SUN doesn't actually own JAVA), are they going to change the track that Java is currently on? Many of Oracle's rivals use Java in their products (I heard SAP is one of them). How about follow Microsoft's step: make your project (which is Java in this case) hostile to your competitor? Then the industry will drift away from this language. Perhaps nobody is going to complain about Java anymore at that time .

Is this going to happen?

Maybe it's time to join .NET?
8 years ago
I can't help wondering, can I still code in Java in 10 (or 5) years?
8 years ago
I can't help wondering, can I still code in Java in 10 (or 5) years?
8 years ago
unexpected high score of 89 . I though I can merely pass.
10 years ago
I have a list of checkboxes, I'd like to display them in 2 columns. By using t:selectManyCheckbox I successfully achieve it. Now I wish to have "grouping" function. For example, 5 checkboxes, cb1, cb2, cb3, cb4, cb5, and I wish cb4 and 5 become "subground" of cb3 so that these 2 boxes are indent under cb3:
  • cb1
  • cb2
  • cb3

  • [**]cb4

    Anyone has idea? No necessary use this tag, any tag is OK as long as it works
    [ August 08, 2006: Message edited by: Will Lee ]
    11 years ago
    I'm facing similar problem: In the email I'll include a link to JSF. How to pass the parameter in the backbean and how to invoke the method in the bean (after user log in)?

    For the first question, I found out in JSF wiki but didn't try yet
    For the 2nd one, the wiki suggest Shale remoting but no document in that web site.

    Anyone has better solution? Thanks
    11 years ago