• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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...
 
Sheriff
Posts: 27451
88
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
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic