On Monday 14 September 2009 22:01:34 [email protected] wrote: > I am developing a stock market platform. I am writing Stock entries to > javaspace and generating events. The event is notified in EventListener. > > Now I want to get the entry written to the space for which the event is > generated and send the entry data to Servlet response. For servlet response > I am already passing the HttpResponse object to the EventListener class and > is available in notify() method. > > Questions are as follows: > > 1) How can i retrieve the written entry from remote event in notify() > method of the listener?
Could a blocking read or take may be a better solution here? The notify() part of the specification isn't guaranteed and is usually carried out on a best-effort basis. A particular implementation may offer the ability to change this, but you could be restricting your choices. Also check the JavaSpace05 specification for the registerForAvailabilityEvent method. IIRC, it allows you to register a listener that receives a copy of the entry that triggered the event. > 3) How can i filter remote events? This is dependent on the template you specify when setting up the registration. You can change the scope of your registration by changing the template. Cheers, -- Dominic Cleal CDO2 88 Union Street London SE1 0NW Tel: +44 (0)845 456 4460 Fax: +44 (0)845 456 4461 www.cdo2.com www.cdovar.net
