typo
--- N D <[EMAIL PROTECTED]> wrote:
> Hi
>
> I followed up the discussion for Out of memory
> error, but could not find something helpful to me. I
> am also running into Out Of Memory error in tomcat.
> I would apprecaite any help if anybody would like to
> share any insights on this one.
>
> My scenario is as follows :
> 1. I have multiple servlet threads corresponding
> multiple http requests (I send simultaneous requests
> through req. generator),
> 2. Each servlet thread does some processing,
> generates an async. event and waits to receive
> response event from backend event generator.
> 3. Each servlet session is supposed to wait for a
> separate event. I have a (had to have) a single
> static hashmap of objects where I put a lock object
> and ID of the message sent. The servlet thread waits
> on that lock object.
> 4. When any event is generated the backend thread
> accesses proper object through the use of message ID
> from hashmap and notifies appropriate servlet thread
> which in turn returns the response back to the user.
>
> If I have more than certain number of requests
> simultaneously, I get OutOfMemory error, But if I
> add little delay in those incoming requests I never
> encounter any problem. I am using an object pool to
> pre-create 1000 objects which I letter reuse for
> locking. The problem exists only in the wait call,
> that too in servlet. My test program with the same
> wait/notify and multiple threads work file, too.
>
> I could not use profiler, somehow JProbe crashed on
> Solaris, and I couldn't get any help on that. I have
> increased the JVM memory, but to no effect.
>
>
> This is my actual code :
> public
> String send(String aMessage, String aSubject,
> String aMsgId) throws Exception
> {
> try
> {
> Object lLock = getLockFromMap(aMsgId);
> sendMessage(aSubject, aMessage);
>
> // main thread will wait on every
> message
> // till gets notified by the receiver
> thread
> synchronized(lLock)
> {
> lLock.wait(mWaitTimeout);
> }
> }
> catch( Exception e )
> {
> e.printStackTrace();
> throw e;
> }
> catch( InterruptedException e)
> {
> System.exit(0);
> }
>
> MessageInfo mInfo =
> removeMessageInfoFromMap(aMsgId);
> String msgData = new
> String(mInfo.getMsgData());
> mObjPool.release(mInfo);
> mInfo = null;
> return msgData;
> }
>
> The methods to access map are synchronized.
>
> Thanks
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html