users@grizzly.java.net

Re: [Q] Grizzlets update clients connected to different servers

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 15 Jan 2008 22:16:26 -0500

Jeanfrancois Arcand wrote:
> Hi,
>
> ALT Mobile DEV wrote:
>> Hi,
>>
>> I'm running multiple servers in the same JVM where each server is
>> associated with a different instance of the same Grizllet class. Each
>> server of course is bound to a different port.
>>
>> Confusingly, the unique content from each Grizzlet is pushed to all
>> clients irrespective of the server:port they are connected.
>
> Yes :-( I didn't expected that Grizzly will be used like you just
> explained. Mainly, since Grizzly build on top of Grizzly Comet, the
> CometHandler I did for Grizzly is registered as '/comet'. Since there is
> only one CometEngine (this is a singleton), all Grizzlet will be invoked
> when the Grizzly Comet do a push, as internally it will do:

Should have read:

> Yes :-( I didn't expected that GrizzLET will be used like you just
> explained. Mainly, since GrizzLET build on top of Grizzly Comet, the
> CometHandler I did for GrizzLET is registered as '/comet'. Since
there is
> only one CometEngine (this is a singleton), all Grizzlets will be
invoked
> when the Grizzly Comet do a push, as internally it will do:

Its Grizzlet that build on top of Grizzly Comet, nor Grizzly :-)

A+

--jeanfrancois



>
> cometContext.notify(...);
>
> and the cometContext is bind to 'comet'.
>
>>
>> It seems that the AsyncConnection is shared across all Grizzlets and
>> servers.
>>
>> I was expecting that:
>>
>> Grizzly server = unique port + unique Grizzlet instance + unique comet
>> context.
>
> OK I've just added a new API to let you customize the cometContextName.
> When you initialize the GrizzlyAdapter, just pass the name of the
> cometContext you want to use. In your case, it can be the just the port
> like the following:
>
>> 113 AsyncHandler asyncHandler = new DefaultAsyncHandler();
>> 114 asyncHandler.addAsyncFilter(new CometAsyncFilter());
>> 115 selectorThread.setAsyncHandler(asyncHandler);
>> 116 117 118 GrizzletAdapter adapter = new
>> GrizzletAdapter(String.valueOf(port));
>> 119 selectorThread.setAdapter(adapter);
>> 120 Grizzlet grizzlet =
>> (Grizzlet)loadInstance(grizzletClassName);
>> 121
>
> Try it and let me know if that works :-) I've uploaded the new artifacts
> to the m2 repository, or you can rebuild the comet module to get the
> changes.
>
> Thanks
>
> -- Jeanfrancois
>
>
>
>>
>>
>> thanks for any help.
>>
>>
>> --Zaid
>>
>> http://altmobile.com
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>