@@ -308,38 +308,32 @@ protected CompletionStage<Void> cleanDb() {
308
308
}
309
309
310
310
protected static CompletionStage <Void > closeSession (Object closable ) {
311
- if ( closable instanceof CompletionStage <?> ) {
312
- CompletionStage <?> closableStage = (CompletionStage <?>) closable ;
311
+ if ( closable instanceof CompletionStage <?> closableStage ) {
313
312
return closableStage .thenCompose ( BaseReactiveTest ::closeSession );
314
313
}
315
- if ( closable instanceof Uni <?> ) {
316
- Uni <?> closableUni = (Uni <?>) closable ;
314
+ if ( closable instanceof Uni <?> closableUni ) {
317
315
return closableUni .subscribeAsCompletionStage ()
318
316
.thenCompose ( BaseReactiveTest ::closeSession );
319
317
}
320
- if ( closable instanceof ReactiveConnection ) {
321
- return ( ( ReactiveConnection ) closable ) .close ();
318
+ if ( closable instanceof ReactiveConnection reactiveConnection ) {
319
+ return reactiveConnection .close ();
322
320
}
323
- if ( closable instanceof Mutiny .Session ) {
324
- Mutiny .Session mutiny = (Mutiny .Session ) closable ;
321
+ if ( closable instanceof Mutiny .Session mutiny ) {
325
322
if ( mutiny .isOpen () ) {
326
323
return mutiny .close ().subscribeAsCompletionStage ();
327
324
}
328
325
}
329
- if ( closable instanceof Stage .Session ) {
330
- Stage .Session stage = (Stage .Session ) closable ;
326
+ if ( closable instanceof Stage .Session stage ) {
331
327
if ( stage .isOpen () ) {
332
328
return stage .close ();
333
329
}
334
330
}
335
- if ( closable instanceof Mutiny .StatelessSession ) {
336
- Mutiny .StatelessSession mutiny = (Mutiny .StatelessSession ) closable ;
331
+ if ( closable instanceof Mutiny .StatelessSession mutiny ) {
337
332
if ( mutiny .isOpen () ) {
338
333
return mutiny .close ().subscribeAsCompletionStage ();
339
334
}
340
335
}
341
- if ( closable instanceof Stage .StatelessSession ) {
342
- Stage .StatelessSession stage = (Stage .StatelessSession ) closable ;
336
+ if ( closable instanceof Stage .StatelessSession stage ) {
343
337
if ( stage .isOpen () ) {
344
338
return stage .close ();
345
339
}
0 commit comments