Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7496321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:33:58+00:00 2026-05-29T18:33:58+00:00

I have a Jersey REST service with a resource class that calls methods on

  • 0

I have a Jersey REST service with a resource class that calls methods on a service class. During testing we’ve noticed a latency between the time the resource method’s “Entering” log statement and the service’s. This latency can be as much as 5 minutes although normally it’s in the 2 minute range. Once in awhile, the latency is minimal (milliseconds).

Here’s what our classes look like:

Resource

@Stateless
@Path("/provision")
public class ProvisionResource
{
    private final Logger logger = LoggerFactory.getLogger(ProvisionResource.class);

    @EJB
    private ProvisionService provisionService;

    @GET
    @Produces(MediaType.APPLICATION_XML)
    @Path("/subscriber")
    public SubscriberAccount querySubscriberAccount(
            @QueryParam("accountNum") String accountNum)
    {
        logger.debug("Entering querySubscriberAccount()");

        final SubscriberAccount account;

        try
        {
            account = provisionService.querySubscriber(accountNum);    
        }
        catch (IllegalArgumentException ex)
        {
            logger.error("Illegal argument while executing query for subscriber account",
                    ex);

            throw new WebApplicationException(Response.Status.BAD_REQUEST);
        }
        catch (Exception ex)
        {
            logger.error("Unexpected exception while executing query for subscriber account",
                    ex);

            throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
        }

        logger.debug("Exiting querySubscriberAccount()");

        return account;
    }    
}

Service:

@Singleton
public class ProvisionService
{
    private final Logger logger = LoggerFactory.getLogger(ProvisionService.class);

    public SubscriberAccount querySubscriber(final String accountNum) throws IllegalArgumentException, Exception
    {
        logger.debug("Entering querySubscriber()");

        if (null == accountNum)
        {
            throw new IllegalArgumentException("The argument {accountNum} must not be NULL");
        }

        SubscriberAccount subscriberAccount = null;

        try
        {
            // do stuff to get subscriber account
        }
        catch (Exception ex)
        {
            throw new Exception("Caught exception querying {accountNum}=["
                    + accountNum + "]", ex);
        }
        finally
        {
            logger.debug("Exiting querySubscriber()");
        }

        return subscriberAccount;
    }

Here’s some samples from our logs showing the timestamps of when we enter the methods.

2012 Feb 07 15:31:06,303 MST [http-thread-pool-80(1)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount() 
2012 Feb 07 15:31:06,304 MST [http-thread-pool-80(1)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:35:06,359 MST [http-thread-pool-80(1)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:40:33,395 MST [http-thread-pool-80(1)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:34:06,345 MST [http-thread-pool-80(2)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:37:24,372 MST [http-thread-pool-80(2)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:33:06,332 MST [http-thread-pool-80(4)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:34:15,349 MST [http-thread-pool-80(4)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:37:24,371 MST [http-thread-pool-80(4)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:40:36,004 MST [http-thread-pool-80(4)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:32:06,317 MST [http-thread-pool-80(5)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:34:15,325 MST [http-thread-pool-80(5)] DEBUG my.package.ProvisionService - Entering querySubscriber()

2012 Feb 07 15:36:06,373 MST [http-thread-pool-80(5)] DEBUG my.package.ProvisionResource - Entering querySubscriberAccount()
2012 Feb 07 15:40:34,956 MST [http-thread-pool-80(5)] DEBUG my.package.ProvisionService - Entering querySubscriber()

As you can see, the first one called the querySubscriber method in the service almost immediately after entering the resource’s querySubscriberAccount. However, subsequent calls to the webservice take ~1 to 5 minutes. There’s really nothing happening in the resource that would hold up processing/calling the service.

The webservice is deployed on a Linux server in Glassfish 3.1.1.

Has anyone seen anything like this before?? Any suggestions on what’s going on?

EDIT

Just a little more information…

The domain into which the web service war is deployed has 4 applications deployed in it:

  • the Jersey webservice war which is having issues
  • an ear which uses a client to the Jersey webservice
  • a servlet war used to test connections etc. used by the ear (including the Jersey webservice)
  • another servlet war which does not use the webservice

When we disabled the ear and “other” war file (only the Jersey war and the test servlet were enabled), the latency issue goes away. We re-enabled the war and ear and things still continued to respond in a timely manner. When we redeployed Jersey webservice war (made some logging changes), the latency problem immediately came back.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:33:59+00:00Added an answer on May 29, 2026 at 6:33 pm

    Thread dump can be used to find out what code (including stack traces) is running and the current moment inside Java process. jps tool will help in get getting PID of the required JVM instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a REST web service with Jersey Server (that totally rocks !).
I have a Jersey client that is successfully calling a REST service and populating
I have a Jersey REST service which has endpoints that can return either application/xml
I have developed a Jersey Resource class. Can someone please tell me how can
I have a REST service built using Jersey. I want to be able to
I have a JAX-RS REST service implemented using Jersey. One of the cool features
I have a REST service built using Jersey . When I performed a curl
I have developed a REST service with Apache Jersey, running on Tomcat. It works
I have some @javax.xml.bind.annotation.Xml... annotated classes here intended for a RESt web service. Jersey
I have jersey REST channel deployed on weblogic. All methods are configured to return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.