Re: javaspace notify
John McClain <[email protected]> Thu, 12 Mar 2009 20:47:34 -0400
| Newsgroups | gmane.comp.java.sun.javaspaces |
|---|---|
| Message-ID | <[email protected]> |
Which space implementation are you using? Version? How fast are you
writing entries?
SUBSCRIBE JAVASPACES-USERS Anonymous wrote:
> hi all,
>
> I am new to javaspaces. I tried out a sample program using notify function,
> some parts of code as follows.
>
> //Inside registar class has method register which invokes NOTIFY() in JAVASPACE
>
> public void register() throws Exception {
> theListener = new EventListener();
> theManager = new LeaseRenewalManager();
>
> EventRegistration myReg = theSpace.notify(new ArrayMetaData(), null,
> theListener.getStub(),
> 30000,
> new MarshalledObject(new Integer(12345)));
>
> theManager.renewFor(myReg.getLease(), Lease.FOREVER,
> 30000, new DebugListener());
>
> }
>
>
> //and a notify method in a class EventListner which implements
> RemoteEventListener
>
>
> //EVENTLISTNER CONSTRUCTOR
> EventListener() throws RemoteException {
> System.out.println("Inside Eventlistner constructor");
> Exporter myDefaultExporter =
> new BasicJeriExporter(TcpServerEndpoint.getInstance(0),
> new BasicILFactory(), false, true);
>
> theStub = (RemoteEventListener) myDefaultExporter.export(this);
> }
>
>
>
> //getstub method - 3rd parameter to notify..
>
> RemoteEventListener getStub() {
> return theStub;
> }
>
>
> //NOTIFY METHOD IN EVENTLISTNER
> public void notify(RemoteEvent anEvent) {
>
> try {
> System.out.println("I got event");
> System.out.println("Got event: " + anEvent.getSource() + ", " +
> anEvent.getID() + ", " +
> anEvent.getSequenceNumber() + ", " +
> anEvent.getRegistrationObject().get());
>
> System.out.println("Some one wrote ArrayMetaDATA");
>
>
> } catch (Exception anE) {
> System.out.println("Got event but couldn't display it");
> anE.printStackTrace(System.out);
> }
> }
>
> This notify is working for only some writes of 'ArrayMetaData' Entry
> Objects... and for some the notify does not respond. Is there any way in
> which we can make notify 100% reliable.
>
> Thanking in advance..
> Hari
>
> ===========================================================================
> To unsubscribe, send email to [email protected] and include in the body
> of the message "signoff JAVASPACES-USERS". For general help, send email to
> [email protected] and include in the body of the message "help".
>
> To view past JAVASPACES-USERS postings, please see:
> http://archives.java.sun.com/archives/javaspaces-users.html
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS". For general help, send email to
[email protected] and include in the body of the message "help".
To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html