private SelectorThread newSelector(GrizzlyAdapter adapter) { SelectorThread selectorThread = new SelectorThread(); Location location = getLocation(); if (location != null) { selectorThread.setInet(location.toInetAddress()); selectorThread.setPort(location.getPort()); } selectorThread.setKeepAliveTimeoutInSeconds(keepAliveSeconds); selectorThread.setCoreThreads(coreThreads); selectorThread.setMaxThreads(maxThreads); selectorThread.setAdapter(adapter); try { selectorThread.initEndpoint(); } catch (Exception e) { throw new RemotingException( this + " failed to set up selector thread " + selectorThread + " against " + adapter + "!", e); } return selectorThread; }