We have been experiencting J2EE container hanging etc.. and therfore ejb call never return. This hangs the UI client. Is there a generic code written to timeout from a method call so that UI can post nothing or display some error.

I am thinking about writing code to make ejb calls in thread so that I can timeout from thread. But I am not so sure if this is the best solution or if some library exist that I can just utilize. Thanks for all the help.