/** * @param address self server address * @param portPublic self server port * @param cluster self server port * @param displayName self server display name * @param machinePort index used to calculate the machine hash */ public BartenderBuilderHeartbeat(Config config) { Objects.requireNonNull(config); _config = config; String address = config.get("server.address", "127.0.0.1"); int port = config.get("server.port", int.class, 8080); int machinePort = port; int portPublic = port; int portBartender = 0; boolean isSSL = false; String displayName = address + ":" + port; String cluster = config.get("server.cluster", "cluster"); ServerHeartbeatBuilder selfBuilder = new ServerHeartbeatBuilder(); String machineHash = createUniqueServerHash(machinePort); _root = new RootHeartbeat( address, portPublic, isSSL, portBartender, cluster, displayName, machineHash, selfBuilder); }
@Override public BartenderSystem build() { if (getServerSelf() == null) { throw new IllegalStateException(L.l("serverSelf is required")); } if (_config.get("bartender.seed.servers") != null) { return BartenderSystemFull.createAndAddSystem(this); } else { return BartenderSystemBare.createAndAddSystem(this); } }