Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AtomixServer {
- private AtomixServerConfig config;
- private void init() throws Exception {
- this.config = JsonConfig.load(new File("./config.json"), AtomixServerConfig.class);
- Serializer serializer = new Serializer();
- serializer.registerClassLoader(DistributedGroupFactory.class.getName(), getClass().getClassLoader());
- Address address = new Address(this.config.address.host, this.config.address.port);
- ResourceServer server = ResourceServer.builder(address).withSerializer(serializer).withTransport(new NettyTransport()).build();
- server.bootstrap(address).join();
- synchronized (AtomixServer.class) {
- while (server.isRunning()) {
- getClass().wait();
- }
- }
- }
- public static void main(String ... args) {
- try {
- new AtomixServer().init();
- } catch (Exception e) {
- System.exit(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement