File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Container Callback method doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Container Callback method doubt" Watch "Container Callback method doubt" New topic

Container Callback method doubt

Prasad Shindikar
Ranch Hand

Joined: Feb 18, 2007
Posts: 114

What does it mean when it is stated "xxx method is always a container callback method" ?
eg: In case of filters,

The destroy method is always a container callback method; while doFilter is a callback and an inline method.

What do container callback and inline methods mean ?
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

In HeadFirst books:

container callback method = a method that is called from the container's code
inline method = a method you call from your code

For the doFilter method, it is both. This is because the doFilter method on the Filter class is a container callback but the doFilter method on the FilterChain class is an inline method. Tricky.

A good workman is known by his tools.
vitesse wei
Ranch Hand

Joined: Sep 07, 2007
Posts: 100
we pass a method address to other thread,and let them to call our method,this method is a callback method,since in java,we can not pass method address,so we use interface,we pass a reference of real object of that interface(implement),other thread use the contract(interface) to call
method defined in our interface and implement in out real object.
about inline method,please see this(refered fome thinking in java):

The second reason for final methods is efficiency. If you make a method final, you are allowing the compiler to turn any calls to that method into inline calls. When the compiler sees a final method call, it can (at its discretion) skip the normal approach of inserting code to perform the method call mechanism (push arguments on the stack, hop over to the method code and execute it, hop back and clean off the stack arguments, and deal with the return value) and instead replace the method call with a copy of the actual code in the method body. This eliminates the overhead of the method call. Of course, if a method is big, then your code begins to bloat, and you probably won�t see any performance gains from inlining, since any improvements will be dwarfed by the amount of time spent inside the method. It is implied that the Java compiler is able to detect these situations and choose wisely whether to inline a final method. However, it�s best to let the compiler and JVM handle efficiency issues and make a method final only if you want to explicitly prevent overriding
hope it's help you

SCJP 5.0<br />SCWCD1.4<br />SCBCD5
I agree. Here's the link:
subject: Container Callback method doubt
jQuery in Action, 3rd edition