HW4 Threads FAQs

Q: How do we determine the size of the file we downloaded?
It's the length of the StringBuffer, since each char is one byte.

Q: What should happen when the value in the JCount text field is changed while a thread is running?
A: Nothing should happen immediately. The new value will get used on the next run (i.e. when you click start again).

Q: For part B, does the order of the printouts matter?
A: For the single-thread case, it should be in the right other. For multi-threaded runs, order doesn't matter.

Q: For part A, does the Account need to use the pointer to the Bank?
A: No, it's not required, it's just how our solution happens to work.

Q: On Part D, connection.connect() takes like 15 seconds to do when the url is invalid. So when I send an interrupt during this, my webworker thread doesn't notice until this line is completed. How do I get the thread to stop mid-line if a command takes a long time to do?
A: Don't worry about this case, it doesn't appear to occur when running on an elaine.

Q: On Part C, I get a NoClassDefFoundError. What might be causing this?
A: We don't know what causes the NoClassDefFoundError. However, you can make it go away by consolidating your code in such a way that only a single call to SwingUtilities.invokeLater() needs to be made.

Q: On Part C, how do I check to see if I haven't updated in at least 100ms?
A: Look at System.getCurrentTimeMillis() and see if that helps you.