Skip to content

Commit

Permalink
only main is on JACNode
Browse files Browse the repository at this point in the history
  • Loading branch information
laforge49 committed Feb 7, 2013
1 parent ff84807 commit 3916302
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 86 deletions.
2 changes: 1 addition & 1 deletion console.bat → node.bat
@@ -1 +1 @@
java -classpath ..\JActor\target\classes;..\JID\target\classes;target\classes;..\JASocket\target\classes;..\JFile\target\classes;..\JAConfig\target\classes;..\slf4j-api-1.7.2.jar;..\slf4j-simple-1.7.2.jar;..\apache-sshd-0.8.0\lib\sshd-core-0.8.0.jar;..\apache-sshd-0.8.0\lib\mina-core-2.0.5.jar;..\apache-sshd-0.8.0\lib\bcprov-jdk15-140.jar;..\jline-2.10.jar;..\joda-time-2.1.jar org.agilewiki.jaconfig.KingmakerServer %1
java -classpath ..\JActor\target\classes;..\JID\target\classes;target\classes;..\JASocket\target\classes;..\JFile\target\classes;..\JAConfig\target\classes;..\slf4j-api-1.7.2.jar;..\slf4j-simple-1.7.2.jar;..\apache-sshd-0.8.0\lib\sshd-core-0.8.0.jar;..\apache-sshd-0.8.0\lib\mina-core-2.0.5.jar;..\apache-sshd-0.8.0\lib\bcprov-jdk15-140.jar;..\jline-2.10.jar;..\joda-time-2.1.jar org.agilewiki.jaconfig.JACNode %1
19 changes: 19 additions & 0 deletions src/main/java/org/agilewiki/jaconfig/JACNode.java
Expand Up @@ -24,6 +24,9 @@
package org.agilewiki.jaconfig;

import org.agilewiki.jaconfig.db.impl.ConfigServer;
import org.agilewiki.jaconfig.quorum.QuorumServer;
import org.agilewiki.jaconfig.rank.simple.SimpleRanker;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;
import org.apache.sshd.server.PasswordAuthenticator;

Expand All @@ -37,4 +40,20 @@ public JACNode(String[] args, int threadCount) throws Exception {
public PasswordAuthenticator passwordAuthenticator() {
return configServer;
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
node.startup(SimpleRanker.class, "ranker");
node.startup(QuorumServer.class, "kingmaker");
node.startup(KingmakerServer.class, ClusterManager.class.getName() + " " + HostManager.class.getName());
if (args.length == 0)
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}
19 changes: 0 additions & 19 deletions src/main/java/org/agilewiki/jaconfig/KingmakerServer.java
Expand Up @@ -23,19 +23,16 @@
*/
package org.agilewiki.jaconfig;

import org.agilewiki.jaconfig.db.impl.ConfigServer;
import org.agilewiki.jaconfig.quorum.QuorumListener;
import org.agilewiki.jaconfig.quorum.QuorumServer;
import org.agilewiki.jaconfig.quorum.SubscribeQuorum;
import org.agilewiki.jaconfig.quorum.UnsubscribeQuorum;
import org.agilewiki.jaconfig.rank.simple.SimpleRanker;
import org.agilewiki.jactor.RP;
import org.agilewiki.jasocket.JASocketFactories;
import org.agilewiki.jasocket.cluster.GetLocalServer;
import org.agilewiki.jasocket.cluster.SubscribeServerNameNotifications;
import org.agilewiki.jasocket.cluster.UnsubscribeServerNameNotifications;
import org.agilewiki.jasocket.jid.PrintJid;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;
import org.agilewiki.jasocket.server.Server;
import org.agilewiki.jasocket.server.Startup;
Expand Down Expand Up @@ -253,20 +250,4 @@ private void perform() throws Exception {
}
}
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
node.startup(SimpleRanker.class, "ranker");
node.startup(QuorumServer.class, "kingmaker");
node.startup(KingmakerServer.class, ClusterManager.class.getName() + " " + HostManager.class.getName());
if (args.length == 0)
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}
16 changes: 0 additions & 16 deletions src/main/java/org/agilewiki/jaconfig/NodeId.java
Expand Up @@ -23,9 +23,6 @@
*/
package org.agilewiki.jaconfig;

import org.agilewiki.jaconfig.db.impl.ConfigServer;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;
import org.agilewiki.jasocket.server.Server;

public class NodeId extends Server {
Expand All @@ -37,17 +34,4 @@ protected String serverName() {
} else
return "node.default";
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
node.startup(NodeId.class, "");
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}
14 changes: 0 additions & 14 deletions src/main/java/org/agilewiki/jaconfig/db/impl/ConfigServer.java
Expand Up @@ -38,8 +38,6 @@
import org.agilewiki.jasocket.cluster.ShipAgentEventToAll;
import org.agilewiki.jasocket.cluster.SubscribeServerNameNotifications;
import org.agilewiki.jasocket.jid.PrintJid;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;
import org.agilewiki.jasocket.server.Server;
import org.agilewiki.jasocket.server.ServerCommand;
import org.agilewiki.jasocket.serverNameListener.ServerNameListener;
Expand Down Expand Up @@ -590,16 +588,4 @@ public void processRequest(JLPCActor targetActor, RP rp) throws Exception {
return false;
}
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}
23 changes: 4 additions & 19 deletions src/main/java/org/agilewiki/jaconfig/quorum/QuorumServer.java
Expand Up @@ -23,7 +23,6 @@
*/
package org.agilewiki.jaconfig.quorum;

import org.agilewiki.jaconfig.JACNode;
import org.agilewiki.jaconfig.db.ConfigListener;
import org.agilewiki.jaconfig.db.SubscribeConfig;
import org.agilewiki.jaconfig.db.UnsubscribeConfig;
Expand All @@ -43,7 +42,6 @@
import org.agilewiki.jasocket.commands.StartupAgent;
import org.agilewiki.jasocket.commands.StartupAgentFactory;
import org.agilewiki.jasocket.jid.PrintJid;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;
import org.agilewiki.jasocket.server.Server;
import org.agilewiki.jasocket.server.Startup;
Expand Down Expand Up @@ -283,10 +281,10 @@ public void processResponse(AgentChannel agentChannel) throws Exception {
StartupAgent startupAgent = (StartupAgent) node().factory().newActor(
StartupAgentFactory.fac.actorType, getMailbox());
try {
startupAgent.configure(
startupEntry.initiatingServerName,
null,
startupEntry.className + " " + startupEntry.serverName + " " + startupEntry.serverArgs);
startupAgent.configure(
startupEntry.initiatingServerName,
null,
startupEntry.className + " " + startupEntry.serverName + " " + startupEntry.serverArgs);
} catch (Exception ex) {
ex.printStackTrace();
}
Expand All @@ -309,17 +307,4 @@ private void processNextStartupEntry() throws Exception {
startupQueue.removeFirst();
ProcessStartupEntry.req.sendEvent(this, this);
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
node.startup(QuorumServer.class, "quorum");
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}
17 changes: 0 additions & 17 deletions src/main/java/org/agilewiki/jaconfig/rank/simple/SimpleRanker.java
Expand Up @@ -23,13 +23,9 @@
*/
package org.agilewiki.jaconfig.rank.simple;

import org.agilewiki.jaconfig.JACNode;
import org.agilewiki.jaconfig.db.impl.ConfigServer;
import org.agilewiki.jaconfig.rank.RankerServer;
import org.agilewiki.jactor.RP;
import org.agilewiki.jasocket.cluster.ServerNames;
import org.agilewiki.jasocket.node.IntCon;
import org.agilewiki.jasocket.node.Node;

import java.util.*;

Expand Down Expand Up @@ -80,17 +76,4 @@ public void processResponse(TreeSet<String> response) throws Exception {
}
});
}

public static void main(String[] args) throws Exception {
Node node = new JACNode(args, 100);
try {
node.process();
node.startup(ConfigServer.class, "");
node.startup(SimpleRanker.class, "");
(new IntCon()).create(node);
} catch (Exception ex) {
node.mailboxFactory().close();
throw ex;
}
}
}

0 comments on commit 3916302

Please sign in to comment.