Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many thread alive in jvm #126

Closed
alldone opened this issue Jan 22, 2016 · 3 comments
Closed

Too many thread alive in jvm #126

alldone opened this issue Jan 22, 2016 · 3 comments

Comments

@alldone
Copy link

alldone commented Jan 22, 2016

Hi to all, and thank's for this work .......

i've a problem,

using the quartz scheduler, my app invoke 2000 reverse geocoding service
( obviusly under free limit quota )
with sychronous req.await() method.....

after these 2000 call ... in jvm i've 2000 thead alive with name Thread-1 .... Thread-2000 that make too slow system ( server centOs 6 and tomcat 7.... jdk 1.7)

please, a suggestion??

thank's in advance.

best regards
Aldo

@domesticmouse
Copy link
Contributor

Hey Aldo,

Can you first confirm for me that you only have one GeoApiContext object that you are using across all of your geocoding requests?

If the above is good, then the next step is debugging a thread dump of your running app...

@alldone
Copy link
Author

alldone commented Jan 25, 2016

Hi,

mmmmm.... no, i can't confirm.......

there are many instances of GeoApiContext .... ( 2 thousand at day :) )

from documentation i haven't read or understood that is necessary only one instance,... the problem is here? correct?

using a static instance of GeoApiContext, i will solve the problem?

thank's,
Aldo

here_the_code

    GeoApiContext Context = new GeoApiContext().setApiKey(ApiKey);
    String output = "";
    String message = "";
    String updateCounter = "0";
    String countOfResults = "";
    try {

        GeocodingResult[] results = null;
        try {
            results = GeocodingApi.newRequest(Context).language("it").address(address).await();

..................................................................................................

@domesticmouse
Copy link
Contributor

Ok, please create a single GeoApiContext and use it over the whole life of the program. Do not re-construct it for each API call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants