git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9b6ab93
)
JAL-3690 recoded AWSThread to use javax.swing.Timer (see https://github.com/BobHanson...
merge/Jalview-JS/develop_feature/JAL-3690_callback-based-web-services
author
Jim Procter
<jprocter@issues.jalview.org>
Fri, 18 Dec 2020 11:37:02 +0000
(11:37 +0000)
committer
Jim Procter
<jprocter@issues.jalview.org>
Fri, 18 Dec 2020 11:37:58 +0000
(11:37 +0000)
src/jalview/ws/AWSThread.java
patch
|
blob
|
history
diff --git
a/src/jalview/ws/AWSThread.java
b/src/jalview/ws/AWSThread.java
index
096f4ee
..
5748414
100644
(file)
--- a/
src/jalview/ws/AWSThread.java
+++ b/
src/jalview/ws/AWSThread.java
@@
-33,15
+33,17
@@
import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
import java.util.ArrayList;
import java.util.List;
import java.util.ArrayList;
import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
import static java.lang.String.format;
import static java.lang.String.format;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.Timer;
+
public abstract class AWSThread
{
public abstract class AWSThread
{
- private final Timer timer = new Timer();
+ private javax.swing.Timer timer;
/**
* view that this job was associated with
/**
* view that this job was associated with
@@
-116,9
+118,11
@@
public abstract class AWSThread
wsInfo.setFinishedNoResults();
return;
}
wsInfo.setFinishedNoResults();
return;
}
- TimerTask task = new TimerTask() {
+ timer = new Timer(5000, new ActionListener()
+ {
+
@Override
@Override
- public void run()
+ public void actionPerformed(ActionEvent e)
{
JobStateSummary jstate = new JobStateSummary();
for (final AWsJob job : jobs)
{
JobStateSummary jstate = new JobStateSummary();
for (final AWsJob job : jobs)
@@
-181,13
+185,15
@@
public abstract class AWSThread
updateGlobalStatus(jstate);
if (jobComplete)
{
updateGlobalStatus(jstate);
if (jobComplete)
{
+ timer.stop();
// jobs should never be null at this point
parseResult(); // tidy up and make results available to user
// jobs should never be null at this point
parseResult(); // tidy up and make results available to user
- timer.cancel();
+
}
}
}
}
- };
- timer.schedule(task, 0, 5000);
+ });
+ timer.setInitialDelay(0);
+ timer.start();
}
protected void updateGlobalStatus(JobStateSummary jstate)
}
protected void updateGlobalStatus(JobStateSummary jstate)
@@
-220,7
+226,7
@@
public abstract class AWSThread
public void interrupt()
{
public void interrupt()
{
- timer.cancel();
+ timer.stop();
}
/**
}
/**