Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java140
1 files changed, 70 insertions, 70 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java b/systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java
index d8f9523604..00b58e01e2 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.structures/src/org/eclipse/linuxtools/systemtap/structures/UpdateManager.java
@@ -21,81 +21,81 @@ import org.eclipse.linuxtools.systemtap.structures.listeners.IUpdateListener;
public class UpdateManager {
- public UpdateManager(int delay) {
- updateListeners = new ArrayList<>();
- stopped = false;
- disposed = false;
- restart(delay);
- }
+ public UpdateManager(int delay) {
+ updateListeners = new ArrayList<>();
+ stopped = false;
+ disposed = false;
+ restart(delay);
+ }
- /**
- * @since 3.0
- */
- public void restart(int delay) {
- if (timer != null) {
- timer.cancel();
- }
- timer = new Timer("Update Manager", true); //$NON-NLS-1$
- timer.scheduleAtFixedRate(new Notify(), delay, delay);
- }
+ /**
+ * @since 3.0
+ */
+ public void restart(int delay) {
+ if (timer != null) {
+ timer.cancel();
+ }
+ timer = new Timer("Update Manager", true); //$NON-NLS-1$
+ timer.scheduleAtFixedRate(new Notify(), delay, delay);
+ }
- /**
- * Terminates the timer and removes all update listeners.
- */
- public void stop() {
- if(!stopped) {
- stopped = true;
- timer.cancel();
- synchronized (updateListeners) {
- for(int i=0; i<updateListeners.size(); i++) {
- removeUpdateListener(updateListeners.get(i));
- }
- }
- }
- }
+ /**
+ * Terminates the timer and removes all update listeners.
+ */
+ public void stop() {
+ if(!stopped) {
+ stopped = true;
+ timer.cancel();
+ synchronized (updateListeners) {
+ for(int i=0; i<updateListeners.size(); i++) {
+ removeUpdateListener(updateListeners.get(i));
+ }
+ }
+ }
+ }
- public void addUpdateListener(IUpdateListener l) {
- if(!updateListeners.contains(l)) {
- updateListeners.add(l);
- }
- }
- public void removeUpdateListener(IUpdateListener l) {
- if(updateListeners.contains(l)) {
- updateListeners.remove(l);
- }
- }
+ public void addUpdateListener(IUpdateListener l) {
+ if(!updateListeners.contains(l)) {
+ updateListeners.add(l);
+ }
+ }
+ public void removeUpdateListener(IUpdateListener l) {
+ if(updateListeners.contains(l)) {
+ updateListeners.remove(l);
+ }
+ }
- public boolean isRunning() {
- return !stopped;
- }
+ public boolean isRunning() {
+ return !stopped;
+ }
- public void dispose() {
- if(!disposed) {
- disposed = true;
- stop();
- timer = null;
- updateListeners = null;
- }
- }
+ public void dispose() {
+ if(!disposed) {
+ disposed = true;
+ stop();
+ timer = null;
+ updateListeners = null;
+ }
+ }
- /**
- * Handle any events that are timed to occur.
- */
- private class Notify extends TimerTask {
- @Override
- public void run() {
- if(!stopped) {
- synchronized (updateListeners) {
- for(int i = 0; i < updateListeners.size(); i++) {
- (updateListeners.get(i)).handleUpdateEvent();
- }
- }
- }
- }
- }
+ /**
+ * Handle any events that are timed to occur.
+ */
+ private class Notify extends TimerTask {
+ @Override
+ public void run() {
+ if(!stopped) {
+ synchronized (updateListeners) {
+ for(int i = 0; i < updateListeners.size(); i++) {
+ (updateListeners.get(i)).handleUpdateEvent();
+ }
+ }
+ }
+ }
+ }
- private Timer timer;
- private List<IUpdateListener> updateListeners;
- private boolean stopped;
- private boolean disposed;
+ private Timer timer;
+ private List<IUpdateListener> updateListeners;
+ private boolean stopped;
+ private boolean disposed;
}

Back to the top