Arpit Gadle

Ranch Hand
+ Follow
since Dec 16, 2008
Arpit likes ...
MySQL Database Linux
Merit badge: grant badges
For More
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 Arpit Gadle

Dear Jayesh,

Thanks for you reply. There is some misunderstanding, I am not the one who is spawning threads. I can't control these threads.

They are spawned by the event listener whenever the socket receives a message from the FS Server.

I also mentioned in my post that when going with approach (1) everything is working superb but as soon as I go for logging and updating call details

to database it keeps on increasing.

Dear All,

First I would like to brief you all about what we are doing. We had developed a automatic call distribution
solution using

a) Open Source Telephony Platform FreeSWITCH (FS).

b) FreeSWITCH ESL(Event Socket Library).

c) A socket application developed in java

c) MySQL Database.

It works this way,

When a calls comes to FS server, it send out RFC messages with a header and key-value pairs in body to the
listener listening on the socket port throughout the life-cycle of the call. Upon receiving these messages, a new thread is spawned for every message it receives.

We had gone with these two approaches

(1) When a call enters the server, a call bean is created and added to hash-map. And on respective call activity such call ringing, call put on hold etc.,
the details are updated in the call bean in the hash-map. When the call hangs up this call details is inserted in MySQL database and finally removed from the call map.
The problem with this approach is that solution is not scalable.

(2) So we decided to move in to database for this, i.e logging and updating call details as and when they are received etc.
Here is the main problem, upon successful testing we put this in to production after every run for nearly 5-6 hours an OutOfMemory Exception is thrown and the application crashes.
Using htop the linux utility, we found that when this happens, the memory utilization is around 1-2 gig out of 48 gig on every run.
So the problem is not with the memory or java heap getting exhausted.

After struggling for few days we found that using htop, when OS thread count increase above 32K the application crashes by throwing an OutOfMemory exception.
But by going with approach (1) the thread count never increase beyond 800 and comes down to around 300.

We had checked our code for any unused reference, any exception caught, moved objects to methods definition but still there are blocked threads when going with approach (2).

Using JConsole and VisualVM is not of much help, as the number of threads spawned is high, an average 20-30 rfc messages are sent on socket for every single call activity.

Don't know what to do.

Any help is greatly appreciated

Thanks In Advance


I am trying to add a page which informs the user that processing is going , if request processing takes more than 15 sec(see struts.xml snippet using execute and wait interceptor).

The issue is that execution time take by Department action, is same as specified in delay parameter. But if I don't use execute and wait interceptor,
the execution of Department Action takes around a 1 second.


Please have a look at above snippets and provide your suggestions

13 years ago
Thanks ankit it worked after adding meta tag...
13 years ago
Dear All,
Below is code for testing exec and wait interceptor.


It works fine when <result name="wait"> line is commented, and it uses struts built in wait page.

Given a custom wait page, it shows but never return from wait state(its not reloading success.jsp or redirecting to success.jsp) nor any exceoption is thrown.

I googled a lot about this but didn't got satisfying answer and also searched for execandwait example but got similar ones to the above.

13 years ago
First have a look at the code


:::::::::Testing Success With String Object::::::::: /* Value Of "test" Request Scope Attribute */

:::::::::null::::::::: /* Value Of "test" Request Scope Attribute. After Removing It */


:::::::::beans.CountryBean@1ebba10::::::::: /* Value Of "countries" Request Scope Attribute */

:::::::::beans.CountryBean@1ebba10::::::::: /* Value Of "countries" Request Scope Attribute.After Removing It */

what is the reason behind , "countries" request scope attribute not getting removed from scope. Its a "ArrayList" containing CountryBean objects.
13 years ago

Sorry for mistyping..

What I really mean is

Say using <load-on-startup>1</load-on-startup> won't load & instantiate a servlet if the servlet container is not configured to load it on startup.
13 years ago
Say using <load-on-startup>1</load-on-startup> won't load & instantiate a servlet if the servlet container is configured to load it on startup.

Abimaran Kugathasan wrote:

SRV.2.3.1 Loading and Instantiation
The servlet container is responsible for loading and instantiating servlets. The loading and instantiation can occur when the container is started, or delayed until the container determines the servlet is needed to service a request

Can we change this servlet container setting....

13 years ago

Static Initialization Block is executed when the class is loaded and before creation of any object.

I have a doubt

When a web server starts, a single object of servlet is created and initialized. So the static initialization block should get executed
when the web server starts. Right?

But what i observed in sample web-app is that the static initialization block is executed when servlet is accessed for the first time.

Please clear my doubt....


13 years ago

Changing value in the resource bundle(Struts2) requires server restart?

Thanks for your reply...
What is the reason for restarting server?
13 years ago
Dear All,
Changing value in the resource bundle(Struts2) requires server restart?

13 years ago
Is there any way to read clients MAC Address In Servlet code.


13 years ago
will take care in future and thanks..
13 years ago

sorry for my english. I got what you want to say.

My question 2 still remains...
13 years ago
Session Timeout:

Does session timeout removes objects from session?

Thanks & Regards,
13 years ago