mtitek
  • Cloud
  • Big Data
  • CI
  • Install
  • Samples
  • Java
  • Ubuntu
  • Maven
  • Archive
Java | Executors::newSingleThreadExecutor
  1. Maven - POM Configuration
  2. Example (1): ExecutorService::execute(Runnable)
  3. Example (2) - Synchronous execution: ExecutorService::submit(Callable)
  4. Example (3) - Asynchronous execution: ExecutorService::submit(Callable)

  1. Maven - POM Configuration
    Before you can use the java concurrent API, you need to add some dependencies to your "pom.xml" file.

    Here's the minimal dependencies needed in order for the following examples to work:

  2. Example (1): ExecutorService::execute(Runnable)

    Output:
  3. Example (2) - Synchronous execution: ExecutorService::submit(Callable)

    Output:
  4. Example (3) - Asynchronous execution: ExecutorService::submit(Callable)

    Output:
© 2020  mtitek