public void bind(SocketAddress address, IoHandler handler, IoServiceConfig config) throws IOException { if (handler == null) throw new NullPointerException("handler"); if (address != null && !(address instanceof VmPipeAddress)) throw new IllegalArgumentException("address must be VmPipeAddress."); if (config == null) { config = getDefaultConfig(); } synchronized (boundHandlers) { if (address == null || ((VmPipeAddress) address).getPort() == 0) { for (int i = 1; i < Integer.MAX_VALUE; i++) { address = new VmPipeAddress(i); if (!boundHandlers.containsKey(address)) { break; } } } else if (boundHandlers.containsKey(address)) { throw new IOException("Address already bound: " + address); } boundHandlers.put(address, new VmPipe(this, (VmPipeAddress) address, handler, config, getListeners())); } getListeners().fireServiceActivated(this, address, handler, config); }
getListeners().fireServiceActivated(this, req.address, req.handler, req.config); } catch (IOException e) {
fireServiceActivated(session.getService(), session .getServiceAddress(), session.getHandler(), session .getServiceConfig());
channels.put(req.address, ch); getListeners().fireServiceActivated(this, req.address, req.handler, req.config); } catch (Throwable t) {