final MemoryManager mm = grizzlyListener.transport.getMemoryManager();
if (mm instanceof AbstractMemoryManager) {
amm = (AbstractMemoryManager) mm;
}
listeners.add(grizzlyListener);
final Thread thread = new DefaultWorkerThread(Grizzly.DEFAULT_ATTRIBUTE_BUILDER,
grizzlyListener.getName(),
amm != null ? amm.createThreadLocalPool() : null,
new ListenerRunnable(grizzlyListener));
thread.setDaemon(true);
thread.start();
}
try {
Thread.sleep(1000); // wait for the system to finish setting up the listener
} catch (InterruptedException e) {
logger.warning(e.getMessage());