F
Florence HENRY
Hello,
I'm trying to use the interface ObjectChangeListener. So I read the
documentation located at
http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/event/ObjectChangeL
istener.html ,
and here is the skeletton of the code that I produced :
public class Simulator implements ObjectChangeListener {
Object myObject;
public Simulator() {
//...
myObject.addNamingListener(this);
}
public void objectChanged(NamingEvent evt) {
System.out.println("NamingEvent " + evt.getSource().toString());
}
public void namingExceptionThrown(NamingExceptionEvent evt) {
System.err.println("NamingExceptionEvent " +
evt.getSource().toString());
}
}
The purpose is to make the object Simulator listening for changes that
happen to the Object myObject (manipulated by another thread).
The obvious problem is that the Object class does not know the
addNamingListener() method. Do I have to implement it ? What is the
right way to perform this ?
Any help would be appreciated.
I'm trying to use the interface ObjectChangeListener. So I read the
documentation located at
http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/event/ObjectChangeL
istener.html ,
and here is the skeletton of the code that I produced :
public class Simulator implements ObjectChangeListener {
Object myObject;
public Simulator() {
//...
myObject.addNamingListener(this);
}
public void objectChanged(NamingEvent evt) {
System.out.println("NamingEvent " + evt.getSource().toString());
}
public void namingExceptionThrown(NamingExceptionEvent evt) {
System.err.println("NamingExceptionEvent " +
evt.getSource().toString());
}
}
The purpose is to make the object Simulator listening for changes that
happen to the Object myObject (manipulated by another thread).
The obvious problem is that the Object class does not know the
addNamingListener() method. Do I have to implement it ? What is the
right way to perform this ?
Any help would be appreciated.