private final List<StatusChangeCallback> sc_callbacks = Collections.synchronizedList(new ArrayList<StatusChangeCallback>());
private StatusChangeConnection(InetAddress server, int port)
{
super(server, port, false);
ThreadPoolCreator tp_creator = new ThreadPoolCreator() {
public ThreadObjectFactory getThreadObjectFactory() {
return new ThreadObjectFactory() {
@Override
public void initialiseThread(Thread thread)
{
thread.setName("StatusChange");
}
@Override
public void activateThread(Thread thread)
{
}
@Override
public void passivateThread(Thread thread)
{
}
};
}
public Config getThreadPoolConfig() {
Config config = new Config();
config.maxActive = 10;
config.minIdle = 2;
config.maxIdle = 5;
config.testOnBorrow = false;
config.testOnReturn = true;
config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
config.maxWait = -1;
return config;
}
public String getThreadPoolName() {
return "StatusChangePool";
}
};
sc_callback_pool = new ThreadPool(tp_creator.getThreadObjectFactory(), tp_creator.getThreadPoolConfig());
}