Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

javaspace notify  RSS feed

 
hari vijayadharan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Amit Ghorpade
Bartender
Posts: 2856
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"harikrishnan " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!