Skip to content

Commit 4523b76

Browse files
committed
improve hello world examples shutdown process
1 parent cad3d51 commit 4523b76

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

services-examples/src/main/java/io/scalecube/services/examples/helloworld/Example1.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.scalecube.services.examples.helloworld.service.GreetingServiceImpl;
77
import io.scalecube.services.examples.helloworld.service.api.GreetingsService;
88
import io.scalecube.services.transport.rsocket.RSocketServiceTransport;
9+
import reactor.core.publisher.Mono;
910

1011
/**
1112
* The Hello World project is a time-honored tradition in computer programming. It is a simple
@@ -50,7 +51,6 @@ public static void main(String[] args) {
5051
// Execute the services and subscribe to service events
5152
service.sayHello("joe").subscribe(consumer -> System.out.println(consumer.message()));
5253

53-
seed.onShutdown().block();
54-
ms.onShutdown().block();
54+
Mono.whenDelayError(seed.shutdown(), ms.shutdown()).block();
5555
}
5656
}

services-examples/src/main/java/io/scalecube/services/examples/helloworld/Example2.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public static void main(String[] args) {
7070
System.out.println(greeting.message());
7171
});
7272

73-
seed.onShutdown().block();
74-
ms.onShutdown().block();
73+
Mono.whenDelayError(seed.shutdown(), ms.shutdown()).block();
7574
}
7675
}

services-examples/src/main/java/io/scalecube/services/examples/helloworld/Example3.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.scalecube.services.examples.helloworld.service.api.BidiGreetingService;
88
import io.scalecube.services.transport.rsocket.RSocketServiceTransport;
99
import reactor.core.publisher.Flux;
10+
import reactor.core.publisher.Mono;
1011

1112
/**
1213
* The Hello World project is a time-honored tradition in computer programming. It is a simple
@@ -54,7 +55,6 @@ public static void main(String[] args) {
5455
.doOnNext(System.out::println)
5556
.blockLast();
5657

57-
seed.onShutdown().block();
58-
ms.onShutdown().block();
58+
Mono.whenDelayError(seed.shutdown(), ms.shutdown()).block();
5959
}
6060
}

0 commit comments

Comments
 (0)