private synchronized boolean checkForAuth(ProtocolHandler handler) { if (isReadyOnly()) { throw new UnsupportedOperationException("Read-Only"); } if (handler instanceof AuthHook) { // check if we need to add the AuthCmdHandler List<ExtensibleHandler> handlers = getHandlers(ExtensibleHandler.class); for (ExtensibleHandler h: handlers) { if (h.getMarkerInterfaces().contains(AuthHook.class)) { return true; } } if (!add(new AuthCmdHandler())) { return false; } } return true; }