Resolves #165 - P25 decoding channel stops arbitrarily and never recovers.

Issue identified with Patch Group management and circular dependencies that can develop because of stale patch groups.  Refactored all patch group management into a new PatchGroupManager.  Patch groups are now automatically deleted if we don't receive any update messages within 5 seconds.  The PatchGroupAlias was also updated to not roll-up attributes from subordinate patched group aliases when those aliases are also patch group aliases -- this eliminates the circular dependency chaining.

Added IOverflowListener interface and updated Sources to support overflow listeners.  Updated ChannelState to register as an overflow listener so that it can visually depict to the user when the channel enters/exits source overflow state.  Added new color pattern for OVERFLOW with yellow text on red.
This commit is contained in:
Denny
2017-02-10 06:36:57 -05:00
parent 767b302ed7
commit 183eb2f7c7
17 changed files with 615 additions and 354 deletions

View File

@@ -1,5 +1,9 @@
package controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.ThreadPool;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
@@ -8,24 +12,23 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
public class NamingThreadFactory implements ThreadFactory
{
static final AtomicInteger poolNumber = new AtomicInteger(1);
private final static Logger mLog = LoggerFactory.getLogger(ThreadPool.class);
private static final AtomicInteger mPoolNumber = new AtomicInteger(1);
final ThreadGroup mThreadGroup;
private final ThreadGroup mThreadGroup;
final AtomicInteger mThreadNumber = new AtomicInteger(1);
private final AtomicInteger mThreadNumber = new AtomicInteger(1);
final String mNamePrefix;
private final String mNamePrefix;
public NamingThreadFactory( String prefix )
{
SecurityManager s = System.getSecurityManager();
mThreadGroup = (s != null)? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
mThreadGroup = (s != null)? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
mNamePrefix = prefix + " pool-" +
poolNumber.getAndIncrement() +
"-thread-";
mNamePrefix = prefix + " pool-" + mPoolNumber.getAndIncrement() + "-thread-";
}
public Thread newThread( Runnable runnable )
@@ -42,7 +45,16 @@ public class NamingThreadFactory implements ThreadFactory
{
thread.setPriority( Thread.NORM_PRIORITY );
}
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
{
@Override
public void uncaughtException(Thread t, Throwable e)
{
mLog.error("Error while executing runnable in scheduled thread pool [" + t.getName() + "]", e);
}
});
return thread;
}
}