Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mithilfe der Capabilities API kann Ihre Anwendung für bestimmte API-Funktionen Ausfälle und geplante Ausfallzeiten erkennen. Mit dieser API können Sie die Ausfallzeiten Ihrer Anwendung reduzieren, indem Sie erkennen, wann eine Funktion nicht verfügbar ist, und diese dann umgehen. .
Wenn Sie beispielsweise mit der Images API die Größe von Bildern ändern, können Sie mithilfe der Capabilities API ermitteln, wann die Images API nicht verfügbar ist, und die Größenänderung dann überspringen:
Die Verfügbarkeit von Lese- und Schreibvorgängen in Datastore kann separat abgefragt werden. Im folgenden Beispiel wird gezeigt, wie die Verfügbarkeit von Schreibvorgängen in Datastore erkannt und Nutzern bei Ausfallzeiten eine Nachricht angezeigt wird:
CapabilityStatusstatus=service.getStatus(Capability.DATASTORE_WRITE).getStatus();if(status==CapabilityStatus.DISABLED){// Datastore is in read-only mode.}
Capabilities API in Java 8 verwenden
Jede Funktion wird als statische Konstante in der Capability-Klasse dargestellt, z. B. Capability.DATASTORE_WRITE.
Der Status einer Funktion kann aus CapabilitiesService.getStatus(Capability) abgerufen werden.
Jeder Zustand hat einen Status, also eine Enumeration, aus der sich die Verfügbarkeit einer Funktion ergibt: entweder ENABLED oder DISABLED. Im Folgenden finden Sie eine Liste der Dienste, die derzeit in dieser API aktiviert sind.
Unterstützte Funktionen
Die API unterstützt zurzeit die folgenden Funktionen:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThe Capabilities API allows applications to detect outages and scheduled downtime for specific API capabilities, helping to minimize application downtime by bypassing unavailable services.\u003c/p\u003e\n"],["\u003cp\u003eThis API supports first-generation runtimes and can be utilized when upgrading to corresponding second-generation runtimes, with specific migration guidance provided for Java 11/17 runtimes.\u003c/p\u003e\n"],["\u003cp\u003eThe API returns an \u003ccode\u003eENABLED\u003c/code\u003e status for all services except "Datastore writes," which returns \u003ccode\u003eDISABLED\u003c/code\u003e when Datastore is in read-only mode.\u003c/p\u003e\n"],["\u003cp\u003eYou can query the availability of Datastore reads and writes separately, enabling you to handle read-only mode scenarios by displaying a custom message to users.\u003c/p\u003e\n"],["\u003cp\u003eThe API can verify the status of services like BLOBSTORE, Datastore, Images, Mail, Memcache, Task Queue, and URL Fetch, allowing for more fault-tolerant applications.\u003c/p\u003e\n"]]],[],null,["# Capabilities API for legacy bundled services\n\nWith the Capabilities API, your application can detect outages and scheduled\ndowntime for specific [API capabilities](#Supported_capabilities). You can use\nthis API to reduce downtime in your application by detecting when a capability\nis unavailable and then bypassing it. .\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| java-gen2\n|\n| /services/access). If you are updating to the App Engine Java 11/17 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/java-differences) to learn about your migration options for legacy bundled services.\n| Every status request to this API always returns `ENABLED` except\n| for the \"Datastore writes\" capability, which returns `DISABLED` if\n| Datastore is in read-only mode for your app.\n\nFor example, if you use the Images API to resize images, you can use the\nCapabilities API to detect when the Images API is unavailable and skip the\nresize: \n\n import com.google.appengine.api.capabilities.*;\n\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesService.html service =\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesServiceFactory.html.getCapabilitiesService();\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilityStatus.html status = service.https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilitiesService.html#com_google_appengine_api_capabilities_CapabilitiesService_getStatus_com_google_appengine_api_capabilities_Capability_(Capability.IMAGES).getStatus();\n\n if (status == https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.capabilities.CapabilityStatus.html.DISABLED) {\n // Images API is not available.\n }\n\nYou can separately query for the availability of Datastore reads and writes. The\nfollowing sample shows how to detect the availability of Datastore writes and,\nduring downtime, provide a message to users: \n\n CapabilityStatus status =\n service.getStatus(Capability.DATASTORE_WRITE).getStatus();\n\n if (status == CapabilityStatus.DISABLED) {\n // Datastore is in read-only mode.\n }\n\nUsing the Capabilities API in Java 8\n------------------------------------\n\nEach Capability is represented as a static constant on the Capability class,\nsuch as\n[`Capability.DATASTORE_WRITE`](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/capabilities/Capability#DATASTORE_WRITE).\nEach Capability has a state, which you can retrieve from\n[`CapabilitiesService.getStatus(Capability)`](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/capabilities/CapabilitiesService#getStatus-com.google.appengine.api.capabilities.Capability-).\nEach state has a status, which is an enumeration reflecting a the availability\nof a capability: either `ENABLED` or `DISABLED`. See below for the\n[list of services](#Supported_capabilities) currently enabled in this API.\n\nSupported capabilities\n----------------------\n\nThe API currently supports the following capabilities:"]]