users@grizzly.java.net

Re: Am I crazy? Yes... (I think I know more, so will re-ask)

From: Paul.M <paul.mattheis_at_gmail.com>
Date: Tue, 9 Feb 2010 07:10:23 -0800 (PST)

So This bit... Can I use this in a separate thread? Would it be thread
safe? Would I have to bend the cometContext into a Publish Context? Or do
I use getCometHandlers and notify(attachment, CometHandler) to send the
message?

Or am I wrong, and that there is a different way I should be sending
messages in? I want to keep async for this....

I keep reading the "documentation" hopeing a light goes off.

                    final String channel = context.getChannel();
                    final Set<DataHandler> handlers =
context.lookupClientHandlers(channel);

                    final CometContext cometContext =
CometEngine.getEngine().getCometContext(channel);

                    final DataHandler sender = context.getSenderClient();

                    /// Send message to all clients except the sender
                    for (DataHandler dataHandler : handlers) {
                        try {
                                cometContext.notify(patternResponse,
dataHandler);
                            }
                        } catch (IOException ex) {
                           
Logger.getLogger(CometServer.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }
                }
            });


-- 
View this message in context: http://old.nabble.com/Am-I-crazy--Yes...--%28I-think-I-know-more%2C-so-will-re-ask%29-tp27475268p27516722.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.