/** * Returns a newly-created {@link CentralDogma} server. */ public CentralDogma build() { return new CentralDogma(buildConfig(), securityConfig); }
@Override protected CompletionStage<Void> doStart() throws Exception { return execute("startup", CentralDogma.this::doStart); }
@Override public int replicaId() { return cfg.serverId(); }
@Override protected void configure(CentralDogmaBuilder builder) { builder.authProviderFactory(new SamlAuthProviderFactory()); builder.authProviderProperties(PROPERTIES); builder.webAppEnabled(true); } };
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param port the TCP/IP port number * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(int port, SessionProtocol protocol) { return port(new ServerPort(port, protocol)); }
@Override protected void configure(CentralDogmaBuilder builder) { super.configure(builder); builder.gracefulShutdownTimeout(new GracefulShutdownTimeout(1000, 2000)); } };
@Override protected void configure(CentralDogmaBuilder builder) { builder.mirroringEnabled(true); builder.maxNumFilesPerMirror(MAX_NUM_FILES); builder.maxNumBytesPerMirror(MAX_NUM_BYTES); } };
@Override protected void configure(CentralDogmaBuilder builder) { // Set up a cluster of two replicas where the second replica is always unavailable, final int quorumPort = InstanceSpec.getRandomPort(); final int electionPort = InstanceSpec.getRandomPort(); final int clientPort = InstanceSpec.getRandomPort(); builder.replication(new ZooKeeperReplicationConfig( 1, ImmutableMap.of(1, new ZooKeeperAddress("127.0.0.1", quorumPort, electionPort, clientPort), 2, new ZooKeeperAddress("127.0.0.1", 1, 1, 1)))); } };
/** * Returns a newly-created {@link CentralDogma} server. */ public CentralDogma build() { return new CentralDogma(buildConfig()); }
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param port the TCP/IP port number * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(int port, SessionProtocol protocol) { return port(new ServerPort(port, protocol)); }
@Override protected CompletionStage<Void> doStop() throws Exception { return execute("shutdown", CentralDogma.this::doStop); }
@Override public int replicaId() { return cfg.serverId(); }
/** * Returns a newly-created {@link CentralDogma} server. */ public CentralDogma build() { return new CentralDogma(buildConfig()); }
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param port the TCP/IP port number * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(int port, SessionProtocol protocol) { return port(new ServerPort(port, protocol)); }
@Override protected CompletionStage<Void> doStop() throws Exception { return execute("shutdown", CentralDogma.this::doStop); }
@Override public int replicaId() { return cfg.serverId(); }
/** * Adds a port that serves the HTTP requests. If unspecified, cleartext HTTP on port 36462 is used. * * @param localAddress the TCP/IP load address to bind * @param protocol {@link SessionProtocol#HTTP} or {@link SessionProtocol#HTTPS} */ public CentralDogmaBuilder port(InetSocketAddress localAddress, SessionProtocol protocol) { return port(new ServerPort(localAddress, protocol)); }
@Override protected CompletionStage<Void> doStop() throws Exception { return execute("shutdown", CentralDogma.this::doStop); }
@Override protected CompletionStage<Void> doStart() throws Exception { return execute("startup", () -> { try { CentralDogma.this.doStart(); } catch (Exception e) { Exceptions.throwUnsafely(e); } }); }
@Override protected CompletionStage<Void> doStart() throws Exception { return execute("startup", () -> { try { CentralDogma.this.doStart(); } catch (Exception e) { Exceptions.throwUnsafely(e); } }); }