dev@grizzly.java.net

Re: get statistics

From: rama <rama.rama_at_tiscali.it>
Date: Fri, 9 Jan 2009 21:11:18 +0100

1.9.3


> Salut,
>
> which version are you using? I suspect this is a regression because
> of the ExecutorServices changes. Let me take a look ASAP.
>
> A+
>
> -- jeanfrancois
>
> rama wrote:
>> i have some difficult while trying to get stats
>> from a grizzlywebserver.
>> Here is a snippet of the code.
>> This code throw a nullpointer on the stats.getThreadPoolStatistics
>> ().getCountQueued());
>> and return 0 for all the other req.
>> btw, i have copy this piece of code somewhere on grizzly blog, but
>> i can't remember where :)
>> ----snippet--
>> public static void main(String args[]) {
>> GrizzlyWebServer ws = new GrizzlyWebServer(8080, 40,"/
>> Users/ramarama/html");
>> ScheduledThreadPoolExecutor ste =
>> new ScheduledThreadPoolExecutor(1);
>> final Statistics stats = ws.getStatistics();
>> stats.startGatheringStatistics();
>> ste.scheduleAtFixedRate(new Runnable() {
>> public void run() {
>> try {
>> System.out.println("Current connected users:
>> " +
>> stats.getKeepAliveStatistics
>> ().getCountConnections());
>> System.out.println("How many requests since
>> startup:" +
>> stats.getRequestStatistics
>> ().getRequestCount());
>> System.out.println("How many connection we
>> queued because of all " +
>> "thread were busy: " +
>> stats.getThreadPoolStatistics
>> ().getCountQueued());
>> } catch (Exception e) {
>> System.out.println(e);
>> }
>> return;
>> }
>> }, 0, 1,TimeUnit.SECONDS);
>> System.out.println("Grizzly WebServer listening on port
>> 8080");
>> try {
>> ws.start();
>> } catch (IOException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> }
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>