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
//fetch something from A to make a lookup on B | |
ADao adao = new ADao(); | |
adao.findByIdAsync(123,h1->{ | |
if(h1.succeeded()){ | |
BDao bdao = new BDao(); | |
bdao.findBySomeAValueAsync(h1.result().getSomeAValue(),h2->{ | |
if(h2.succeeded()){ | |
//do something with the result | |
}else{ | |
//oops something went wrong |
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
//fetch something from A to make a lookup on B | |
ADao adao = new ADao(); | |
CompletableFuture<A> aFutureLoaded = adao.findByIdAsync(123); | |
BDao bdao = new BDao(); | |
aFutureLoaded.thenCompose( | |
a->bdao.findBySomeAValueAsync(a.getSomeAValue()); | |
).whenComplete((bResult,ex)->{ | |
if(ex==null){ | |
//do something with the result | |
}else{ |
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
public class Main { | |
public static void main(String[] args) { | |
System.out.println(String.format("Look at these wonderful arguments %s", Arrays.toString(args))); | |
} | |
} |
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
#!/bin/bash | |
set -e | |
now=$(date +"%Y-%m-%d_%H-%M-%S") | |
tag="./target/app-$now.zip" | |
mvn clean install | |
echo "web: ./run.sh" > target/Procfile | |
echo "exec java \$JAVA_OPTS -jar app.jar \$JAVA_ARGS" > target/run.sh | |
chmod +x target/run.sh | |
zip -j ${tag} target/Procfile target/run.sh target/app.jar |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.github.jklingsporn.eb</groupId> | |
<artifactId>example</artifactId> | |
<version>1.0-SNAPSHOT</version> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.github.jklingsporn.eb</groupId> | |
<artifactId>example</artifactId> | |
<version>1.0-SNAPSHOT</version> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> | |
<id>release</id> | |
<formats> | |
<format>zip</format> | |
</formats> | |
<fileSets> | |
<fileSet> |
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
public class LockTest { | |
private static final Logger logger = LoggerFactory.getLogger(LockTest.class); | |
public static void main(String[] args) throws InterruptedException { | |
ForkJoinPool.commonPool().execute(() -> { mayLock(127);}); | |
ForkJoinPool.commonPool().execute(() -> { mayLock(127);}); | |
ForkJoinPool.commonPool().shutdown(); | |
ForkJoinPool.commonPool().awaitTermination(1, TimeUnit.MINUTES); | |
} |
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
Integer i = 23; | |
int j = i; |
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
Integer i = 127; | |
Integer j = 127; | |
boolean same = (i == j); //true | |
boolean equal = i.equals(j); //true |
OlderNewer