@@ -67,7 +67,7 @@ public void reset() {
67
67
@ Override
68
68
public void listQueues (
69
69
ListQueuesRequest request , StreamObserver <ListQueuesResponse > responseObserver ) {
70
- Object response = responses .remove ();
70
+ Object response = responses .poll ();
71
71
if (response instanceof ListQueuesResponse ) {
72
72
requests .add (request );
73
73
responseObserver .onNext (((ListQueuesResponse ) response ));
@@ -79,7 +79,7 @@ public void listQueues(
79
79
new IllegalArgumentException (
80
80
String .format (
81
81
"Unrecognized response type %s for method ListQueues, expected %s or %s" ,
82
- response .getClass ().getName (),
82
+ response == null ? "null" : response .getClass ().getName (),
83
83
ListQueuesResponse .class .getName (),
84
84
Exception .class .getName ())));
85
85
}
@@ -88,7 +88,7 @@ public void listQueues(
88
88
@ Override
89
89
public void getQueue (
90
90
GetQueueRequest request , StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
91
- Object response = responses .remove ();
91
+ Object response = responses .poll ();
92
92
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
93
93
requests .add (request );
94
94
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -100,7 +100,7 @@ public void getQueue(
100
100
new IllegalArgumentException (
101
101
String .format (
102
102
"Unrecognized response type %s for method GetQueue, expected %s or %s" ,
103
- response .getClass ().getName (),
103
+ response == null ? "null" : response .getClass ().getName (),
104
104
com .google .cloud .tasks .v2 .Queue .class .getName (),
105
105
Exception .class .getName ())));
106
106
}
@@ -110,7 +110,7 @@ public void getQueue(
110
110
public void createQueue (
111
111
CreateQueueRequest request ,
112
112
StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
113
- Object response = responses .remove ();
113
+ Object response = responses .poll ();
114
114
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
115
115
requests .add (request );
116
116
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -122,7 +122,7 @@ public void createQueue(
122
122
new IllegalArgumentException (
123
123
String .format (
124
124
"Unrecognized response type %s for method CreateQueue, expected %s or %s" ,
125
- response .getClass ().getName (),
125
+ response == null ? "null" : response .getClass ().getName (),
126
126
com .google .cloud .tasks .v2 .Queue .class .getName (),
127
127
Exception .class .getName ())));
128
128
}
@@ -132,7 +132,7 @@ public void createQueue(
132
132
public void updateQueue (
133
133
UpdateQueueRequest request ,
134
134
StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
135
- Object response = responses .remove ();
135
+ Object response = responses .poll ();
136
136
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
137
137
requests .add (request );
138
138
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -144,15 +144,15 @@ public void updateQueue(
144
144
new IllegalArgumentException (
145
145
String .format (
146
146
"Unrecognized response type %s for method UpdateQueue, expected %s or %s" ,
147
- response .getClass ().getName (),
147
+ response == null ? "null" : response .getClass ().getName (),
148
148
com .google .cloud .tasks .v2 .Queue .class .getName (),
149
149
Exception .class .getName ())));
150
150
}
151
151
}
152
152
153
153
@ Override
154
154
public void deleteQueue (DeleteQueueRequest request , StreamObserver <Empty > responseObserver ) {
155
- Object response = responses .remove ();
155
+ Object response = responses .poll ();
156
156
if (response instanceof Empty ) {
157
157
requests .add (request );
158
158
responseObserver .onNext (((Empty ) response ));
@@ -164,7 +164,7 @@ public void deleteQueue(DeleteQueueRequest request, StreamObserver<Empty> respon
164
164
new IllegalArgumentException (
165
165
String .format (
166
166
"Unrecognized response type %s for method DeleteQueue, expected %s or %s" ,
167
- response .getClass ().getName (),
167
+ response == null ? "null" : response .getClass ().getName (),
168
168
Empty .class .getName (),
169
169
Exception .class .getName ())));
170
170
}
@@ -173,7 +173,7 @@ public void deleteQueue(DeleteQueueRequest request, StreamObserver<Empty> respon
173
173
@ Override
174
174
public void purgeQueue (
175
175
PurgeQueueRequest request , StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
176
- Object response = responses .remove ();
176
+ Object response = responses .poll ();
177
177
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
178
178
requests .add (request );
179
179
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -185,7 +185,7 @@ public void purgeQueue(
185
185
new IllegalArgumentException (
186
186
String .format (
187
187
"Unrecognized response type %s for method PurgeQueue, expected %s or %s" ,
188
- response .getClass ().getName (),
188
+ response == null ? "null" : response .getClass ().getName (),
189
189
com .google .cloud .tasks .v2 .Queue .class .getName (),
190
190
Exception .class .getName ())));
191
191
}
@@ -194,7 +194,7 @@ public void purgeQueue(
194
194
@ Override
195
195
public void pauseQueue (
196
196
PauseQueueRequest request , StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
197
- Object response = responses .remove ();
197
+ Object response = responses .poll ();
198
198
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
199
199
requests .add (request );
200
200
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -206,7 +206,7 @@ public void pauseQueue(
206
206
new IllegalArgumentException (
207
207
String .format (
208
208
"Unrecognized response type %s for method PauseQueue, expected %s or %s" ,
209
- response .getClass ().getName (),
209
+ response == null ? "null" : response .getClass ().getName (),
210
210
com .google .cloud .tasks .v2 .Queue .class .getName (),
211
211
Exception .class .getName ())));
212
212
}
@@ -216,7 +216,7 @@ public void pauseQueue(
216
216
public void resumeQueue (
217
217
ResumeQueueRequest request ,
218
218
StreamObserver <com .google .cloud .tasks .v2 .Queue > responseObserver ) {
219
- Object response = responses .remove ();
219
+ Object response = responses .poll ();
220
220
if (response instanceof com .google .cloud .tasks .v2 .Queue ) {
221
221
requests .add (request );
222
222
responseObserver .onNext (((com .google .cloud .tasks .v2 .Queue ) response ));
@@ -228,15 +228,15 @@ public void resumeQueue(
228
228
new IllegalArgumentException (
229
229
String .format (
230
230
"Unrecognized response type %s for method ResumeQueue, expected %s or %s" ,
231
- response .getClass ().getName (),
231
+ response == null ? "null" : response .getClass ().getName (),
232
232
com .google .cloud .tasks .v2 .Queue .class .getName (),
233
233
Exception .class .getName ())));
234
234
}
235
235
}
236
236
237
237
@ Override
238
238
public void getIamPolicy (GetIamPolicyRequest request , StreamObserver <Policy > responseObserver ) {
239
- Object response = responses .remove ();
239
+ Object response = responses .poll ();
240
240
if (response instanceof Policy ) {
241
241
requests .add (request );
242
242
responseObserver .onNext (((Policy ) response ));
@@ -248,15 +248,15 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver<Policy> res
248
248
new IllegalArgumentException (
249
249
String .format (
250
250
"Unrecognized response type %s for method GetIamPolicy, expected %s or %s" ,
251
- response .getClass ().getName (),
251
+ response == null ? "null" : response .getClass ().getName (),
252
252
Policy .class .getName (),
253
253
Exception .class .getName ())));
254
254
}
255
255
}
256
256
257
257
@ Override
258
258
public void setIamPolicy (SetIamPolicyRequest request , StreamObserver <Policy > responseObserver ) {
259
- Object response = responses .remove ();
259
+ Object response = responses .poll ();
260
260
if (response instanceof Policy ) {
261
261
requests .add (request );
262
262
responseObserver .onNext (((Policy ) response ));
@@ -268,7 +268,7 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver<Policy> res
268
268
new IllegalArgumentException (
269
269
String .format (
270
270
"Unrecognized response type %s for method SetIamPolicy, expected %s or %s" ,
271
- response .getClass ().getName (),
271
+ response == null ? "null" : response .getClass ().getName (),
272
272
Policy .class .getName (),
273
273
Exception .class .getName ())));
274
274
}
@@ -278,7 +278,7 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver<Policy> res
278
278
public void testIamPermissions (
279
279
TestIamPermissionsRequest request ,
280
280
StreamObserver <TestIamPermissionsResponse > responseObserver ) {
281
- Object response = responses .remove ();
281
+ Object response = responses .poll ();
282
282
if (response instanceof TestIamPermissionsResponse ) {
283
283
requests .add (request );
284
284
responseObserver .onNext (((TestIamPermissionsResponse ) response ));
@@ -290,7 +290,7 @@ public void testIamPermissions(
290
290
new IllegalArgumentException (
291
291
String .format (
292
292
"Unrecognized response type %s for method TestIamPermissions, expected %s or %s" ,
293
- response .getClass ().getName (),
293
+ response == null ? "null" : response .getClass ().getName (),
294
294
TestIamPermissionsResponse .class .getName (),
295
295
Exception .class .getName ())));
296
296
}
@@ -299,7 +299,7 @@ public void testIamPermissions(
299
299
@ Override
300
300
public void listTasks (
301
301
ListTasksRequest request , StreamObserver <ListTasksResponse > responseObserver ) {
302
- Object response = responses .remove ();
302
+ Object response = responses .poll ();
303
303
if (response instanceof ListTasksResponse ) {
304
304
requests .add (request );
305
305
responseObserver .onNext (((ListTasksResponse ) response ));
@@ -311,15 +311,15 @@ public void listTasks(
311
311
new IllegalArgumentException (
312
312
String .format (
313
313
"Unrecognized response type %s for method ListTasks, expected %s or %s" ,
314
- response .getClass ().getName (),
314
+ response == null ? "null" : response .getClass ().getName (),
315
315
ListTasksResponse .class .getName (),
316
316
Exception .class .getName ())));
317
317
}
318
318
}
319
319
320
320
@ Override
321
321
public void getTask (GetTaskRequest request , StreamObserver <Task > responseObserver ) {
322
- Object response = responses .remove ();
322
+ Object response = responses .poll ();
323
323
if (response instanceof Task ) {
324
324
requests .add (request );
325
325
responseObserver .onNext (((Task ) response ));
@@ -331,13 +331,15 @@ public void getTask(GetTaskRequest request, StreamObserver<Task> responseObserve
331
331
new IllegalArgumentException (
332
332
String .format (
333
333
"Unrecognized response type %s for method GetTask, expected %s or %s" ,
334
- response .getClass ().getName (), Task .class .getName (), Exception .class .getName ())));
334
+ response == null ? "null" : response .getClass ().getName (),
335
+ Task .class .getName (),
336
+ Exception .class .getName ())));
335
337
}
336
338
}
337
339
338
340
@ Override
339
341
public void createTask (CreateTaskRequest request , StreamObserver <Task > responseObserver ) {
340
- Object response = responses .remove ();
342
+ Object response = responses .poll ();
341
343
if (response instanceof Task ) {
342
344
requests .add (request );
343
345
responseObserver .onNext (((Task ) response ));
@@ -349,13 +351,15 @@ public void createTask(CreateTaskRequest request, StreamObserver<Task> responseO
349
351
new IllegalArgumentException (
350
352
String .format (
351
353
"Unrecognized response type %s for method CreateTask, expected %s or %s" ,
352
- response .getClass ().getName (), Task .class .getName (), Exception .class .getName ())));
354
+ response == null ? "null" : response .getClass ().getName (),
355
+ Task .class .getName (),
356
+ Exception .class .getName ())));
353
357
}
354
358
}
355
359
356
360
@ Override
357
361
public void deleteTask (DeleteTaskRequest request , StreamObserver <Empty > responseObserver ) {
358
- Object response = responses .remove ();
362
+ Object response = responses .poll ();
359
363
if (response instanceof Empty ) {
360
364
requests .add (request );
361
365
responseObserver .onNext (((Empty ) response ));
@@ -367,15 +371,15 @@ public void deleteTask(DeleteTaskRequest request, StreamObserver<Empty> response
367
371
new IllegalArgumentException (
368
372
String .format (
369
373
"Unrecognized response type %s for method DeleteTask, expected %s or %s" ,
370
- response .getClass ().getName (),
374
+ response == null ? "null" : response .getClass ().getName (),
371
375
Empty .class .getName (),
372
376
Exception .class .getName ())));
373
377
}
374
378
}
375
379
376
380
@ Override
377
381
public void runTask (RunTaskRequest request , StreamObserver <Task > responseObserver ) {
378
- Object response = responses .remove ();
382
+ Object response = responses .poll ();
379
383
if (response instanceof Task ) {
380
384
requests .add (request );
381
385
responseObserver .onNext (((Task ) response ));
@@ -387,7 +391,9 @@ public void runTask(RunTaskRequest request, StreamObserver<Task> responseObserve
387
391
new IllegalArgumentException (
388
392
String .format (
389
393
"Unrecognized response type %s for method RunTask, expected %s or %s" ,
390
- response .getClass ().getName (), Task .class .getName (), Exception .class .getName ())));
394
+ response == null ? "null" : response .getClass ().getName (),
395
+ Task .class .getName (),
396
+ Exception .class .getName ())));
391
397
}
392
398
}
393
399
}
0 commit comments