Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Rethrow/retrigger interrupted status where appropriate
- Loading branch information
|
@@ -93,6 +93,13 @@ public static void stop() |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
synchronized( s_taskLock ) |
|
|
{ |
|
|
s_computerTaskQueues.clear(); |
|
|
s_computerTasksActive.clear(); |
|
|
s_computerTasksActiveSet.clear(); |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
@@ -157,10 +164,11 @@ public void run() |
|
|
} |
|
|
catch( InterruptedException ignored ) |
|
|
{ |
|
|
Thread.currentThread().interrupt(); |
|
|
} |
|
|
} |
|
|
|
|
|
private void execute( BlockingQueue<ITask> queue ) |
|
|
private void execute( BlockingQueue<ITask> queue ) throws InterruptedException |
|
|
{ |
|
|
ITask task = queue.remove(); |
|
|
|
|
@@ -207,20 +215,19 @@ private void execute( BlockingQueue<ITask> queue ) |
|
|
} |
|
|
} |
|
|
} |
|
|
catch( InterruptedException ignored ) |
|
|
{ |
|
|
} |
|
|
|
|
|
// Re-add it back onto the queue or remove it |
|
|
synchronized( s_taskLock ) |
|
|
finally |
|
|
{ |
|
|
if( queue.isEmpty() ) |
|
|
{ |
|
|
s_computerTasksActiveSet.remove( queue ); |
|
|
} |
|
|
else |
|
|
// Re-add it back onto the queue or remove it |
|
|
synchronized( s_taskLock ) |
|
|
{ |
|
|
s_computerTasksActive.add( queue ); |
|
|
if( queue.isEmpty() ) |
|
|
{ |
|
|
s_computerTasksActiveSet.remove( queue ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
s_computerTasksActive.add( queue ); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -248,7 +255,7 @@ public void run() |
|
|
{ |
|
|
task.execute(); |
|
|
} |
|
|
catch( Throwable e ) |
|
|
catch( RuntimeException e ) |
|
|
{ |
|
|
ComputerCraft.log.error( "Error running task.", e ); |
|
|
} |
|
@@ -259,6 +266,7 @@ public void run() |
|
|
catch( InterruptedException e ) |
|
|
{ |
|
|
ComputerCraft.log.error( "Error running task.", e ); |
|
|
Thread.currentThread().interrupt(); |
|
|
} |
|
|
} |
|
|
|
|
|