mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
DistributedMastershipStore: pupulate cache on startup
Change-Id: I64567a964c8beb63428d01f43df37968e4ac8be0
This commit is contained in:
parent
7d197c4cd8
commit
c8e19d4d68
@ -4,6 +4,7 @@ import com.google.common.base.Optional;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.hazelcast.core.IMap;
|
||||
|
||||
import org.apache.felix.scr.annotations.Activate;
|
||||
import org.apache.felix.scr.annotations.Component;
|
||||
import org.apache.felix.scr.annotations.Deactivate;
|
||||
@ -53,9 +54,18 @@ public class DistributedMastershipStore
|
||||
masters = new AbsentInvalidatingLoadingCache<>(newBuilder().build(nodeLoader));
|
||||
rawMasters.addEntryListener(new RemoteEventHandler<>(masters), true);
|
||||
|
||||
loadMasters();
|
||||
|
||||
log.info("Started");
|
||||
}
|
||||
|
||||
private void loadMasters() {
|
||||
for (byte[] keyBytes : rawMasters.keySet()) {
|
||||
final DeviceId id = deserialize(keyBytes);
|
||||
masters.refresh(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
log.info("Stopped");
|
||||
|
Loading…
x
Reference in New Issue
Block a user