Skip to content

Commit

Permalink
Code for CallableFuture Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikraji committed May 5, 2023
1 parent ebb715b commit 4be8733
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ buildNumber.properties
/.idea/
/Core-Java-Features/.idea/
/Java-SE-17-Features/.idea/
.DS_Store
.DS_Store
/.idea/sonarlint/
38 changes: 25 additions & 13 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Core-Java-Features/java-multithreading-01-executors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,13 @@
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public CallableFutureEx(int taskId) {

@Override
public String call() throws Exception {
Thread.sleep(500); //just to imitate real work
return "TaskId:"
+ this.taskId
+ " "
Expand All @@ -35,6 +36,8 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc
System.out.println(f.get());
}

executorService.shutdown();

}
}

Expand Down

0 comments on commit 4be8733

Please sign in to comment.