dev@grizzly.java.net

Re: GrizzlyWebServer and getStatistics doesnt return any stats

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 30 Jan 2009 14:09:48 -0500

Salut,

Survivant 00 wrote:
> I take the example : GrizzlyEmbedWebServer
>
> created a index.html file : and I wrote "coucou" ..
>
> when I run this code : PORT 80.. (I tried with 8080 first.. but just to
> be sure that Firefox wasn't returning a page from the cache..I switched
> to 80)

hum, I've just run the test under:

grizzly/trunk/samples/http/http-embed

> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/samples/http/embed/GrizzlyEmbedWebServer.html


% java -jar target/grizzly-embed-samples-1.9.5-SNAPSHOT.jar /var/www

and for me it works:

> jfarcand_at_jfarcand-desktop:/appserv80/grizzly/trunk/samples/http/http-embed$ java -jar target/grizzly-embed-samples-1.9.5-SNAPSHOT.jar /s1/domains/dom
> ain1/docroot/
> Grizzly WebServer listening on port 8080
> Current connected users: 0
> How many requests since startup:0
> How many connection we queued because of allthread were busy: 0
> Max Open Connection: 0
> Request Queued (15min avg): 0
> Request Queued (total): 0
> Byte Sent: 0
> 200 Count: 0
> 404 Count: 0
> Current connected users: 0
> How many requests since startup:2
> How many connection we queued because of allthread were busy: 0
> Max Open Connection: 0
> Request Queued (15min avg): 0
> Request Queued (total): 0
> Byte Sent: 0
> 200 Count: 0
> 404 Count: 2
> Current connected users: 0
> How many requests since startup:5
> How many connection we queued because of allthread were busy: 0
> Max Open Connection: 0
> Request Queued (15min avg): 0
> Request Queued (total): 0
> Byte Sent: 0
> 200 Count: 1
> 404 Count: 4

A+

-- Jeanfrancois

>
>
> public static void main( String args[] ) throws Exception {
> String path = args[0];
> if (args[0] == null || path == null){
> System.out.println("Invalid static resource path");
> System.exit(-1);
> }
>
> GrizzlyWebServer ws = new GrizzlyWebServer(80);
>
> final Statistics stats = ws.getStatistics();
> stats.startGatheringStatistics();
>
> ste.scheduleAtFixedRate(new Runnable() {
> public void run() {
> 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());
> System.out.println("Max Open Connection: "+
> stats.getRequestStatistics().getMaxOpenConnections());
>
> System.out.println("Request Queued (15min avg): "+
>
> stats.getThreadPoolStatistics().getCountQueued15MinuteAverage());
> System.out.println("Request Queued (total): "+
> stats.getThreadPoolStatistics().getCountTotalQueued());
> System.out.println("Byte Sent: "+
> stats.getRequestStatistics().getBytesSent());
> System.out.println("200 Count: "+
> stats.getRequestStatistics().getCount200());
> System.out.println("404 Count: "+
> stats.getRequestStatistics().getCount404());
>
> System.out.println("last URI:" +
> stats.getRequestStatistics().getLastRequestURI());
>
> return;
> }
> }, 0, 10,TimeUnit.SECONDS);
> System.out.println("Grizzly WebServer listening on port 8080");
> ws.start();
> }
>
>
> I always have theses stats :
>
> Current connected users: 0
> How many requests since startup:0
> How many connection we queued because of allthread were busy: 0
> Max Open Connection: 0
> Request Queued (15min avg): 0
> Request Queued (total): 0
> Byte Sent: 0
> 200 Count: 0
> 404 Count: 0
> last URI:null
>
> and in Firefox.. I see a nice : "coucou"
>
> what I'm missing ?
>
> I'm using the trunk from mvn version : 1.9.5