Example usage for org.springframework.boot.actuate.endpoint.web WebEndpointResponse STATUS_SERVICE_UNAVAILABLE

List of usage examples for org.springframework.boot.actuate.endpoint.web WebEndpointResponse STATUS_SERVICE_UNAVAILABLE

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.endpoint.web WebEndpointResponse STATUS_SERVICE_UNAVAILABLE.

Prototype

int STATUS_SERVICE_UNAVAILABLE

To view the source code for org.springframework.boot.actuate.endpoint.web WebEndpointResponse STATUS_SERVICE_UNAVAILABLE.

Click Source Link

Document

503 Service Unavailable .

Usage

From source file:org.springframework.boot.actuate.management.HeapDumpWebEndpoint.java

@ReadOperation
public WebEndpointResponse<Resource> heapDump(@Nullable Boolean live) {
    try {//from w w w .  j  av  a2s .  c  om
        if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
            try {
                return new WebEndpointResponse<>(dumpHeap((live != null) ? live : true));
            } finally {
                this.lock.unlock();
            }
        }
    } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
    } catch (IOException ex) {
        return new WebEndpointResponse<>(WebEndpointResponse.STATUS_INTERNAL_SERVER_ERROR);
    } catch (HeapDumperUnavailableException ex) {
        return new WebEndpointResponse<>(WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE);
    }
    return new WebEndpointResponse<>(WebEndpointResponse.STATUS_TOO_MANY_REQUESTS);
}