mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#108 [WIP] Created new ThreadPool class with a static ScheduledThreadExecutor that is now shared by all components. Removed ThreadPoolManager from all classes. Consolidating into 1 pool seems to have reduced CPU usage by ~15-20%. Overall memory usage is also reduced.
This commit is contained in:
@@ -18,14 +18,12 @@
|
||||
******************************************************************************/
|
||||
package icon;
|
||||
|
||||
import controller.ThreadPoolManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import properties.SystemProperties;
|
||||
import util.ThreadPool;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ListDataEvent;
|
||||
import javax.swing.event.ListDataListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
@@ -54,16 +52,14 @@ public class IconManager
|
||||
private Path mIconBackupFilePath;
|
||||
private Path mIconLockFilePath;
|
||||
|
||||
private ThreadPoolManager mThreadPoolManager;
|
||||
private IconEditor mIconEditor;
|
||||
private IconTableModel mIconTableModel;
|
||||
private AtomicBoolean mSavingIcons = new AtomicBoolean();
|
||||
|
||||
private Map<String, ImageIcon> mResizedIcons = new HashMap<>();
|
||||
private Map<String,ImageIcon> mResizedIcons = new HashMap<>();
|
||||
|
||||
public IconManager(ThreadPoolManager threadPoolManager)
|
||||
public IconManager()
|
||||
{
|
||||
mThreadPoolManager = threadPoolManager;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,7 +408,7 @@ public class IconManager
|
||||
{
|
||||
if(mSavingIcons.compareAndSet(false, true))
|
||||
{
|
||||
mThreadPoolManager.scheduleOnce(new IconSaveTask(), 2, TimeUnit.SECONDS);
|
||||
ThreadPool.SCHEDULED.schedule(new IconSaveTask(), 2, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user