Friday, June 13, 2014

Method types in Java

  • Re-entrant : A Java method in stack is re-entrant means that is allowing multiple concurrent invocations that do not interfere with each other. 
  • Recursive : A function is recursive if it calls itself. Given enough stack space, recursive method calls are perfectly valid in Java though it is tough to debug. Recursive functions are useful in removing iterations from many sorts of algorithms. All recursive functions are re-entrant but not all re-entrant functions are recursive. 
  • Idempotent : Idempotent methods are methods, which are written in such a way that repeated calls to the same method with the same arguments yield same results. For example clustered EJBs, which are written with idempotent methods, can automatically recover from a server failure as long as it can reach another server.

No comments:

Post a Comment