• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Runtime hangs when writing to a file

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have a java program which generates a tab delimited file. I am calling it thru a web application using Runtime class. The problem is that the program hangs after a certain time. If i run the program thru the command prompt it runs fine, but when it is called thru the WEbapplication it hangs. Any idea what is the problem
Thanks
Rashid
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running it on the server or on the client, the first thing I will check is the security...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or it could be something in here:

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rashid Darvesh:
Hi
i have a java program which generates a tab delimited file.



Can you post your code?
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is the code snippet which i used. i am using xml database. iget all the asset id at once and iterate over them one by one and write it to a file. Please let me know if you need more information

con = this.factory.newConnection();
XDBCStatement xstmt = con.createStatement();
String assetIdXquery = IMPORT_PREFIX + "\n" + "zap:get-published-ei-asset-ids()";
assetIdRs = xstmt.executeQuery(assetIdXquery);
while (assetIdRs.hasNext()) {
assetIdRs.next();
String assetId = assetIdRs.getString().asString();
assetL.add(assetId);
}
System.out.println("Asset Count: " + assetL.size());
Iterator it = assetL.iterator();
while(it.hasNext()){
cnt++;
String assetId = it.next().toString();
System.out.println("Counter " + cnt + " : " + assetId );
String assetXquery = IMPORT_PREFIX + "\n" + "zap:get-published-ei-report-test" + "(\"" + assetId + "\")";
assetRs = xstmt.executeQuery(assetXquery);
while (assetRs.hasNext()) {
assetRs.next();
String result = assetRs.getString().asString();
String line= composeString(result);
writeToFile(line,fos);
String lineForThumb = null;
lineForThumb = composeStringForThumb(result);
if (lineForThumb!=null){
writeToFile(lineForThumb,fosForThumb);
}
}
assetRs.close();
}

Let me know if you need more information
Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic