mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 00:27:26 -05:00
Revert "Merges master onto development branch"
This reverts commit 2420bc901c63ad9d41e7c99ac95a426f826182ff.
This commit is contained in:
@@ -36,20 +36,24 @@ public class ThreadPoolManager
|
||||
private HashMap<ScheduledFuture<?>,ThreadType> mTasks =
|
||||
new HashMap<ScheduledFuture<?>,ThreadType>();
|
||||
|
||||
private ScheduledExecutorService mExecutor =
|
||||
Executors.newScheduledThreadPool( THREAD_POOL_SIZE,
|
||||
new NamingThreadFactory( "sdrtrunk" ) );
|
||||
private ScheduledExecutorService mExecutor;
|
||||
|
||||
public ThreadPoolManager()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ScheduledFuture<?> scheduleFixedRate( ThreadType type,
|
||||
Runnable command,
|
||||
long period,
|
||||
TimeUnit unit )
|
||||
throws RejectedExecutionException
|
||||
{
|
||||
if( mExecutor == null )
|
||||
{
|
||||
mExecutor = Executors.newScheduledThreadPool( THREAD_POOL_SIZE,
|
||||
new NamingThreadFactory( "sdrtrunk" ) );
|
||||
}
|
||||
|
||||
ScheduledFuture<?> task =
|
||||
mExecutor.scheduleAtFixedRate( command, 0, period, unit );
|
||||
|
||||
@@ -61,16 +65,20 @@ public class ThreadPoolManager
|
||||
public void scheduleOnce( Runnable command, long delay, TimeUnit unit )
|
||||
throws RejectedExecutionException
|
||||
{
|
||||
if( mExecutor == null )
|
||||
{
|
||||
mExecutor = Executors.newScheduledThreadPool( THREAD_POOL_SIZE,
|
||||
new NamingThreadFactory( "sdrtrunk" ) );
|
||||
}
|
||||
|
||||
mExecutor.schedule( command, delay, unit );
|
||||
}
|
||||
|
||||
public boolean cancel( ScheduledFuture<?> task )
|
||||
public void cancel( ScheduledFuture<?> task )
|
||||
{
|
||||
boolean success = task.cancel( true );
|
||||
task.cancel( true );
|
||||
|
||||
mTasks.remove( task );
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public int getTaskCount( ThreadType type )
|
||||
|
||||
Reference in New Issue
Block a user