This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Check docker server and client version | |
docker version | |
## Check for running containers | Currently, it should be empty | |
docker ps | |
## Check for images | Currently, it should be empty | |
docker images | |
## Now Pull an Image (Nginx) from DockerHub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# installing openjdk on diff OS. | |
# on debian | |
- apt: | |
name: openjdk-8-jdk | |
state: present | |
when: ansible_os_family == 'Debian' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
class Test { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
CompletableFuture<Void> completableFuture = CompletableFuture.supplyAsync(() -> (int) (Math.random() * 10)) | |
.thenApply(value -> { | |
System.out.println("Generated random number is " + value); | |
return value % 2 == 0; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
class Test { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
CompletableFuture<Integer> completableFuture = CompletableFuture.supplyAsync(() -> (int) (Math.random() * 10)); | |
CompletableFuture<Void> voidCompletableFuture = completableFuture.thenRun(() -> { | |
System.out.println("Random number is generated."); | |
}); | |
voidCompletableFuture.get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
class Test { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
CompletableFuture<Integer> completableFuture = CompletableFuture.supplyAsync(() -> (int) (Math.random() * 10)); | |
CompletableFuture<Void> voidCompletableFuture = completableFuture.thenAccept(System.out::println); | |
voidCompletableFuture.get(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
class Test { | |
public static void main(String[] args) throws InterruptedException, ExecutionException { | |
CompletableFuture<Integer> completableFuture = CompletableFuture.supplyAsync(() -> (int) (Math.random() * 10)); | |
CompletableFuture<Boolean> completableFuture2 = completableFuture.thenApply(number -> number % 2 == 0); | |
System.out.println(completableFuture2.get() ? "Generated number is Even" : "Generated number is Odd"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.TimeUnit; | |
class Test { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
CompletableFuture<String> completableFuture = CompletableFuture.supplyAsync(() -> { | |
try { | |
TimeUnit.SECONDS.sleep(1000); | |
} catch (InterruptedException ex) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
import java.util.concurrent.ExecutionException; | |
class Test { | |
public static void main(String[] args) throws ExecutionException, InterruptedException { | |
CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> { | |
System.out.println(Thread.currentThread().getName() + " Runnable Call to be executed by another thread"); | |
return "Result of the asynchronous computation"; | |
}); | |
System.out.println(Thread.currentThread().getName() + " Main Thread"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.CompletableFuture; | |
class Test { | |
public static void main(String[] args) { | |
CompletableFuture completableFuture = CompletableFuture.runAsync(() -> { | |
System.out.println(Thread.currentThread().getName() + " Runnable Call to be executed by another thread"); | |
}); | |
System.out.println(Thread.currentThread().getName() + " Main Thread"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Threads { | |
public static void main(String[] args) { | |
ExecutorService service = Executors.newFixedThreadPool(2); | |
for(int count = 0; count < 10; count++){ | |
service.execute(()->{ | |
System.out.println("Child Thread" + Thread.currentThread().getName()); | |
}); | |
} | |
service.shutdown(); | |
System.out.println("|Main Thread|"); |
NewerOlder