use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class ProcessStarter method main.
public static void main(String[] args) throws InterruptedException, IOException {
BackOffStrategy.SLEEP_NANOS = 10 * 1000 * 1000;
final ProcessStarterArgs options = new ProcessStarterArgs();
final JCommander jCommander = new JCommander(options);
jCommander.parse(args);
if (options.isHelp()) {
jCommander.usage();
System.exit(0);
}
options.underride(locateProps(0, new File("./"), "troll.properties"));
ProcessStarter ps = Actors.AsActor(ProcessStarter.class);
ps.init(options);
new TCPNIOPublisher().port(options.getPort()).facade(ps).publish(act -> {
System.out.println("Discon " + act);
}).then((r, e) -> {
if (e == null) {
System.out.println("started demon on all nics port " + options.getPort() + " sibling expected on " + options.getSiblingHost() + ":" + options.getSiblingPort());
} else {
System.out.println("error connecting " + e);
}
});
// testing
// ProcessStarter remote = (ProcessStarter) new TCPConnectable(ProcessStarter.class,options.getHost(),options.getPort()).connect( (x,y) -> System.out.println("client disc "+x)).await();
// ProcessInfo bash = remote.startProcess("/tmp", Collections.emptyMap(), "bash", "-c", "xclock -digital").await();
//
// List<ProcessInfo> procs = remote.getProcesses().await();
// procs.forEach( proc -> System.out.println(proc));
//
// Thread.sleep(3000);
//
//
// Object await = remote.terminateProcess(bash.getId(), true, 15).await();
// System.out.println("term result "+await);
// http://stackoverflow.com/questions/5740390/printing-my-macs-serial-number-in-java-using-unix-commands/5740673#5740673
// http://stackoverflow.com/questions/1980671/executing-untokenized-command-line-from-java/1980921#1980921
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class MyServiceServerImpl method main.
public static void main(String[] a) {
// give large queue to service
MyServiceInterface myService = Actors.AsActor(MyServiceServerImpl.class, 128_000);
new TCPNIOPublisher().facade(myService).port(6789).serType(SerializerType.FSTSer).publish().await();
System.out.println("server started on " + 6789);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class ReconnectTest method test.
@Test
@Ignore
public void test() throws InterruptedException {
ServiceA serviceA = Actors.AsActor(ServiceA.class);
new TCPNIOPublisher(serviceA, 5678).publish(actor -> System.out.println("server side discon " + actor));
ClientA cl = Actors.AsActor(ClientA.class);
cl.init(5678);
Thread.sleep(Integer.MAX_VALUE);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class ReconnectTest method runService.
@Test
@Ignore
public void runService() throws InterruptedException {
ServiceA serviceA = Actors.AsActor(ServiceA.class);
new TCPNIOPublisher(serviceA, 5678).publish(actor -> System.out.println("server side discon " + actor));
Thread.sleep(Integer.MAX_VALUE);
}
use of org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher in project kontraktor by RuedigerMoeller.
the class RemotingPlayground method main.
public static void main(String[] args) {
AServ server = Actors.AsActor(AServ.class);
TCPNIOPublisher publisher = new TCPNIOPublisher(server, 5678);
publisher.publish(actor -> System.out.println("actor " + actor + " disconnected")).await();
AServ client = (AServ) new TCPConnectable(AServ.class, "localhost", 5678).connect().await();
client.pingme();
}
Aggregations