Search code examples
javaobserver-patternagents-jade

any other ways similar to observer pattern


I was asked to implement the function which waits for some action to be done. Then lets it do whatever it is supposed to do. I was asked not to use observer class. I tried with infinite loop and it worked. So i wonder if there are any other ways i could do that. (im developing an app in Jade where an supper agent communicates with other agents and once a message is received by and agent he can do some function and send back a message). I want something for that waiting part. Thanks in advance


Solution

  • What about using an action listener?

    http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html

    You can wait for the desired action and once triggered, you can implement your function.