|
|
Re: RemoteFileService [message #767988 is a reply to message #767906] |
Mon, 19 December 2011 10:22 |
Bertin Kiekebosch Messages: 330 Registered: August 2011 |
Senior Member |
|
|
Just tested with
org.eclipse.scout.rt.server.services.common.file.RemoteFileService.getRemoteFiles(String, FilenameFilter, RemoteFile[], String, long)
and that works.
This method is not available in the interface so to use it I extended the interface like this:
public interface IExtRemoteFileService extends IRemoteFileService {
RemoteFile[] getRemoteFiles(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, String charsetName, long maxBlockSize) throws ProcessingException;
RemoteFile[] getRemoteFileHeaders(String folderPath, FilenameFilter filter, RemoteFile[] existingFileInfoOnClient, int maxCount) throws ProcessingException;
}
The first method in the interface makes the call available to the client. The second method I added to test another way to do the same. I noticed that in RemoteFileService internally there is a boolean "includeContent" but it is not available in any public method.
So I also extended RemoteFileServices and implemented the second method on it that makes use of this internal boolean.
There is a difference in performance if I run the following test code
System.out.println("get sounds with getRemoteFileHeaders");
Calendar cal = Calendar.getInstance();
Date startTime = cal.getTime();
files = SERVICES.getService(IExtRemoteFileService.class).getRemoteFileHeaders("gramma6/sounds", new NoFilenameFilter(), null, -1);
cal = Calendar.getInstance();
Date endTime = cal.getTime();
System.out.println("time = " + (endTime.getTime() - startTime.getTime()) + " milleseconds");
System.out.println("get sounds with getRemoteFiles , blocksize = 0");
cal = Calendar.getInstance();
startTime = cal.getTime();
files = SERVICES.getService(IExtRemoteFileService.class).getRemoteFiles("gramma6/sounds", new NoFilenameFilter(), null, "UTF-8", 0);
System.out.println("Total " + files.length + " files");
cal = Calendar.getInstance();
endTime = cal.getTime();
System.out.println("time = " + (endTime.getTime() - startTime.getTime()) + " milleseconds");
Output:
get sounds with getRemoteFileHeaders
Total 4057 files
time = 582 milleseconds
get sounds with getRemoteFiles , blocksize = 0
Total 4057 files
time = 2162 milleseconds
|
|
|
Re: RemoteFileService [message #768051 is a reply to message #767988] |
Mon, 19 December 2011 13:44 |
Jeremie Bresson Messages: 124 Registered: November 2010 |
Senior Member |
|
|
The time difference probably comes from this block: (RemoteFileService:114 - RemoteFileService:118)
if (maxBlockSize > -1 && partLength > maxBlockSize) {
partLength = partLength - startPosition;
if (partLength > maxBlockSize) partLength = maxBlockSize;
if (partLength <= 0) partLength = 0;
} From the internal function: org.eclipse.scout.rt.server.services.common.file.RemoteFileService.getRemoteFileInternal(RemoteFile, Boolean, long, long)
In the second case, the block is skipped, because maxBlockSize = -1.
PS: I do not know why all methods are not available on the interface. This could probably be changed...
PS2: You could copy or extend this service to a ExtRemoteFileService. If you do so, do not forget to register your service in plugin.xml (client and server).
[Updated on: Mon, 19 December 2011 13:48] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03615 seconds