Java Reference
In-Depth Information
try {
this .addObserver(proxyURL,"any");
System.out.println(this.getURL() ! " started");
} catch (Exception e){e.printStackTree(); }
}
public synchronized void step(){
try {
started # true ;
notifyAll();
wait();
} catch (InterruptedException e){}
stop();
}
public void quit(){ }
public synchronized void completed( boolean s){
negotiator.completed(s);
notifyObservers( new Event("COMPLETE", this .getURL(),
negotiator.finalProposal()));
notify();
}
public void intersect(Proposal own, Proposal other){
negotiator.intersect(own,other);
}
public synchronized Proposal initialProposal(){
// waits until the DActivity has been started and is
// therefore remotely visible, otherwise it would not be
// able to send notifications
while (!started){
try {
wait();
} catch (Exception e){}
}
Proposal initial # negotiator.initialProposal();
notifyObservers( new DEvent("INITIAL",this.getURL(),
initial));
return initial;
}
public Proposal counterProposal(Proposal received){
notifyObservers( new DEvent("RECEIVED", this .getURL(),
received));
try {
Proposal sent # negotiator.counterProposal(received);
notifyObservers( new DEvent("SENT", this .getURL(),sent));
return sent;
} catch (Exception e){
System.err.println("exception in counterproposal!!!");
Search WWH ::




Custom Search