×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT杂谈 / CALL BACK
    The veterans know callback. CallBack is a pattern extensively used in Java technology. Can anybody cite some examples here?
    • Can anybody response?
    • Simply to say ...
      Simply to say, a Java class have a native method and a "non-native" method, the native method makes a call (i.e. call back) to the "non-native" method. Just like the "callback" in Microsoft Windows, a WndPro (Windows procedure) calls Windows, then Windows makes a call to a callback function.
    • What is callback?
      You and your sister and/or brother stay in a room where there is a telephone, you makes a call to one of your friend elsewhere, then the friend of yours makes a call back to you, your sister or your brother. This is called "callback".
      • JAVA偶不懂,一般电讯网络中的回拨是...
        主叫方给被叫方一个特定的CALL,包含handshake或authorization,被叫方判别对方权限正确后,自动切断本次连接,返还给主叫方一个CALL,继而登录网络,建立稳定的连接.
        酱紫的一个过程叫CALLBACK,显然具有一定的安全机制,因此在建设远程网络时常常用到.
        另外,由于电讯中计费主要是针对主叫方设计的,所以,CALLBACK还能用于转移话费支出.呵呵...中国电信是严格禁止海外对大陆建立CALLBACK的,嘻嘻,没钱赚啦!
        • The "Callback" procedure you described is exactly a "Callback" procedure in telecommunication.
          The "Callback" procedure you described is exactly, as you said, a "Callback" procedure in telecommunication. The "Callback" in Remote Access Service in Windows NT uses the same procedure as you described.

          What I said in "What is callback" above is just a simple personified analogy of "callback" procedure in Java programming. And I do not think it is an precise description.
    • Thank you all for response. Before this, I really did not know there is "callback" in telecommunication
      本文发表在 rolia.net 枫下论坛What I asked about is "callback" in Java. This is a design pattern. There are exact definitions for call back in most Java text books.

      Simply speaking, call back means that the server calls the client. Usually, the client wants to obtain some service and it calls a method of the server object, the server method should offer some service. In some cases, however, the server (object) just IN TURN calls another method of the client object. This design pattern is widely used in Java AWT event model. If you use JBuilder generate GUI code, all the event listeners call back the containner. Here the workflow is: The container or its contained object such as a button fires an event to the event listener, the eventlistener in turn calls a method of the container.

      Our Java objects live in the JVM. Without the infrastructure and service, Java objects cannot exisit. In this context, JVM is the "server" and our Java objects are "client".
      Java Object has a method called finalize(),
      it is designed for JVM to call back (to clean up) as JVM does the garbage collection.
      Likely, Applet and Servlet have a method called destroy(), which is called by Applet Container and Servlet Container as JVM unload Applet and Servlet. This is anpther case of callback in Java. In addition, EJB have some methods for EJB container to call back, for instance, ejbLoad(), ejbStore(), ...

      Well, the following is the rule: We, application programmer never, never, never call finalize(), destroy(), .... they are designed for container to call back. However, we are require to override these callback methods in some cases. For instance, we may need to close DB connection in the destroy() method of a DB Servlet.更多精彩文章及讨论,请光临枫下论坛 rolia.net