// Unauthorizing public APIs for non-control nodes. @Override protected AbstractRequestWrapper authenticate(final ServletRequest servletRequest) { HttpServletRequest req = (HttpServletRequest) servletRequest; _log.debug("Is node control node? " + _coordinatorclientext.isControlNode()); if (!_coordinatorclientext.isControlNode()) { _log.info("URI is not allowed: " + req.getRequestURI()); throw APIException.unauthorized.methodNotAllowedOnThisNode(); } return null; }
@Override public void start() throws Exception { if (_app != null) { initThreadUncaughtExceptionHandler(); initServer(); initSysClientFactory(); _server.start(); // only data node needs to poll the cluster's address change if (!_coordinator.isControlNode()) { _clusterPoller.start(); } startNewVersionCheck(); startUpgradeManager(); startSecretsManager(); startPropertyManager(); startVdcManager(); startIpReconfigManager(); // config cassandra as client mode to avoid load yaml file Config.setClientMode(true); DrUtil drUtil = _coordinator.getDrUtil(); if (drUtil.isActiveSite()) { _recoveryMgr.init(); startSystemAudit(_dbClient); } _svcBeacon.start(); if (drUtil.isActiveSite()) { startNetworkMonitor(); } } else { throw new Exception("No app found."); } }
private void stopNewVersionCheck() { if (_coordinator.isControlNode()) { RemoteRepository.stopRemoteRepositoryCacheUpdate(); } }
private void startNewVersionCheck() { if (_coordinator.isControlNode()) { RemoteRepository.setCoordinator(_coordinator); RemoteRepository.startRemoteRepositoryCacheUpdate(); } }