xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Moore" <smo...@novacoxmail.com>
Subject Re: Why is FO(P) a superior model than what most proprietary tool s propose
Date Wed, 01 May 2002 13:13:39 GMT
I just keep track of it myself.  Declare a member variable of type int and
increment it everytime a request comes in and decrement it after the request
is serviced (in a finally{} block, watch out for exceptions messing up your
counter).

Make sure you synchronize access to it and it should work just fine.

private synchronized int addThreadCount(int add)
{
  return (count += add);
}

... doGet(...)
{
    int reportsRunning = addThreadCount(1);
    if (reportsRunning > MAX_THREADS)
    {
        // Sleep thread until ready
    }

    try
    {
        // generate report
    }
    catch (Exception e)
    {
        // handle exception
    }
    finally
    {
        addThreadCount(-1);
    }
}


HTH,
Scott


----- Original Message -----
From: "Carter, Will" <wcarter@EnvestNet.com>
To: <fop-user@xml.apache.org>
Sent: Tuesday, April 30, 2002 5:50 PM
Subject: RE: Why is FO(P) a superior model than what most proprietary tool s
propose


> this is interesting...
> can the servlet report how many threads it has at any given time?  Do you
> know of any code examples of how this is done?
>
> thanks for the good idea...
> will


Mime
View raw message