]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - vtk/src/vtk/vtkJavaGarbageCollector.java
Perform view direction switching via vtkCameraAndSelectorAction
[simantics/3d.git] / vtk / src / vtk / vtkJavaGarbageCollector.java
index fe39506fb18f42c02d5b05008c8f8c6e03997bb2..40b762b9d7ede65e5703bb4498d6b8142f42bc8a 100644 (file)
@@ -15,105 +15,105 @@ import javax.swing.SwingUtilities;
  */
 public class vtkJavaGarbageCollector {
 
-    private ScheduledExecutorService executor;
-    private Runnable deleteRunnable;
-    private Runnable deferredEdtRunnable;
-    private long periodTime;
-    private TimeUnit timeUnit;
-    private boolean autoCollectionRunning;
-    private boolean debug;
+  private ScheduledExecutorService executor;
+  private Runnable deleteRunnable;
+  private Runnable deferredEdtRunnable;
+  private long periodTime;
+  private TimeUnit timeUnit;
+  private boolean autoCollectionRunning;
+  private boolean debug;
 
-    /**
-     * Build a garbage collector which is configured to garbage collect every
-     * seconds but has not been started yet. The user has to call
-     * SetAutoGarbageCollection(true) to make it start.
-     */
-    public vtkJavaGarbageCollector() {
-        // Default settings
-        debug = false;
-        periodTime = 1;
-        timeUnit = TimeUnit.SECONDS;
-        autoCollectionRunning = false;
-        //
-        executor = Executors.newSingleThreadScheduledExecutor();
-        deleteRunnable = new Runnable() {
+  /**
+   * Build a garbage collector which is configured to garbage collect every
+   * seconds but has not been started yet. The user has to call
+   * SetAutoGarbageCollection(true) to make it start.
+   */
+  public vtkJavaGarbageCollector() {
+    // Default settings
+    debug = false;
+    periodTime = 1;
+    timeUnit = TimeUnit.SECONDS;
+    autoCollectionRunning = false;
+    //
+    executor = Executors.newSingleThreadScheduledExecutor();
+    deleteRunnable = new Runnable() {
 
-            public void run() {
-                // Do the delete here
-                vtkReferenceInformation info = vtkObject.JAVA_OBJECT_MANAGER.gc(debug);
-                if (debug) {
-                    System.out.println(info);
-                    System.out.println(info.listKeptReferenceToString());
-                    System.out.println(info.listRemovedReferenceToString());
-                }
-            }
-        };
-        deferredEdtRunnable = new Runnable() {
+      public void run() {
+        // Do the delete here
+        vtkReferenceInformation info = vtkObjectBase.JAVA_OBJECT_MANAGER.gc(debug);
+        if (debug) {
+          System.out.println(info);
+          System.out.println(info.listKeptReferenceToString());
+          System.out.println(info.listRemovedReferenceToString());
+        }
+      }
+    };
+    deferredEdtRunnable = new Runnable() {
 
-            public void run() {
-                SwingUtilities.invokeLater(deleteRunnable);
-            }
-        };
-    }
+      public void run() {
+        SwingUtilities.invokeLater(deleteRunnable);
+      }
+    };
+  }
 
-    /**
-     * Set the schedule time that should be used to send a garbage collection
-     * request to the EDT.
-     *
-     * @param period
-     * @param timeUnit
-     */
-    public void SetScheduleTime(long period, TimeUnit timeUnit) {
-        this.periodTime = period;
-        this.timeUnit = timeUnit;
-        SetAutoGarbageCollection(autoCollectionRunning);
-    }
+  /**
+   * Set the schedule time that should be used to send a garbage collection
+   * request to the EDT.
+   *
+   * @param period
+   * @param timeUnit
+   */
+  public void SetScheduleTime(long period, TimeUnit timeUnit) {
+    this.periodTime = period;
+    this.timeUnit = timeUnit;
+    SetAutoGarbageCollection(autoCollectionRunning);
+  }
 
-    /**
-     * Whether to print out when garbage collection is run.
-     *
-     * @param debug
-     */
-    public void SetDebug(boolean debug) {
-        this.debug = debug;
-    }
+  /**
+   * Whether to print out when garbage collection is run.
+   *
+   * @param debug
+   */
+  public void SetDebug(boolean debug) {
+    this.debug = debug;
+  }
 
-    /**
-     * Start or stop the automatic garbage collection in the EDT.
-     *
-     * @param doGarbageCollectionInEDT
-     */
-    public void SetAutoGarbageCollection(boolean doGarbageCollectionInEDT) {
-        autoCollectionRunning = doGarbageCollectionInEDT;
-        executor.shutdown();
-        if (doGarbageCollectionInEDT) {
-            executor = Executors.newSingleThreadScheduledExecutor();
-            executor.scheduleAtFixedRate(deferredEdtRunnable, periodTime, periodTime, timeUnit);
-        }
+  /**
+   * Start or stop the automatic garbage collection in the EDT.
+   *
+   * @param doGarbageCollectionInEDT
+   */
+  public void SetAutoGarbageCollection(boolean doGarbageCollectionInEDT) {
+    autoCollectionRunning = doGarbageCollectionInEDT;
+    executor.shutdown();
+    if (doGarbageCollectionInEDT) {
+      executor = Executors.newSingleThreadScheduledExecutor();
+      executor.scheduleAtFixedRate(deferredEdtRunnable, periodTime, periodTime, timeUnit);
     }
+  }
 
-    /**
-     * Shortcut for SetAutoGarbageCollection(true)
-     * @see SetAutoGarbageCollection
-     */
-    public void Start() {
-        this.SetAutoGarbageCollection(true);
-    }
+  /**
+   * Shortcut for SetAutoGarbageCollection(true)
+   * @see SetAutoGarbageCollection
+   */
+  public void Start() {
+    this.SetAutoGarbageCollection(true);
+  }
 
-    /**
-     * Shortcut for SetAutoGarbageCollection(false)
-     * @see SetAutoGarbageCollection
-     */
-    public void Stop() {
-        this.SetAutoGarbageCollection(false);
-    }
+  /**
+   * Shortcut for SetAutoGarbageCollection(false)
+   * @see SetAutoGarbageCollection
+   */
+  public void Stop() {
+    this.SetAutoGarbageCollection(false);
+  }
 
-    /**
-     * @return the runnable that do the garbage collection. This could be used
-     *         if you want to execute the garbage collection in another thread
-     *         than the EDT.
-     */
-    public Runnable GetDeleteRunnable() {
-        return deleteRunnable;
-    }
+  /**
+   * @return the runnable that do the garbage collection. This could be used
+   *         if you want to execute the garbage collection in another thread
+   *         than the EDT.
+   */
+  public Runnable GetDeleteRunnable() {
+    return deleteRunnable;
+  }
 }