Callback Methods

Callbacks methods are the way of managing life cycle of
an instance. Callback methods are generally used by containers. The methods are
called at specific time during the lifetime of an instance. For example in
servlet destroy() method is called by the servlet container that indicates that
the servlet is being taken out of service. This type of methods are generally
called by the container, the developer does not need to call these methods
explicitly. Most of the languages specifies the callback method by passing the
address of the subroutine to the system to the request is calling back from, But
java performs the same thing by using interfaces. Java does not allow passing
the address of subroutine but allows passing an instance of a class that
implements the standard interface. For this purpose anonymous classes are mainly
used as they support a better compact definition of the class that is required
as a new class.
One more example of callback methods is ejbCreate
method that is used by an ejb container to create a ejb bean - the developer
does not call it explicitly in code- the container calls it- although the
developer can override it- or put stuff in it...
Callback methods have totally different meaning
regarding the context of security. In order to login securely call the server
which then calls us back. This makes it harder for you to spoof being someone
else. This may be done over phone lines or over the Internet. It is the same
scheme a jealous husband might use to ensure his wife is really home as she
claims.

|