m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
blob: d864bd661f0b8e9c67d29df0d1f711cdcaa2c95c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package pl.edu.mimuw.cloudatlas.agent;

import pl.edu.mimuw.cloudatlas.agent.messages.UpdateAttributesMessage;
import pl.edu.mimuw.cloudatlas.interpreter.Main;
import pl.edu.mimuw.cloudatlas.model.PathName;
import pl.edu.mimuw.cloudatlas.model.ZMI;

public class Agent {

    public static void main(String[] args) {
        AgentConfig agentConfig = new AgentConfig();

        agentConfig.runModulesAsThreads();

        EventBus eventBus = new EventBus(agentConfig.getExecutors());
        agentConfig.runRegistry(eventBus);
        agentConfig.startNonModuleThreads(eventBus);

        String zonePath = System.getProperty("zone_path");
        String selectionStrategy = System.getProperty("Gossip.zone_strategy");
        Long queryPeriod = Long.getLong("query_period");
        Long gossipPeriod = Long.getLong("gossip_period");
        Long freshnessPeriod = Long.getLong("freshness_period");

        HierarchyConfig hierarchyConfig = new HierarchyConfig(eventBus, zonePath, selectionStrategy);
        hierarchyConfig.startQueries(queryPeriod);
        hierarchyConfig.startGossip(gossipPeriod, zonePath);
        hierarchyConfig.startCleaningGossips(freshnessPeriod);
    }
}