Hi Dan,

Closing the reader in a finally block seem reasonable to me too. I'll
file a JIRA for this first thing in the morning.

Regards,

Gerrie

-----Original Message-----
From: Dan Diephouse [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 15, 2006 4:26 PM
To: [email protected]
Subject: Re: [xfire-user] MessageBindingProvider does not close
XMLStreamReader

Hi Gerrie,
Can you please file a JIRA issue for this? I will get it fixed for the 
next beta. I think the solution is to just call reader.close() after 
things are done. As a workaround I think you could override 
MessageBindingProvider.writeParameter and call reader.close() or you 
could write a Handler which closed the reader after the request was all 
done.

Glad to hear its working out for you other than that though!
Regards,
- Dan

Kimpen, Gerrie wrote:
>
> Hi,
>
> I implemented an XMLStreamReader that loops over a java.sql.ResultSet 
> to create its events. Here is what my service method looks like:
>
> public XMLStreamReader getPacklistByNumber(XMLStreamReader reader) 
> throws Exception {
>
> String packlistNumber = getPacklistNumber(reader);
>
> // query database etc ...
>
> return new ResultSetXMLStreamReader(resultSet);
>
> }
>
> In the close() method of the ResultSetXMLStreamReader I release the 
> wrapped resultSet, but it seems that XMLStreamReader.close() never 
> gets called by the XFire code (more specifically 
> MessageBindingProvider). Is this (not) done for a reason?
>
> There are some options to get around this using XFire 1.0:
>
> - subclass MessageBindingProvider and override writeParameter
>
> - put the XMLStreamReader on the context and call close() in an out 
> handler
>
> Maybe you can think of a better way?
>
> <hr>
>
> If a simple XMLStreamReader.close() call in the MessageBindingProvider

> is not a good 'fix' maybe this is:
>
> An XMLStreamReaderWrapper could be used as a return type
>
> public interface XMLStreamReaderWrapper {
>
> XMLStreamReader getReader();
>
> /**
>
> * Called when XFire is finished with the reader.
>
> */
>
> void onReaderDiscard();
>
> }
>
> The MessageBindingProvider could call onReaderDiscard() in a finally 
> block.
>
> The service method would now look like:
>
> public XMLStreamReaderWrapper getPacklistByNumber(XMLStreamReader 
> reader) throws Exception {
>
> String packlistNumber = getPacklistNumber(reader);
>
> // query database etc ...
>
> return new DefaultXMLStreamReaderWrapper(new 
> ResultSetXMLStreamReader(resultSet));
>
> }
>
> It's just an idea,
>
> Tnx for the great work so far!
>
> Gerrie
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog





Reply via email to