Fixed some potentially serious thread cancellation issues. jrg

This commit is contained in:
talisman%anamorphic.com 2001-04-08 09:56:53 +00:00
parent 622ab05cdd
commit cf1e06ffe2
7 changed files with 30 additions and 12 deletions

View File

@ -34,7 +34,7 @@ import grendel.util.Constants;
import java.io.InputStream;
import java.io.IOException;
import java.io.SequenceInputStream;
import java.io.StringBufferInputStream;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Enumeration;

View File

@ -51,7 +51,7 @@ import grendel.util.Constants;
*/
public class NewsRC {
static final boolean DEBUG = true;
static final boolean DEBUG = false;
protected File file = null; // disk file; might not exist, but never null.

View File

@ -39,7 +39,7 @@ import grendel.util.Constants;
class ParseBerkeleyFolderAndExpunge extends ParseBerkeleyFolder {
private static final boolean DEBUG = true;
private static final boolean DEBUG = false;
protected RandomAccessFile in = null;
protected RandomAccessFile out = null;

View File

@ -59,7 +59,7 @@ import javax.mail.event.StoreEvent;
import grendel.util.Constants;
public class PopStore extends Store {
static final boolean DEBUG = true;
static final boolean DEBUG = false;
static void Spew(String s) {
if (DEBUG) System.out.println("PopStore: " + s);
}

View File

@ -390,7 +390,7 @@ public class UnixDotLock {
if (debug) System.err.println("KILLING " + lock_heartbeat_thread);
Thread h = lock_heartbeat_thread;
lock_heartbeat_thread = null;
h.stop();
h.interrupt();
try {
h.join();
} catch (InterruptedException e) {
@ -416,7 +416,7 @@ public class UnixDotLock {
public static final void main(String arg[])
throws SecurityException, IOException, InterruptedException {
System.runFinalizersOnExit(true);
// System.runFinalizersOnExit(true);
File file1 = new File("/tmp/a");
File file2 = new File("/tmp/b");

View File

@ -247,7 +247,6 @@ public class FolderPanel extends GeneralPanel {
public FolderPanel() {
JScrollPane scrollPane = new JScrollPane();
//scrollPane.setBorder(BorderUIResource.getLoweredBevelBorderUIResource());
scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
Util.RegisterScrollingKeys(scrollPane);
@ -389,7 +388,13 @@ public class FolderPanel extends GeneralPanel {
public synchronized void setFolder(Folder aFolder) {
if (fFolderLoadThread != null) {
fFolderLoadThread.stop();
fFolderLoadThread.interrupt();
try {
fFolderLoadThread.join();
}
catch ( InterruptedException ie ) {
// ignore
}
if (fListeners != null) {
fListeners.folderLoaded(new ChangeEvent(fPanel));
fListeners.folderStatus(new StatusEvent(fPanel,

View File

@ -37,10 +37,11 @@ public class Animation extends Component implements Runnable
Thread fThread;
Icon fGlyphs[];
int fCurrent = 0;
boolean runAnimation = true;
public void run()
{
while (true)
while (runAnimation)
{
try
{
@ -58,7 +59,7 @@ public class Animation extends Component implements Runnable
}
catch (InterruptedException e)
{
fThread.stop();
runAnimation = false;
fThread = null;
}
}
@ -112,7 +113,13 @@ public class Animation extends Component implements Runnable
public synchronized void start()
{
if (fThread != null) {
fThread.stop();
fThread.interrupt( );
try {
fThread.join( );
}
catch ( InterruptedException ie ) {
// ignore
}
}
fThread = new Thread(this, "Animation");
fThread.start();
@ -121,7 +128,13 @@ public class Animation extends Component implements Runnable
public synchronized void stop()
{
if (fThread != null) {
fThread.stop();
fThread.interrupt( );
try {
fThread.join( );
}
catch ( InterruptedException ie ) {
// ignore
}
fThread = null;
}
fCurrent = 0;