public void run()
{
boolean annotationAdded = false;
- try
+ if (alignViewport.isClosed())
{
- calcMan.notifyStart(this);
+ abortAndDestroy();
+ return;
+ }
- while (!calcMan.notifyWorking(this))
+ if (alignViewport.getAlignment() != null)
+ {
+ try
{
- try
- {
- Thread.sleep(200);
- } catch (InterruptedException ex)
- {
- ex.printStackTrace();
- }
- }
- if (alignViewport.isClosed())
+ annotationAdded = computeAnnotations();
+ } catch (IndexOutOfBoundsException x)
{
- abortAndDestroy();
+ // probable race condition. just finish and return without any fuss.
return;
}
-
- if (alignViewport.getAlignment() != null)
- {
- try
- {
- annotationAdded = computeAnnotations();
- } catch (IndexOutOfBoundsException x)
- {
- // probable race condition. just finish and return without any fuss.
- return;
- }
- }
- } catch (OutOfMemoryError error)
- {
- ap.raiseOOMWarning("calculating feature counts", error);
- calcMan.disableWorker(this);
- } finally
- {
- calcMan.workerComplete(this);
}
if (ap != null)