<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Mike & Chris,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Appreciate your response. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I'm trying to consolidate both of your responses and provide more inputs on my requirement.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Based on your feedback, I need to provide more inputs to make it more clear.<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Clarifications:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">1. listFiles API will be not be changed. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">2. There will be new API(s) to SmbFile, which takes page size as input and return array based on the size. This means page size is not specific to my needs. This API can be called multiple time to retrieve page worth of details until all elements are retrieved. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">3. Yes, it is specific to my application needs to support pagination. The server is handling request from mobile devices. Mobile devices are requesting to view contents of SMB share. Since SMB share volumes keeps growing and, server need to handle multiple clients concurrently, there should be a way to handle thousands of clients by limiting memory usage. To do this only option is to support pagination.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">4. Since JCIFS is blocking API, I took care in my application to make it look like asynchronous. I was thinking about users out there who might get benefit of making it as async library. </div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">5. For my application sorting is not a concern. Does CIFS / SMB server protocol support sorting?</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">6. My concern is let say, the share has 1,000 objects and, 1000 devices trying to use the API, then all of them together might be using significant amount of memory.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I changed SmbFile to have three new public APIs. These APIs help me to provide iteration behavior and keep memory usage at minimum possible.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">1.  public SmbFile[] getFirstPageContents(final SmbFileFilter fileFilter,final SmbFilenameFilter fileNameFilter, int pageSize) throws SmbException</div><div style="font-family:arial,sans-serif;font-size:13px">2.  public SmbFile[] getNextPageContents() throws SmbException</div><div style="font-family:arial,sans-serif;font-size:13px">3.  public void endPaginationRequest()</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">There are couple of additions constructors.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">1.  Trans2FindFirst2( String filename, String wildcard, int searchAttributes, int pageSize ) </div><div style="font-family:arial,sans-serif;font-size:13px">2. Trans2FindNext2(final  int sid, final int pageSize, final int resumeKey, final String filename )</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">At present I'm testing the changes and would like to contribute this change. Please let me know the process.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks & Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Sridhar Jonnalagadda.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 26, 2014 at 1:22 AM, Michael B Allen <span dir="ltr"><<a href="mailto:ioplex@gmail.com" target="_blank">ioplex@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Wed, Oct 22, 2014 at 6:49 PM, Sridhar Jonnalagadda<br>
<<a href="mailto:jonnalagadda.sridhar@gmail.com">jonnalagadda.sridhar@gmail.com</a>> wrote:<br>
> Hello JCIFS support team,<br>
><br>
><br>
><br>
> We have a requirement where there will be multiple calls, to list contents<br>
> of a folder. From MS-CIFS doc, there are two commands TRANS_FIND_FIRST2 and<br>
> TRANS_FIND_NEXT2 that might be used to retrieve folder contents as pages.<br>
><br>
><br>
><br>
> The listFiles() API in SmbFile is retrieving all the contents as one big<br>
> list. I see the code is using TRANS_FIND_FIRST2 and TRANS_FIND_NEXT2.<br>
> SmbFile does not have API to fulfill the requirement.<br>
<br>
</span>Hi Sridhar,<br>
<br>
JCIFS commands are already async. And JCIFS is very efficient about<br>
memory and stuff like this. All you need is the<br>
{SmbFileFilter,SmbFilenameFilter}.accept() callback. No need for OOP<br>
and Observable "patterns" and all that jazz.<br>
<br>
Although from just glancing at the code, it seems if you throw an<br>
exception from {SmbFileFilter,SmbFilenameFilter}.accept() it will not<br>
properly call SmbComFindClose2. But that is just a bug in the code<br>
that looks fairly easy to fix (by putting the close call in a finally<br>
block). I have added it to the TODO list. But if you really want to<br>
quit the list op early, you can probably still safely throw an<br>
exception in accept(). It might leave a handle open on the server but<br>
it will get cleaned up when the connection closes (after being idle<br>
for 30 seconds).<br>
<br>
Mike<br>
<span class=""><font color="#888888"><br>
--<br>
Michael B Allen<br>
Java Active Directory Integration<br>
<a href="http://www.ioplex.com/" target="_blank">http://www.ioplex.com/</a><br>
</font></span></blockquote></div><br></div></div>