Jump to content
Excelsior Forums
Sign in to follow this  
kaka

Application hangs during file I/O

Recommended Posts

My compiled application hangs (GUI non-responsive) for about 30 seconds when I try to save a 1MB file to a floppy disk. Once the disk operation is done, the appllication becomes responsive again. I tried the exact same scenario in the non-compiled (interpreted) version of my application and GUI is still responsive to user input.

I am currently using JET 3.7 with Maintenance Pack 4. Here are the options I am using to run the applicaiton: "-Djet.gc.heaplimit:296m -Djet.gc.ratio:30 -Djet.gc.defragment -Djet.gc.dont.optimize.finalization"

I was wondering whether anyone faced similar issues during large file I/O. Any suggestions?

Share this post


Link to post
Share on other sites

It is strange occurence: I have wrote the next example and it works:

=====

import javax.swing.*;? ?

import java.awt.*;

import java.awt.event.*;

import java.io.*;

public class HelloSwing {

? ? public static void main(String[] args) {

? ? ? ? JFrame frame = new JFrame("HelloSwing");

? ? ? ? frame.setSize (350, 350);

? ? ? ? JLabel l = new JLabel("Hello, Swing!", JLabel.CENTER);

? ? ? ? Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();

? ? ? ? int x = (scrDim.width - frame.getSize().width) /2;

? ? ? ? int y = (scrDim.height - frame.getSize().height) /2;

? ? ? ? frame.setLocation(x, y);

? ? ? ? frame.addWindowListener(new WindowAdapter() {

? ? ? ? ? ? public void windowClosing(WindowEvent e) {

? ? ? ? ? ? ? ? System.exit(0);

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? frame.getContentPane().add(l);

? ? ? ? frame.setVisible(true);

? ? ? ? try {

? ? ? ? ? ? OutputStream out = new FileOutputStream ("a:\\zzz");

? ? ? ? ? ? byte arr[] = new byte[1024*1024];

? ? ? ? ? ? out.write(arr);

? ? ? ? ? ? out.close();

? ? ? ? ? ? l.setText("Done");

? ? ? ? } catch (Exception e) {

? ? ? ? ? ? e.printStackTrace();

? ? ? ? }

? ? }

}

=====

Could you please write a little example to reproduce this problem?

*FSA

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×