Just did a search getting below. I thought it's the method we're talking about.
====
void close(Exception reason)

Closes this Cursor and frees any resources it my have allocated. Repeated calls 
to this method after this Cursor has already been called should not fail with 
exceptions. The reason argument is the Exception instance thrown instead of the 
standard CursorClosedException.

Parameters:
    reason - exception thrown when this Cursor is accessed after close
====

Not sure if it's a good practice to pass an exception as reason to a close 
method, as least in Java.
Confusing: exception thrown when this Cursor is accessed after close. When it's 
accessed after close, why call the method once more?
A nit: "it my have allocated" => "it may have allocated"

Regards,
Kai

-----Original Message-----
From: Emmanuel Lécharny [mailto:[email protected]] 
Sent: Saturday, January 30, 2016 7:00 PM
To: Apache Directory Developers List <[email protected]>
Subject: Re: Cursor to implement Closeable

Le 30/01/16 10:36, Zheng, Kai a écrit :
> The proposed change makes sense to me. Then in new Java style, codes can be 
> like: try (Cursor c = Cursor.open(xxx)) {}.
>
> But I don't know what close(Exception) method is for. Looks to me, close() 
> throws IOException is enough.

This is just a method that close the cursor, but you can 'propagate' an error 
to it. This is helpful when you have to close a cursor because you have 
detected an error while processing it.


Reply via email to