use of com.google.cloud.servicedirectory.v1.Endpoint in project wildfly-core by wildfly.
the class EndpointService method start.
/**
* {@inheritDoc}
*/
public void start(final StartContext context) throws StartException {
final Endpoint endpoint;
final EndpointBuilder builder = Endpoint.builder();
builder.setEndpointName(endpointName);
builder.setXnioWorker(workerSupplier.get());
try {
endpoint = builder.build();
} catch (IOException e) {
throw RemotingLogger.ROOT_LOGGER.couldNotStart(e);
}
// Reuse the options for the remote connection factory for now
this.endpoint = endpoint;
endpointConsumer.accept(endpoint);
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project wildfly-core by wildfly.
the class EndpointService method stop.
/**
* {@inheritDoc}
*/
public void stop(final StopContext context) {
context.asynchronous();
endpointConsumer.accept(null);
final Endpoint endpoint = this.endpoint;
this.endpoint = null;
try {
endpoint.closeAsync();
} finally {
endpoint.addCloseHandler((closed, exception) -> {
context.complete();
});
}
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project wildfly-core by wildfly.
the class HostControllerConnectionService method start.
@Override
@SuppressWarnings("deprecation")
public synchronized void start(final StartContext context) throws StartException {
final Endpoint endpoint = endpointSupplier.get();
try {
// we leave local auth enabled as an option for domain servers to use if available. elytron only configuration
// will require this to be enabled and available on the server side for servers to connect successfully.
// final OptionMap options = OptionMap.create(Options.SASL_DISALLOWED_MECHANISMS, Sequence.of(JBOSS_LOCAL_USER));
// Create the connection configuration
final ProtocolConnectionConfiguration configuration = ProtocolConnectionConfiguration.create(endpoint, connectionURI, OptionMap.EMPTY);
final String userName = this.userName != null ? this.userName : serverName;
configuration.setCallbackHandler(HostControllerConnection.createClientCallbackHandler(userName, initialAuthKey));
configuration.setConnectionTimeout(SERVER_CONNECTION_TIMEOUT);
configuration.setSslContext(sslContextSupplier.get());
this.responseAttachmentSupport = new ResponseAttachmentInputStreamSupport(scheduledExecutorSupplier.get());
// Create the connection
final HostControllerConnection connection = new HostControllerConnection(serverProcessName, userName, connectOperationID, configuration, responseAttachmentSupport, executorSupplier.get());
// Trigger the started notification based on the process state listener
final ProcessStateNotifier processService = processStateNotifierSupplier.get();
processService.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
final ControlledProcessState.State old = (ControlledProcessState.State) evt.getOldValue();
final ControlledProcessState.State current = (ControlledProcessState.State) evt.getNewValue();
if (old == ControlledProcessState.State.STARTING) {
// After starting reload has to be cleared, may still require a restart
if (current == ControlledProcessState.State.RUNNING || current == ControlledProcessState.State.RESTART_REQUIRED) {
connection.started();
} else {
IoUtils.safeClose(connection);
}
}
}
});
this.client = new HostControllerClient(serverName, connection.getChannelHandler(), connection, managementSubsystemEndpoint, executorSupplier.get());
} catch (Exception e) {
throw new StartException(e);
}
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project wildfly-core by wildfly.
the class DomainServerCommunicationServices method activate.
@Override
public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget();
final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT;
final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT;
try {
ManagementWorkerService.installService(serviceTarget);
// TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.SIMPLE
@SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.SIMPLE, endpointConfig, DEFAULTS);
ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options);
// Install the communication services
final ServiceBuilder<?> sb = serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME);
final Supplier<ExecutorService> esSupplier = Services.requireServerExecutor(sb);
final Supplier<ScheduledExecutorService> sesSupplier = sb.requires(ServerService.JBOSS_SERVER_SCHEDULED_EXECUTOR);
final Supplier<Endpoint> eSupplier = sb.requires(endpointName);
final Supplier<ProcessStateNotifier> cpsnSupplier = sb.requires(ControlledProcessStateService.INTERNAL_SERVICE_NAME);
sb.setInstance(new HostControllerConnectionService(managementURI, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint, sslContextSupplier, esSupplier, sesSupplier, eSupplier, cpsnSupplier));
sb.install();
} catch (OperationFailedException e) {
throw new ServiceRegistryException(e);
}
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project wildfly-core by wildfly.
the class RemotingHttpUpgradeService method installServices.
public static void installServices(final OperationContext context, final String remotingConnectorName, final String httpConnectorName, final ServiceName endpointName, final OptionMap connectorPropertiesOptionMap, final String saslAuthenticationFactory) {
final ServiceTarget serviceTarget = context.getServiceTarget();
final ServiceName serviceName = UPGRADE_SERVICE_NAME.append(remotingConnectorName);
final ServiceBuilder<?> sb = serviceTarget.addService(serviceName);
final Consumer<RemotingHttpUpgradeService> serviceConsumer = sb.provides(serviceName);
final Supplier<ChannelUpgradeHandler> urSupplier = sb.requires(HTTP_UPGRADE_REGISTRY.append(httpConnectorName));
final Supplier<ListenerRegistry> lrSupplier = sb.requires(RemotingServices.HTTP_LISTENER_REGISTRY);
final Supplier<Endpoint> eSupplier = sb.requires(endpointName);
final Supplier<SaslAuthenticationFactory> safSupplier = saslAuthenticationFactory != null ? sb.requires(context.getCapabilityServiceName(SASL_AUTHENTICATION_FACTORY_CAPABILITY, saslAuthenticationFactory, SaslAuthenticationFactory.class)) : null;
sb.setInstance(new RemotingHttpUpgradeService(serviceConsumer, urSupplier, lrSupplier, eSupplier, safSupplier, httpConnectorName, endpointName.getSimpleName(), connectorPropertiesOptionMap));
sb.setInitialMode(ServiceController.Mode.ACTIVE);
sb.install();
}
Aggregations