קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מספר קריאות ל-API מחזירות פעולות ממושכות. האפשרויות האלה עוקבות אחרי הסטטוס
של משימה שמתבצעת לאורך זמן ממושך, למשל
לא רצוי לחסום את RPC.
סיווג OperationFuture
הדרך הברורה ביותר לאינטראקציה עם מעבדי LRO היא
OperationFuture. אם משתמשים באפשרות הזו, צריך לוודא שלקוח השירות לא מושמד.
לא מומלץ:
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);}}
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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."]]],[]]