axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Davis" <...@us.ibm.com>
Subject RE: Callbacks?
Date Mon, 20 Aug 2001 18:19:47 GMT
The problem is that we're never really sure when the
client app is done with the message.  From Axis' point-of-
view all it knows is that it created a Message object and
handed it back to the client.  For all we know the client
might never actually do anything with it - so Axis will never
regain control to do any callbacks.

Someone here had an interesting idea - they suggested something
along the lines of passing in an AxisInputStream to the ctor
of Message.  This will then allow Axis to call a "cleanup"
method.  This is better than blindly calling 'close' since
we don't always want to close the stream - but this does allow
the 'cleanup' method to do it.

This still doesn't solve the problem of Axis regaining control.
To solve that it would require the client-app to call some
sort of 'close' or 'done' method on the Message object that
the engine returned, when it was done with it's processing.
Kind of like requiring people to "delete" an object in C++.
This works - Axis can regain control - but it now requires
people to do something explicit with the Message object.
I guess putting a "done" or "clean" or "close" method on
the MessageContext (like you suggest) would be even better
then it can do it not only on the response message but on the
request message as well.

-Dug


Glen Daniels <gdaniels@macromedia.com> on 08/20/2001 02:04:43 PM

Please respond to axis-dev@xml.apache.org

To:   "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
cc:
Subject:  RE: Callbacks?




This is an interesting issue.  I would think the right place to scope this
stuff would be the MessageContext.  So barring more interesting/smart ways
to clean up resources, we could certainly put a cleanup() hook in the MC
that would call clear() and also notify a list of observers who have
registered interest, which could be Handlers or simply the resources
themselves (with wrappers).  This would be dead simple to add - what do you
think?

--G

> -----Original Message-----
> From: Doug Davis [mailto:dug@us.ibm.com]
> Sent: Saturday, August 18, 2001 3:36 PM
> To: axis-dev@xml.apache.org
> Subject: Callbacks?
>
>
> One thing we need to look at adding (somehow), is
> the ability for a handler to register some sort of
> callback routine that will be called when the message
> is done being processed.  Here's
> the scenario:
>    Client invokes Axis to send a message
>    In the client transport chain is a sender that
>      will send the message and waits for a response.
>    When it gets the response, the sender places the
>      response message into some persistence because
>      it can't keep it all in memory.  It then constructs
>      the response Axis.Message object passing in an
>      InputStream to the constructor.
>    The sender will then 'return'.
> (A similar problem can occur on the server where a
> handler constructs part of the message by giving the
> Axis engine an InputStream.)
> The problem is, the Sender is never notified when
> Axis is done with the InputStream.  The most obvious
> this is for Axis to call 'close' on it (with that being
> the callback mechanism to the handler) but Axis can't
> call close since in some cases the InputStream might be
> the socket and closing the socket (in the server case)
> would be bad.
> It seems like there needs to be some other mechanism
> in there for the handler to regain some sort of control
> so it can free-up its resources.  At one time we talked
> about the init/cleanup stuff doing this but I can't
> remember where we left that discussion.  But, if we do
> use that then we need to make sure that the cleanup
> is called after the entire message is read from the
> response Message object and not just after the chains
> are done being invoked.
>
> -Dug
>



Mime
View raw message