use of org.graylog2.rest.resources.system.RemoteSystemShutdownResource in project graylog2-server by Graylog2.
the class ClusterSystemShutdownResource method shutdown.
@POST
@Timed
@ApiOperation(value = "Shutdown node gracefully.", notes = "Attempts to process all buffered and cached messages before exiting, " + "shuts down inputs first to make sure that no new messages are accepted.")
@AuditEvent(type = AuditEventTypes.NODE_SHUTDOWN_INITIATE)
public void shutdown(@ApiParam(name = "nodeId", value = "The id of the node to shutdown.", required = true) @PathParam("nodeId") String nodeId) throws IOException, NodeNotFoundException {
final Node targetNode = nodeService.byNodeId(nodeId);
RemoteSystemShutdownResource remoteSystemShutdownResource = remoteInterfaceProvider.get(targetNode, this.authenticationToken, RemoteSystemShutdownResource.class);
final Response response = remoteSystemShutdownResource.shutdown().execute();
if (response.code() != ACCEPTED.getCode()) {
LOG.warn("Unable send shut down signal to node {}: {}", nodeId, response.message());
throw new WebApplicationException(response.message(), BAD_GATEWAY);
}
}
Aggregations