boolean oldValue = master.loadBalancerTracker.isBalancerOn(); boolean newValue = b; try { if (mode == BalanceSwitchMode.SYNC) { synchronized (master.getLoadBalancer()) { master.loadBalancerTracker.setBalancerOn(newValue); master.loadBalancerTracker.setBalancerOn(newValue);
/** * Return true if the balance switch is on, false otherwise */ public boolean isBalancerOn() { byte [] upData = super.getData(false); try { // if data in ZK is null, use default of on. return upData == null || parseFrom(upData).getBalancerOn(); } catch (DeserializationException dex) { LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData)); // return false to be safe. return false; } }
/** * Set the balancer on/off. * * @param balancerOn true if the balancher should be on, false otherwise * @throws KeeperException if a ZooKeeper operation fails */ public void setBalancerOn(boolean balancerOn) throws KeeperException { byte [] upData = toByteArray(balancerOn); try { ZKUtil.setData(watcher, watcher.getZNodePaths().balancerZNode, upData); } catch(KeeperException.NoNodeException nne) { ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().balancerZNode, upData); } super.nodeDataChanged(watcher.getZNodePaths().balancerZNode); }
LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(), new Abortable() { AtomicBoolean aborted = new AtomicBoolean(false); l.setBalancerOn(false); LOG.debug("All meta replicas assigned");
this.normalizer.setMasterServices(this); this.normalizer.setMasterRpcServices((MasterRpcServices)rpcServices); this.loadBalancerTracker = new LoadBalancerTracker(zooKeeper, this); this.loadBalancerTracker.start();
/** * Queries the state of the {@link LoadBalancerTracker}. If the balancer is not initialized, * false is returned. * * @return The state of the load balancer, or false if the load balancer isn't defined. */ public boolean isBalancerOn() { return !isInMaintenanceMode() && loadBalancerTracker != null && loadBalancerTracker.isBalancerOn(); }
LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(), new Abortable() { AtomicBoolean aborted = new AtomicBoolean(false); l.setBalancerOn(false); LOG.debug("All meta replicas assigned");
this.normalizer = RegionNormalizerFactory.getRegionNormalizer(conf); this.normalizer.setMasterServices(this); this.loadBalancerTracker = new LoadBalancerTracker(zooKeeper, this); this.loadBalancerTracker.start(); this.regionNormalizerTracker = new RegionNormalizerTracker(zooKeeper, this); this.regionNormalizerTracker.start();
synchronized (this.balancer) { if (!this.loadBalancerTracker.isBalancerOn()) return false;
boolean oldValue = master.loadBalancerTracker.isBalancerOn(); boolean newValue = b; try { if (mode == BalanceSwitchMode.SYNC) { synchronized (master.balancer) { master.loadBalancerTracker.setBalancerOn(newValue); master.loadBalancerTracker.setBalancerOn(newValue);
builder.setBalancerOn(loadBalancerTracker.isBalancerOn());
/** * Return true if the balance switch is on, false otherwise */ public boolean isBalancerOn() { byte [] upData = super.getData(false); try { // if data in ZK is null, use default of on. return upData == null || parseFrom(upData).getBalancerOn(); } catch (DeserializationException dex) { LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData)); // return false to be safe. return false; } }
/** * Set the balancer on/off * @param balancerOn * @throws KeeperException */ public void setBalancerOn(boolean balancerOn) throws KeeperException { byte [] upData = toByteArray(balancerOn); try { ZKUtil.setData(watcher, watcher.balancerZNode, upData); } catch(KeeperException.NoNodeException nne) { ZKUtil.createAndWatch(watcher, watcher.balancerZNode, upData); } super.nodeDataChanged(watcher.balancerZNode); }
/** * Queries the state of the {@link LoadBalancerTracker}. If the balancer is not initialized, * false is returned. * * @return The state of the load balancer, or false if the load balancer isn't defined. */ public boolean isBalancerOn() { if (null == loadBalancerTracker) return false; return loadBalancerTracker.isBalancerOn(); }
/** * Return true if the balance switch is on, false otherwise */ public boolean isBalancerOn() { byte [] upData = super.getData(false); try { // if data in ZK is null, use default of on. return upData == null || parseFrom(upData).getBalancerOn(); } catch (DeserializationException dex) { LOG.error("ZK state for LoadBalancer could not be parsed " + Bytes.toStringBinary(upData)); // return false to be safe. return false; } }
/** * Set the balancer on/off. * * @param balancerOn true if the balancher should be on, false otherwise * @throws KeeperException if a ZooKeeper operation fails */ public void setBalancerOn(boolean balancerOn) throws KeeperException { byte [] upData = toByteArray(balancerOn); try { ZKUtil.setData(watcher, watcher.getZNodePaths().balancerZNode, upData); } catch(KeeperException.NoNodeException nne) { ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().balancerZNode, upData); } super.nodeDataChanged(watcher.getZNodePaths().balancerZNode); }
synchronized (this.balancer) { if (!this.loadBalancerTracker.isBalancerOn()) return false;
String[] coprocessors = cpHost != null ? getMasterCoprocessors() : null; boolean balancerOn = loadBalancerTracker != null ? loadBalancerTracker.isBalancerOn() : false; Map<ServerName, ServerLoad> onlineServers = null; Set<ServerName> deadServers = null;