users@grizzly.java.net

Re: CometContext blocked by client

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Mon, 07 Feb 2011 19:28:23 +0100

Glad to hear that!

Thanks.

WBR,
Alexey.

> 5.23 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.23> CometContext context = engine.getCometContext(topic);
> 5.24 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.24> if (context == null) {
> 5.25 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.25> context = engine.register(topic);
> 5.26 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.26> + context.setBlockingNotification(false);
> 5.27 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.27> + DefaultNotificationHandler nh =
> 5.28 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.28> + (DefaultNotificationHandler) context.getNotificationHandler();
> 5.29 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.29> + nh.setSpreadNotifyToManyToThreads(true);
> 5.30 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.30> context.setExpirationDelay(-1);
> 5.31 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.31> VideoSource videoSource = createVideoSource(req.getPathInfo(), context);
> 5.32 <https://hg.imavis.com/centrepoint-trunk/rev/461661f6b26d#l5.32> context.addAttribute("videoSource", videoSource);
>
>
> Now all works fine (we've also synchronized CometContext creation and
> disposition).
>
> Thanks a lot
> WBR
>
> Leonardo
>
>
>> Hi,
>>
>> please try to assign a thread pool to CometEngine, to be able to run
>> handlers asynchronously like:
>>
>> final CometEngine engine = CometEngine.getEngine();
>>
>> ThreadPoolConfig tpConfig = ThreadPoolConfig.DEFAULT.clone()
>> .setCorePoolSize(2)
>> .setMaxPoolSize(5)
>> .setQueueLimit(256);
>> GrizzlyExecutorService ges =
>> GrizzlyExecutorService.createInstance(tpConfig);
>>
>> engine.setThreadPool(ges);
>>
>>
>> WBR,
>> Alexey.
>>
>> PS: assume startComet method is somehow synchronized? ;)
>
>
>
> --
> Leonardo Pecile
> ImaVis S.r.l.
> Via F.lli Carpigiani, 4
> 40138 - Bologna - Italy
> phone: + 39 051 6012120
> fax: +39 051 531666
> web:www.imavis.com
> email:leonardo.pecile_at_imavis.com