- boolean dispatch(final Connection conn, String name) throws Exception {
- try {
- final ClassLoader cl = getClassLoader();
- final Class c = cl.loadClass(name);
- if (c == null) return false;
- if (!(Listener.class.isAssignableFrom(c) && c != Listener.class)) return false;
- Log.info(this, "dispatching connection on port " + port + " to " + c.getName());
- new Thread(tg, new Runnable() { public void run() {
+ void dispatch(final Connection conn) throws Exception {
+ new Thread(tg, new Runnable() { public void run() {
+ try {
+ Class c = findListener();
+ if (c == null) throw new RuntimeException("couldn't find listener");
+ Log.info(this, "dispatching connection on port " + port + " to " + c.getName());