Salut,
can you send the .java class/ test? Send it privately if you can't share
with outside so I can reproduce locally.
Thanks!
-- Jeanfrancois
Zoltan Arnold NAGY wrote:
> found some other strange things too. :)
>
> even after statistics.stopGatheringStatistics() I can see
> com.sun.grizzly.util.WorkerThreadImpl
> threads running, causing the app to hang instead of shutting down.
>
> even more interestingly this happens if I dont start GrizzlyWebServer.
>
> Should I call startGatheringStatistics() only on a running instance?
> does it still needs JMX? I saw Jean-Francois fix some stat dependency
> on JMX,..
>
> Thanks,
>
> Zoltan
>
> Zoltan Arnold NAGY wrote:
>> Hi all,
>>
>> I've started using grizzly in my project, and for that I have written
>> an adapter
>> to print out statistics.
>>
>> public class StatisticsAdapter extends GrizzlyAdapter {
>> final Statistics statistics;
>>
>> public StatisticsAdapter(GrizzlyWebServer webserver) {
>> statistics = webserver.getStatistics();
>> statistics.startGatheringStatistics();
>> }
>>
>> @Override
>> public void service(GrizzlyRequest request, GrizzlyResponse
>> response) {
>> try {
>> PrintWriter out = response.getWriter();
>> out.println("number of requests since startup: " +
>> statistics.getRequestStatistics().getRequestCount());
>> out.println("total number of bytes received: " +
>> statistics.getRequestStatistics().getBytesReceived());
>> out.println("total number of bytes sent: " +
>> statistics.getRequestStatistics().getBytesSent());
>> out.println("--");
>> } catch(IOException e) {
>> e.printStackTrace();
>> }
>> }
>> }
>>
>> then I add it as such:
>>
>> GrizzlyWebServer ws = new GrizzlyWebServer(PORT);
>> ws.addGrizzlyAdapter(new StatisticsAdapter(ws), new String[] {
>> "/stat" });
>>
>> however, it behaves strangely. lets say I download a file of size
>> 15962823 from the webserver, then grab /stat with curl:
>> "number of requests since startup: 1
>> total number of bytes received: 0
>> total number of bytes sent: 15958016"
>>
>> then if I do this 5 more times, then the fifth will look like (so it
>> should be the sixth request totally from the server's point of view)
>> number of requests since startup: 9
>> total number of bytes received: 0
>> total number of bytes sent: 31916032
>>
>> no file was downloaded from the server in the meantime, nor there were
>> any requests. both number of requests and
>> total number of bytes sent behaves in a totally confusing manner. and
>> this is the exact same behaviour for every startup.
>>
>> what am I doing wrong? :-)
>>
>> Thanks!
>>
>> Zoltan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>