public void addApplicationState(ApplicationState key, VersionedValue value) { addApplicationStates(Collections.singletonMap(key, value)); }
public void addApplicationState(ApplicationState key, VersionedValue value) { addApplicationStates(Collections.singletonMap(key, value)); }
public void addApplicationState(ApplicationState key, VersionedValue value) { addApplicationStates(Collections.singletonMap(key, value)); }
public void addApplicationState(ApplicationState key, VersionedValue value) { addApplicationStates(Collections.singletonMap(key, value)); }
public void addApplicationStates(Set<Map.Entry<ApplicationState, VersionedValue>> values) { while (true) { Map<ApplicationState, VersionedValue> orig = applicationState.get(); Map<ApplicationState, VersionedValue> copy = new EnumMap<>(orig); for (Map.Entry<ApplicationState, VersionedValue> value : values) copy.put(value.getKey(), value.getValue()); if (applicationState.compareAndSet(orig, copy)) return; } }
public void addApplicationStates(Set<Map.Entry<ApplicationState, VersionedValue>> values) { while (true) { Map<ApplicationState, VersionedValue> orig = applicationState.get(); Map<ApplicationState, VersionedValue> copy = new EnumMap<>(orig); for (Map.Entry<ApplicationState, VersionedValue> value : values) copy.put(value.getKey(), value.getValue()); if (applicationState.compareAndSet(orig, copy)) return; } }
public void addApplicationStates(Set<Map.Entry<ApplicationState, VersionedValue>> values) { while (true) { Map<ApplicationState, VersionedValue> orig = applicationState.get(); Map<ApplicationState, VersionedValue> copy = new EnumMap<>(orig); for (Map.Entry<ApplicationState, VersionedValue> value : values) copy.put(value.getKey(), value.getValue()); if (applicationState.compareAndSet(orig, copy)) return; } }
public void addApplicationStates(Set<Map.Entry<ApplicationState, VersionedValue>> values) { while (true) { Map<ApplicationState, VersionedValue> orig = applicationState.get(); Map<ApplicationState, VersionedValue> copy = new EnumMap<>(orig); for (Map.Entry<ApplicationState, VersionedValue> value : values) copy.put(value.getKey(), value.getValue()); if (applicationState.compareAndSet(orig, copy)) return; } }
@VisibleForTesting public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr) { HeartBeatState hbState = new HeartBeatState(generationNbr); EndpointState newState = new EndpointState(hbState); newState.markAlive(); EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState); EndpointState localState = oldState == null ? newState : oldState; // always add the version state Map<ApplicationState, VersionedValue> states = new EnumMap<>(ApplicationState.class); states.put(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion()); states.put(ApplicationState.HOST_ID, StorageService.instance.valueFactory.hostId(uuid)); localState.addApplicationStates(states); }
@VisibleForTesting public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr) { HeartBeatState hbState = new HeartBeatState(generationNbr); EndpointState newState = new EndpointState(hbState); newState.markAlive(); EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState); EndpointState localState = oldState == null ? newState : oldState; // always add the version state Map<ApplicationState, VersionedValue> states = new EnumMap<>(ApplicationState.class); states.put(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion()); states.put(ApplicationState.HOST_ID, StorageService.instance.valueFactory.hostId(uuid)); localState.addApplicationStates(states); }
@VisibleForTesting public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr) { HeartBeatState hbState = new HeartBeatState(generationNbr); EndpointState newState = new EndpointState(hbState); newState.markAlive(); EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState); EndpointState localState = oldState == null ? newState : oldState; // always add the version state Map<ApplicationState, VersionedValue> states = new EnumMap<>(ApplicationState.class); states.put(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion()); states.put(ApplicationState.HOST_ID, StorageService.instance.valueFactory.hostId(uuid)); localState.addApplicationStates(states); }
@VisibleForTesting public void initializeNodeUnsafe(InetAddress addr, UUID uuid, int generationNbr) { HeartBeatState hbState = new HeartBeatState(generationNbr); EndpointState newState = new EndpointState(hbState); newState.markAlive(); EndpointState oldState = endpointStateMap.putIfAbsent(addr, newState); EndpointState localState = oldState == null ? newState : oldState; // always add the version state Map<ApplicationState, VersionedValue> states = new EnumMap<>(ApplicationState.class); states.put(ApplicationState.NET_VERSION, StorageService.instance.valueFactory.networkVersion()); states.put(ApplicationState.HOST_ID, StorageService.instance.valueFactory.hostId(uuid)); localState.addApplicationStates(states); }
private void applyNewStates(InetAddress addr, EndpointState localState, EndpointState remoteState) { // don't assert here, since if the node restarts the version will go back to zero int oldVersion = localState.getHeartBeatState().getHeartBeatVersion(); localState.setHeartBeatState(remoteState.getHeartBeatState()); if (logger.isTraceEnabled()) logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr); Set<Entry<ApplicationState, VersionedValue>> remoteStates = remoteState.states(); assert remoteState.getHeartBeatState().getGeneration() == localState.getHeartBeatState().getGeneration(); localState.addApplicationStates(remoteStates); for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteStates) doOnChangeNotifications(addr, remoteEntry.getKey(), remoteEntry.getValue()); }
private void applyNewStates(InetAddress addr, EndpointState localState, EndpointState remoteState) { // don't assert here, since if the node restarts the version will go back to zero int oldVersion = localState.getHeartBeatState().getHeartBeatVersion(); localState.setHeartBeatState(remoteState.getHeartBeatState()); if (logger.isTraceEnabled()) logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr); Set<Entry<ApplicationState, VersionedValue>> remoteStates = remoteState.states(); assert remoteState.getHeartBeatState().getGeneration() == localState.getHeartBeatState().getGeneration(); localState.addApplicationStates(remoteStates); for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteStates) doOnChangeNotifications(addr, remoteEntry.getKey(), remoteEntry.getValue()); }
private void applyNewStates(InetAddress addr, EndpointState localState, EndpointState remoteState) { // don't assert here, since if the node restarts the version will go back to zero int oldVersion = localState.getHeartBeatState().getHeartBeatVersion(); localState.setHeartBeatState(remoteState.getHeartBeatState()); if (logger.isTraceEnabled()) logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr); Set<Entry<ApplicationState, VersionedValue>> remoteStates = remoteState.states(); assert remoteState.getHeartBeatState().getGeneration() == localState.getHeartBeatState().getGeneration(); localState.addApplicationStates(remoteStates); for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteStates) doOnChangeNotifications(addr, remoteEntry.getKey(), remoteEntry.getValue()); }
private void applyNewStates(InetAddress addr, EndpointState localState, EndpointState remoteState) { // don't assert here, since if the node restarts the version will go back to zero int oldVersion = localState.getHeartBeatState().getHeartBeatVersion(); localState.setHeartBeatState(remoteState.getHeartBeatState()); if (logger.isTraceEnabled()) logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ..."); Set<Entry<ApplicationState, VersionedValue>> remoteStates = remoteState.states(); assert remoteState.getHeartBeatState().getGeneration() == localState.getHeartBeatState().getGeneration(); localState.addApplicationStates(remoteStates); for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteStates) doOnChangeNotifications(addr, remoteEntry.getKey(), remoteEntry.getValue()); }
/** * Start the gossiper with the generation number, preloading the map of application states before starting */ public void start(int generationNbr, Map<ApplicationState, VersionedValue> preloadLocalStates) { buildSeedsList(); /* initialize the heartbeat state for this localEndpoint */ maybeInitializeLocalState(generationNbr); EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress()); localState.addApplicationStates(preloadLocalStates); //notify snitches that Gossiper is about to start DatabaseDescriptor.getEndpointSnitch().gossiperStarting(); if (logger.isTraceEnabled()) logger.trace("gossip started with generation {}", localState.getHeartBeatState().getGeneration()); scheduledGossipTask = executor.scheduleWithFixedDelay(new GossipTask(), Gossiper.intervalInMillis, Gossiper.intervalInMillis, TimeUnit.MILLISECONDS); }
/** * Start the gossiper with the generation number, preloading the map of application states before starting */ public void start(int generationNbr, Map<ApplicationState, VersionedValue> preloadLocalStates) { buildSeedsList(); /* initialize the heartbeat state for this localEndpoint */ maybeInitializeLocalState(generationNbr); EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress()); localState.addApplicationStates(preloadLocalStates); //notify snitches that Gossiper is about to start DatabaseDescriptor.getEndpointSnitch().gossiperStarting(); if (logger.isTraceEnabled()) logger.trace("gossip started with generation " + localState.getHeartBeatState().getGeneration()); scheduledGossipTask = executor.scheduleWithFixedDelay(new GossipTask(), Gossiper.intervalInMillis, Gossiper.intervalInMillis, TimeUnit.MILLISECONDS); }
/** * Start the gossiper with the generation number, preloading the map of application states before starting */ public void start(int generationNbr, Map<ApplicationState, VersionedValue> preloadLocalStates) { buildSeedsList(); /* initialize the heartbeat state for this localEndpoint */ maybeInitializeLocalState(generationNbr); EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress()); localState.addApplicationStates(preloadLocalStates); //notify snitches that Gossiper is about to start DatabaseDescriptor.getEndpointSnitch().gossiperStarting(); if (logger.isTraceEnabled()) logger.trace("gossip started with generation {}", localState.getHeartBeatState().getGeneration()); scheduledGossipTask = executor.scheduleWithFixedDelay(new GossipTask(), Gossiper.intervalInMillis, Gossiper.intervalInMillis, TimeUnit.MILLISECONDS); }
/** * Start the gossiper with the generation number, preloading the map of application states before starting */ public void start(int generationNbr, Map<ApplicationState, VersionedValue> preloadLocalStates) { buildSeedsList(); /* initialize the heartbeat state for this localEndpoint */ maybeInitializeLocalState(generationNbr); EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress()); localState.addApplicationStates(preloadLocalStates); //notify snitches that Gossiper is about to start DatabaseDescriptor.getEndpointSnitch().gossiperStarting(); if (logger.isTraceEnabled()) logger.trace("gossip started with generation {}", localState.getHeartBeatState().getGeneration()); scheduledGossipTask = executor.scheduleWithFixedDelay(new GossipTask(), Gossiper.intervalInMillis, Gossiper.intervalInMillis, TimeUnit.MILLISECONDS); }