Czy chcesz podzielić się opinią na temat interfejsu Google Ads API? Zarejestruj się, aby otrzymać zaproszenie do udziału w badaniach opinii użytkowników.
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Kilka wywołań interfejsu API zwraca długotrwałe operacje. które śledzą stan
zadania, które jest wykonywane przez dłuższy czas, np.
jest niepożądane.
Klasa operacji przyszłej
Najbardziej typowy sposób interakcji z pozostałymi osobami to
OperationFuture. Jeśli użyjesz tego rozwiązania, upewnij się, że klient usługi nie został zniszczony.
Niezalecane:
privatevoiddoSomething(){OperationFuture<Empty,Empty>future=startLongRunningOperation(jobName);future.get();}privateOperationFuture<Empty,Empty>startLongRunningOperation(StringjobToStart)throwsUnsupportedEncodingException{try(OfflineUserDataJobServiceClientofflineUserDataJobServiceClient=googleAdsClient.getLatestVersion().createOfflineUserDataJobServiceClient()){// Issues an asynchronous request to run the offline user data job for executing// all added operations.returnofflineUserDataJobServiceClient.runOfflineUserDataJobAsync(jobToStart);}}
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2024-10-14 UTC."],[[["Several API calls initiate long-running operations, tracked by jobs that execute over time, making blocking RPCs undesirable."],["The `OperationFuture` class facilitates interaction with long-running operations, but requires the service client to remain active during its usage."],["Directly using `OperationFuture` within a method without ensuring the service client's lifespan can lead to issues."],["It's recommended to utilize `OperationFuture` within the scope of the service client, as demonstrated in the \"Recommended\" code example, to prevent premature client destruction."]]],[]]