super(alignViewport, alignPanel);
}
+ @Override
public void run()
{
+ if (calcMan.isPending(this))
+ {
+ return;
+ }
+ calcMan.notifyStart(this);
+ long started=System.currentTimeMillis();
try
{
AlignmentAnnotation consensus = alignViewport.getAlignmentConsensusAnnotation();
- if (consensus==null) { return;
+ if (consensus==null || calcMan.isPending(this)) {
+ calcMan.workerComplete(this);
+ return;
}
- calcMan.notifyStart(this);
- while (!calcMan.notifyWorking(this))
+ while (!calcMan.notifyWorking(this))
{
+ // System.err.println("Thread (Consensus"+Thread.currentThread().getName()+") Waiting around.");
try
{
if (ap != null)
{
- ap.paintAlignment(false);
+ ap.paintAlignment(false);
}
-
Thread.sleep(200);
} catch (Exception ex)
{
ex.printStackTrace();
}
}
- calcMan.notifyWorking(this);
if (alignViewport.isClosed())
{
abortAndDestroy();
consensus.annotations = new Annotation[aWidth];
Hashtable[] hconsensus = alignViewport.getSequenceConsensusHash();
hconsensus = new Hashtable[aWidth];
- AAFrequency.calculate(alignment.getSequencesArray(), 0,
+ try {
+ AAFrequency.calculate(alignment.getSequencesArray(), 0,
alignment.getWidth(), hconsensus, true);
+ } catch (ArrayIndexOutOfBoundsException x){
+ // this happens due to a race condition -
+ // alignment was edited at same time as calculation was running
+ //
+// calcMan.workerCannotRun(this);
+ calcMan.workerComplete(this);
+ return;
+ }
alignViewport.setSequenceConsensusHash(hconsensus);
updateResultAnnotation(true);
ColourSchemeI globalColourScheme = alignViewport
* update the consensus annotation from the sequence profile data using
* current visualization settings.
*/
+ @Override
public void updateAnnotation()
{
updateResultAnnotation(false);