Hi all,
I'm having issues with a very slow AsyncCallback method.
My set up is as follows:
// CLIENT CODE:
System.out.println("ONE: "+System.currentTimeMillis()/1000F);
final AsyncCallback callback = new AsyncCallback(){
public void onSuccess(Object result){
System.out.println("THREE: "+System.currentTimeMillis()/
1000F);
dataList = (List<String>) result;
createTable(dataList);
}
public void onFailure(Throwable caught){
Window.alert(caught.toString());
}
//Call to openFile service on server
fileService.openFile(fileType,fileName,callback)
}
// SERVER SIDE CODE:
public List<String> openFile(int fileType, String fileName){
File file = new File(fileName);
FileInputStream fin = null;
byte[] bytes = new byte[(int) file.length()];
try{
fin = new FileInputStream(file);
fin.read(bytes);
String s = new String(bytes);
doStuff(s);
fin.close();
}catch(FileNotFoundException fnfe){
fnfe.printStackTrace();
}catch(IOException ioe){
ioe.printStackTrace();
}
System.out.println("TWO: "+System.currentTimeMillis()/1000F);
return dataStringList;
}
I'm running the application in development mode.
The openFile() method on the server returns an ArrayList<String>
called dataStringList, which has 57217 String objects within it.
My console output is:
ONE: 1287402660233
TWO: 1287402660597
THREE: 1287402836619
The elapsed time between the System.out.print statements, ONE and TWO
is 0.364 seconds.
In contrast, the elapsed time between TWO and THREE is 176 seconds
(close to 3 minutes), which is far too long for simply processing a
file of 164kb in size.
When I run the application with a smaller data set - with a file size
of 4kb - the elapsed time between TWO and THREE is 1.03 seconds.
Any pointers or suggestions as to where the time lag could be would be
much appreciated.
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.