public synchronized void register(int port, NetworkClient client) { E.NPE(client); E.illegalArgumentIf(registry.containsKey(port), "Port %s has been registered already", port); registry.put(port, client); if (started) { clientRegistered(client, port); } }
protected Class<?> defineClass(String name, byte[] ba) { Class<?> c; _.Var<ClassWriter> cw = _.val(null); ByteCodeVisitor enhancer = enhancerManager.generalEnhancer(name, cw); if (null == enhancer) { c = defineClassX(name, ba, 0, ba.length, DOMAIN); } else { ClassWriter w = new ClassWriter(ClassWriter.COMPUTE_MAXS); cw.set(w); enhancer.commitDownstream(); ClassReader r; r = new ClassReader(ba); try { r.accept(enhancer, 0); byte[] baNew = w.toByteArray(); c = defineClassX(name, baNew, 0, baNew.length, DOMAIN); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Exception e) { throw E.unexpected("Error processing class " + name); } } return c; }
public UndertowRequest(HttpServerExchange exchange, AppConfig config) { super(config); E.NPE(exchange); hse = exchange; }