diff --git a/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java index c771c4a9..635bb052 100644 --- a/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java +++ b/examples/config/changes/src/main/java/io/helidon/examples/config/changes/OnChangeExample.java @@ -54,7 +54,7 @@ public void run() { private static void logSecrets(Config secrets) { LOGGER.info("Loaded secrets are u: " + secrets.get("username").asString().get() - + ", p: " + secrets.get("changeit").asString().get()); + + ", p: " + secrets.get("password").asString().get()); } } diff --git a/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java index d058cf65..226c9e34 100644 --- a/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java +++ b/examples/config/sources/src/main/java/io/helidon/examples/config/sources/DirectorySourceExample.java @@ -48,7 +48,7 @@ public static void main(String... args) { System.out.println("Username: " + username); assert username.equals("libor"); - String password = secrets.get("changeit").asString().get(); + String password = secrets.get("password").asString().get(); System.out.println("Password: " + password); assert password.equals("changeit"); } diff --git a/examples/cors/README.md b/examples/cors/README.md index 0216c09b..54517d94 100644 --- a/examples/cors/README.md +++ b/examples/cors/README.md @@ -25,15 +25,15 @@ These normal greeting app endpoints work just as in the original greeting app: ```shell curl -X GET http://localhost:8080/greet -{"message":"Hello World!"} +#{"message":"Hello World!"} curl -X GET http://localhost:8080/greet/Joe -{"message":"Hello Joe!"} +#{"message":"Hello Joe!"} curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting curl -X GET http://localhost:8080/greet/Jose -{"message":"Hola Jose!"} +#{"message":"Hola Jose!"} ``` ## Using CORS @@ -49,6 +49,8 @@ By setting `Origin` and `Host` headers that do not indicate the same system we t # Follow the CORS protocol for GET curl -i -X GET -H "Origin: http://foo.com" -H "Host: here.com" http://localhost:8080/greet +``` +```text HTTP/1.1 200 OK Access-Control-Allow-Origin: * Content-Type: application/json @@ -66,6 +68,8 @@ The same happens for a `GET` requesting a personalized greeting (by passing the ```shell curl -i -X GET -H "Origin: http://foo.com" -H "Host: here.com" http://localhost:8080/greet/Joe +``` +```text HTTP/1.1 200 OK Date: Wed, 31 Jan 2024 11:58:06 +0100 Access-Control-Allow-Origin: * @@ -98,7 +102,8 @@ curl -i -X OPTIONS \ -H "Origin: http://foo.com" \ -H "Host: here.com" \ http://localhost:8080/greet/greeting - +``` +```text HTTP/1.1 200 OK Date: Wed, 31 Jan 2024 12:00:15 +0100 Access-Control-Allow-Methods: PUT @@ -119,7 +124,8 @@ curl -i -X PUT \ -H "Content-Type: application/json" \ -d "{ \"greeting\" : \"Cheers\" }" \ http://localhost:8080/greet/greeting - +``` +```text HTTP/1.1 204 No Content Date: Wed, 31 Jan 2024 12:01:45 +0100 Access-Control-Allow-Origin: http://foo.com @@ -130,7 +136,8 @@ Vary: ORIGIN And we run one more `GET` to observe the change in the greeting: ```shell curl -i -X GET -H "Origin: http://foo.com" -H "Host: here.com" http://localhost:8080/greet/Joe - +``` +```text HTTP/1.1 200 OK Date: Wed, 31 Jan 2024 12:02:13 +0100 Access-Control-Allow-Origin: * @@ -157,6 +164,8 @@ curl -i -X OPTIONS \ -H "Origin: http://other.com" \ -H "Host: here.com" \ http://localhost:8080/greet/greeting +``` +```text HTTP/1.1 403 CORS origin is not in allowed list Date: Wed, 31 Jan 2024 12:02:51 +0100 Connection: keep-alive @@ -171,7 +180,7 @@ mvn package java -jar target/helidon-examples-cors.jar ``` Send the previous `OPTIONS` request again and note the successful result: -```shell +```text HTTP/1.1 200 OK Date: Wed, 31 Jan 2024 12:05:36 +0100 Access-Control-Allow-Methods: PUT diff --git a/examples/dbclient/jdbc/README.md b/examples/dbclient/jdbc/README.md index 638dd6ae..ddc40f52 100644 --- a/examples/dbclient/jdbc/README.md +++ b/examples/dbclient/jdbc/README.md @@ -10,13 +10,13 @@ Uncomment the appropriate configuration in the application.xml for the desired d ## Build -``` +```shell mvn package ``` This example may also be run as a GraalVM native image in which case can be built using the following: -``` +```shell mvn package -Pnative-image ``` @@ -30,18 +30,18 @@ Instructions for H2 can be found here: http://www.h2database.com/html/cheatSheet Instructions for Oracle can be found here: https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance MySQL can be run as a docker container with the following command: -``` +```shell docker run --rm --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=pokemon -e MYSQL_USER=user -e MYSQL_PASSWORD=changeit mysql:5.7 ``` Then run the application: -``` +```shell java -jar target/helidon-examples-dbclient-jdbc.jar ``` or in the case of native image -``` +```shell ./target/helidon-examples-dbclient-jdbc ``` diff --git a/examples/dbclient/mongodb/README.md b/examples/dbclient/mongodb/README.md index 307cab3a..45bebc5e 100644 --- a/examples/dbclient/mongodb/README.md +++ b/examples/dbclient/mongodb/README.md @@ -5,7 +5,7 @@ This example shows how to run Helidon DB over mongoDB. ## Build -``` +```shell mvn package ``` @@ -13,13 +13,13 @@ mvn package This example requires a mongoDB database, start it using docker: -``` +```shell docker run --rm --name mongo -p 27017:27017 mongo ``` Then run the application: -``` +```shell java -jar target/helidon-examples-dbclient-mongodb.jar ``` diff --git a/examples/dbclient/pokemons/README.md b/examples/dbclient/pokemons/README.md index 807dc1ae..8d76e991 100644 --- a/examples/dbclient/pokemons/README.md +++ b/examples/dbclient/pokemons/README.md @@ -36,12 +36,12 @@ To switch between JDBC drivers: ## Build To build a jar file -``` +```shell mvn package ``` To build a native image (supported only with Oracle, MongoDB, or H2 databases) -``` +```shell mvn package -Pnative-image ``` @@ -53,19 +53,19 @@ Start your database before running this example. Example docker commands to start databases in temporary containers: Oracle: -``` +```shell docker run --rm --name xe -p 1521:1521 -p 8888:8080 wnameless/oracle-xe-11g-r2 ``` For details on an Oracle Docker image, see https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance H2: -``` +```shell docker run --rm --name h2 -p 9092:9082 -p 8082:8082 nemerosa/h2 ``` For details, see http://www.h2database.com/html/cheatSheet.html MySQL: -``` +```shell docker run --rm --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root \ -e MYSQL_DATABASE=pokemon -e MYSQL_USER=user -e MYSQL_PASSWORD=changeit mysql:5.7 ``` @@ -74,24 +74,24 @@ docker run --rm --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root \ ## Run Then run the `io.helidon.examples.dbclient.pokemons.Main` class: -``` +```shell java -jar target/helidon-examples-dbclient-pokemons.jar ``` Or run the native image: -``` +```shell ./target/helidon-examples-dbclient-pokemons ``` ### Run with MongoDB It's possible to run example with MongoDB database. Start it using docker: -``` +```shell docker run --rm --name mongo -p 27017:27017 mongo ``` Then run the `io.helidon.examples.dbclient.pokemons.Main` class with `mongo` argument: -``` +```shell java -jar target/helidon-examples-dbclient-pokemons.jar mongo ``` @@ -106,7 +106,7 @@ The application has the following endpoints: Application also connects to zipkin on default address. The query operation adds database trace. -``` +```shell # List all Pokémon curl http://localhost:8080/db/pokemon @@ -132,7 +132,7 @@ curl -i -X DELETE http://localhost:8080/db/pokemon/7 ### Proxy Make sure that `localhost` is not being accessed trough proxy when proxy is configured on your system: -``` +```shell export NO_PROXY='localhost' ``` diff --git a/examples/employee-app/README.md b/examples/employee-app/README.md index e607a8b2..9a1779c4 100644 --- a/examples/employee-app/README.md +++ b/examples/employee-app/README.md @@ -38,7 +38,7 @@ CREATE SEQUENCE EMPLOYEE_SEQ INCREMENT BY 1 NOCACHE NOCYCLE; ## Exercise the application Get all employees. -```sh +```shell curl -X GET curl -X GET http://localhost:8080/employees ``` @@ -60,7 +60,7 @@ Only 1 output record is shown for brevity: Get all employees whose last name contains "S". -```sh +```shell curl -X GET http://localhost:8080/employees/lastname/S ``` @@ -81,7 +81,7 @@ Only 1 output record is shown for brevity: ``` Get an individual record. -```sh +```shell curl -X GET http://localhost:8080/employees/48cf06ad-6ed4-47e6-ac44-3ea9c67cbe2d ``` Output: @@ -108,7 +108,7 @@ http://localhost:8080/public/index.html ## Try health and metrics -```sh +```shell curl -s -X GET http://localhost:8080/health ``` @@ -150,7 +150,7 @@ curl -s -X GET http://localhost:8080/health ### Prometheus Format -```sh +```shell curl -s -X GET http://localhost:8080/metrics ``` @@ -162,7 +162,7 @@ base:classloader_current_loaded_class_count 3995 ``` ### JSON Format -```sh +```shell curl -H 'Accept: application/json' -X GET http://localhost:8080/metrics ``` @@ -210,13 +210,13 @@ Output: ## Build the Docker Image -```sh +```shell docker build -t employee-app . ``` ## Start the application with Docker -```sh +```shell docker run --rm -p 8080:8080 employee-app:latest ``` diff --git a/examples/graphql/basics/README.md b/examples/graphql/basics/README.md index eb43abe7..133e06f7 100644 --- a/examples/graphql/basics/README.md +++ b/examples/graphql/basics/README.md @@ -19,15 +19,17 @@ Probe the GraphQL endpoints: 1. Hello word endpoint: ```shell - curl -X POST http://127.0.0.1:PORT/graphql -d '{"query":"query { hello }"}' + export PORT='41667' + curl -X POST http://127.0.0.1:${PORT}/graphql -d '{"query":"query { hello }"}' - "data":{"hello":"world"}} + #"data":{"hello":"world"}} ``` 1. Hello in different languages ```shell - curl -X POST http://127.0.0.1:PORT/graphql -d '{"query":"query { helloInDifferentLanguages }"}' + export PORT='41667' + curl -X POST http://127.0.0.1:${PORT}/graphql -d '{"query":"query { helloInDifferentLanguages }"}' - {"data":{"helloInDifferentLanguages":["Bonjour","Hola","Zdravstvuyte","Nǐn hǎo","Salve","Gudday","Konnichiwa","Guten Tag"]}} + #{"data":{"helloInDifferentLanguages":["Bonjour","Hola","Zdravstvuyte","Nǐn hǎo","Salve","Gudday","Konnichiwa","Guten Tag"]}} ``` diff --git a/examples/integrations/cdi/datasource-hikaricp-mysql/README.md b/examples/integrations/cdi/datasource-hikaricp-mysql/README.md index 14a20bc6..f1497e86 100644 --- a/examples/integrations/cdi/datasource-hikaricp-mysql/README.md +++ b/examples/integrations/cdi/datasource-hikaricp-mysql/README.md @@ -30,7 +30,7 @@ running in this Docker container, verify that the following lines (among others) are present in `src/main/resources/META-INF/microprofile-config.properties`: -```sh +```properties javax.sql.DataSource.example.dataSourceClassName=com.mysql.cj.jdbc.MysqlDataSource javax.sql.DataSource.example.dataSource.url = jdbc:mysql://localhost:3306 javax.sql.DataSource.example.dataSource.user = root @@ -46,7 +46,7 @@ java -jar target/helidon-integrations-examples-datasource-hikaricp-mysql.jar ``` Try the endpoint: -```sh +```shell curl http://localhost:8080/tables ``` diff --git a/examples/integrations/micrometer/mp/README.md b/examples/integrations/micrometer/mp/README.md index 7819c4a0..57032897 100644 --- a/examples/integrations/micrometer/mp/README.md +++ b/examples/integrations/micrometer/mp/README.md @@ -42,7 +42,7 @@ curl -X GET http://localhost:8080/greet/Joe ``` ```shell -curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting +curl -X PUT -H "Content-Type: application/json" -d '{"message" : "Hola"}' http://localhost:8080/greet/greeting curl -X GET http://localhost:8080/greet/Jose #Output: {"message":"Hola Jose!"} diff --git a/examples/integrations/micronaut/data/README.md b/examples/integrations/micronaut/data/README.md index 8943e6f4..52b780e8 100644 --- a/examples/integrations/micronaut/data/README.md +++ b/examples/integrations/micronaut/data/README.md @@ -51,7 +51,7 @@ curl -i http://localhost:8080/pets/s # To use Oracle XE instead of H2 - Update ./pom.xml to replace dependency on micronaut-jdbc-hikari with following -``` +```xml io.micronaut.sql micronaut-jdbc-ucp @@ -60,7 +60,7 @@ curl -i http://localhost:8080/pets/s ``` - Update ./pom.xml to replace dependency on com.h2database with following -``` +```xml io.helidon.integrations.db ojdbc @@ -84,7 +84,7 @@ curl -i http://localhost:8080/pets/s Instructions for running XE in a docker container can be found here: https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance - Update ./src/main/resources/META-INF/microprofile-config.properties to comment out h2 related datasource.* properties and uncomment+update following ones related to XE. -``` +```properties #datasources.default.url=jdbc:oracle:thin:@localhost:/ #datasources.default.driverClassName=oracle.jdbc.OracleDriver #datasources.default.username=system @@ -96,7 +96,7 @@ curl -i http://localhost:8080/pets/s # To use Oracle ATP cloud service instead of H2 - Update ./pom.xml to replace dependency on micronaut-jdbc-hikari with following -``` +```xml io.micronaut.sql micronaut-jdbc-ucp @@ -105,7 +105,7 @@ curl -i http://localhost:8080/pets/s ``` - Update ./pom.xml to replace dependency on com.h2database with following -``` +```xml io.helidon.integrations.db ojdbc @@ -129,14 +129,14 @@ curl -i http://localhost:8080/pets/s Instructions for ATP setup can be found here: https://blogs.oracle.com/developers/the-complete-guide-to-getting-up-and-running-with-autonomous-database-in-the-cloud - Create Schema used by test -``` +```sql CREATE TABLE "PET" ("ID" VARCHAR(36),"OWNER_ID" NUMBER(19) NOT NULL,"NAME" VARCHAR(255) NOT NULL,"TYPE" VARCHAR(255) NOT NULL); CREATE SEQUENCE "OWNER_SEQ" MINVALUE 1 START WITH 1 NOCACHE NOCYCLE; CREATE TABLE "OWNER" ("ID" NUMBER(19) PRIMARY KEY NOT NULL,"AGE" NUMBER(10) NOT NULL,"NAME" VARCHAR(255) NOT NULL); ``` - Update ./src/main/resources/META-INF/microprofile-config.properties to comment out h2 related datasource.* properties and add uncomment+update following ones related to ATP. -``` +```properties #datasources.default.url=jdbc:oracle:thin:@?TNS_ADMIN= #datasources.default.driverClassName=oracle.jdbc.OracleDriver #datasources.default.username= diff --git a/examples/integrations/micronaut/data/pom.xml b/examples/integrations/micronaut/data/pom.xml index 729fc615..3b09d250 100644 --- a/examples/integrations/micronaut/data/pom.xml +++ b/examples/integrations/micronaut/data/pom.xml @@ -48,6 +48,11 @@ io.micronaut micronaut-runtime + + io.helidon.logging + helidon-logging-jul + runtime + io.helidon.integrations.micronaut helidon-integrations-micronaut-cdi diff --git a/examples/integrations/neo4j/README.md b/examples/integrations/neo4j/README.md index 33060669..887e2f24 100644 --- a/examples/integrations/neo4j/README.md +++ b/examples/integrations/neo4j/README.md @@ -19,7 +19,8 @@ java -jar target/helidon-examples-integration-neo4j.jar Then access the rest API like this: ````shell -curl localhost:8080/api/movies +export PORT=38837 +curl localhost:${PORT}/api/movies ```` # Health and metrics @@ -33,6 +34,7 @@ Enable them in the driver: ``` ```shell -curl localhost:8080/observe/health -curl localhost:8080/observe/metrics +export PORT=38837 +curl localhost:${PORT}/observe/health +curl localhost:${PORT}/observe/metrics ``` diff --git a/examples/metrics/http-status-count-se/README.md b/examples/metrics/http-status-count-se/README.md index e660e383..68efb9c9 100644 --- a/examples/metrics/http-status-count-se/README.md +++ b/examples/metrics/http-status-count-se/README.md @@ -93,7 +93,7 @@ curl -H "Accept: application/json" -X GET http://localhost:8080/observe/metrics ## Try health ```shell -curl -s -X GET http://localhost:8080/health +curl -s -X GET http://localhost:8080/observe/health ``` ```listing {"outcome":"UP",... diff --git a/examples/microprofile/http-status-count-mp/README.md b/examples/microprofile/http-status-count-mp/README.md index e3329320..36fa4b6b 100644 --- a/examples/microprofile/http-status-count-mp/README.md +++ b/examples/microprofile/http-status-count-mp/README.md @@ -35,7 +35,7 @@ curl -X GET http://localhost:8080/greet/Joe {"message":"Hello Joe!"} ``` ```shell -curl -X PUT -H "Content-Type: application/json" -d '{"greeting" : "Hola"}' http://localhost:8080/greet/greeting +curl -X PUT -H "Content-Type: application/json" -d '{"message" : "Hola"}' http://localhost:8080/greet/greeting curl -X GET http://localhost:8080/greet/Jose ``` diff --git a/examples/security/webserver-digest-auth/README.md b/examples/security/webserver-digest-auth/README.md index bc9628e8..6ad8f4b5 100644 --- a/examples/security/webserver-digest-auth/README.md +++ b/examples/security/webserver-digest-auth/README.md @@ -21,7 +21,7 @@ Try the application: The application starts on a random port, the following assumes it is `56551` ```shell -export PORT=38529 +export PORT=45351 curl http://localhost:${PORT}/public curl --digest -u "jill:changeit" http://localhost:${PORT}/noRoles curl --digest -u "john:changeit" http://localhost:${PORT}/user diff --git a/examples/security/webserver-signatures/README.md b/examples/security/webserver-signatures/README.md index 3fbd0d5d..a4870a88 100644 --- a/examples/security/webserver-signatures/README.md +++ b/examples/security/webserver-signatures/README.md @@ -23,7 +23,7 @@ java -jar target/helidon-examples-security-webserver-signatures.jar Try the endpoints (port is random, shall be replaced accordingly): ```shell -export PORT=34941 +export PORT=39971 curl -u "jack:changeit" http://localhost:${PORT}/service1 curl -u "jill:changeit" http://localhost:${PORT}/service1-rsa curl -v -u "john:changeit" http://localhost:${PORT}/service1 diff --git a/examples/webclient/standalone/README.md b/examples/webclient/standalone/README.md index 6557e02d..de61b365 100644 --- a/examples/webclient/standalone/README.md +++ b/examples/webclient/standalone/README.md @@ -27,6 +27,7 @@ Then run the client, passing the port number. It will connect to the server: ```shell -java -cp "target/classes:target/libs/*" io.helidon.examples.webclient.standalone.ClientMain 35963 +export PORT=33417 +java -cp "target/classes:target/libs/*" io.helidon.examples.webclient.standalone.ClientMain ${PORT} ``` diff --git a/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java index fb943abc..eb0760e9 100644 --- a/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java +++ b/examples/webserver/basics/src/main/java/io/helidon/examples/webserver/basics/Main.java @@ -352,7 +352,7 @@ public static void main(String[] args) { } WebServer server; try { - method.invoke(null, params.toArray(new Object[0])); + method.invoke(new Main(), params.toArray(new Object[0])); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); System.exit(2); diff --git a/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java index db4fae53..1ed5267e 100644 --- a/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java +++ b/examples/webserver/comment-aas/src/main/java/io/helidon/examples/webserver/comments/Main.java @@ -50,7 +50,7 @@ private Main() { public static void main(String[] args) { WebServerConfig.Builder builder = WebServer.builder(); setup(builder); - WebServer server = builder.build().start(); + WebServer server = builder.port(8080).build().start(); System.out.println("WEB server is up! http://localhost:" + server.port() + "/comments"); } diff --git a/examples/webserver/multiport/README.md b/examples/webserver/multiport/README.md index e7709a45..56b941bf 100644 --- a/examples/webserver/multiport/README.md +++ b/examples/webserver/multiport/README.md @@ -26,7 +26,7 @@ java -jar target/helidon-examples-webserver-multiport.jar ``` ## Exercise the application -``` +```shell curl -X GET http://localhost:8080/hello curl -X GET http://localhost:8081/private/hello diff --git a/examples/webserver/opentracing/README.md b/examples/webserver/opentracing/README.md index 71f761b9..ed0ad12e 100644 --- a/examples/webserver/opentracing/README.md +++ b/examples/webserver/opentracing/README.md @@ -6,8 +6,7 @@ With Docker: ```shell docker run --name zipkin -d -p 9411:9411 openzipkin/zipkin ``` - -With Java 8+: +With JDK: ```shell curl -sSL https://zipkin.io/quickstart.sh | bash -s java -jar zipkin.jar @@ -21,8 +20,7 @@ docker build -t helidon-webserver-opentracing-example . docker run --rm -d --link zipkin --name helidon-webserver-opentracing-example \ -p 8080:8080 helidon-webserver-opentracing-example:latest ``` - -With Java 8+: +With JDK: ```shell mvn package java -jar target/helidon-examples-webserver-opentracing.jar diff --git a/examples/webserver/threads/README.md b/examples/webserver/threads/README.md index 7c3b5355..30394601 100644 --- a/examples/webserver/threads/README.md +++ b/examples/webserver/threads/README.md @@ -10,7 +10,7 @@ such cases: ## Build and run -```bash +```shell mvn package java -jar target/helidon-examples-webserver-threads.jar ``` @@ -18,7 +18,7 @@ java -jar target/helidon-examples-webserver-threads.jar ## Exercise the application __Compute:__ -``` +```shell curl -X GET http://localhost:8080/thread/compute/5 ``` The `compute` endpoint runs a costly floating point computation using a platform thread. @@ -27,7 +27,7 @@ Increase the number to make the computation more costly (and take longer). The request returns the results of the computation (not important!). __Fanout:__ -``` +```shell curl -X GET http://localhost:8080/thread/fanout/5 ``` The `fanout` endpoint simulates a fanout of remote calls that are run in parallel using @@ -39,7 +39,7 @@ in parallel. The request returns a list of numbers showing the sleep value of each remote client call. __Sleep:__ -``` +```shell curl -X GET http://localhost:8080/thread/sleep/4 ``` This is a simple endpoint that just sleeps for the specified number of seconds. It is