Mercurial > hg > Database > Alice
view src/main/java/alice/topology/node/TopologyNodeConfig.java @ 518:fc313323c53b dispose
add reconnect event
author | sugi |
---|---|
date | Thu, 22 Jan 2015 16:01:32 +0900 |
parents | 7be9054f7465 |
children | 145c425db88d |
line wrap: on
line source
package alice.topology.node; import java.util.ArrayList; import alice.daemon.Config; @SuppressWarnings("rawtypes") public class TopologyNodeConfig extends Config { private String managerHostName; private int managerPort = 10000; public String cookie; private ArrayList<Class> eventList = new ArrayList<Class>(); public TopologyNodeConfig(String[] args) { super(args); for (int i = 0; i< args.length; i++) { if ("-host".equals(args[i])) { setManagerHostName(args[++i]); } else if ("-port".equals(args[i])) { setManagerPort(Integer.parseInt(args[++i])); } else if ("-cookie".equals(args[i])) { cookie = args[++i]; } } } public String getManagerHostName() { return managerHostName; } public void setManagerHostName(String managerHostName) { this.managerHostName = managerHostName; } public int getManagerPort() { return managerPort; } public void setManagerPort(int managerPort) { this.managerPort = managerPort; } public void register(Class clazz) { if ("CodeSegment".equals(clazz.getSuperclass().getSimpleName())) eventList.add(clazz); } public void executeEvent() { for (Class clazz : eventList) try { clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } }