diff --git a/examples/stop-handler/stop_handler.client.out b/examples/stop-handler/stop_handler.client.out index c9034a00e2..08c1a4bde7 100644 --- a/examples/stop-handler/stop_handler.client.out +++ b/examples/stop-handler/stop_handler.client.out @@ -1,3 +1,2 @@ -# Invoke the service using cURL to add a fruit item. $ curl http://localhost:9090/addToBasket -d 'Guava' ["Apple", "Orange", "Guava"] diff --git a/examples/stop-handler/stop_handler.md b/examples/stop-handler/stop_handler.md index 4bea2219d6..7cccce26c3 100644 --- a/examples/stop-handler/stop_handler.md +++ b/examples/stop-handler/stop_handler.md @@ -1,10 +1,14 @@ # `StopHandler` -The `StopHandler` registers a function that will be called during the graceful shutdown. -This example demonstrates how to register a function that will be executed at the end of the program. +A `StopHandler` is a function that is registered at runtime with a module and invoked during graceful shutdown. +This example demonstrates how to register a `StopHandler` that will be executed at the end of the program. ::: code stop_handler.bal ::: -::: out stop_handler.client.out ::: +Navigate to the directory that contains the 'stop_handler.bal' file, and run the 'bal run' command. ::: out stop_handler.server.out ::: + +Invoke the service by executing the following cURL command in a new terminal to add a fruit item. + +::: out stop_handler.client.out ::: diff --git a/examples/stop-handler/stop_handler.server.out b/examples/stop-handler/stop_handler.server.out index 2b049db64c..191e06e938 100644 --- a/examples/stop-handler/stop_handler.server.out +++ b/examples/stop-handler/stop_handler.server.out @@ -1,10 +1,8 @@ -# Navigate to the directory that contains the -# 'stop_handler.bal' file, and run the 'bal run' command below. - $ bal run stop_handler.bal - -# Send the interrupt signal SIGINT to terminate the current process. -Ctrl+c initial items in fruit basket: ["Apple","Orange"] + +# Invoke the service using cURL command as mentioned below in a new terminal. after adding a fruit item: ["Apple","Orange","Guava"] + +# Send the interrupt signal SIGINT (Ctrl+C) to terminate the current process. after removing all fruit items: []