Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 18ac416

Browse files
author
Rajeev Kumar Singh
committed
rename projects
1 parent c8415aa commit 18ac416

27 files changed

+22
-10
lines changed
File renamed without changes.
Binary file not shown.

‎java-callables-and-futures/src/FutureAndCallableExample.java renamed to ‎java-callable-and-future-examples/src/FutureAndCallableExample.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ public static void main(String[] args) throws InterruptedException, ExecutionExc
99

1010
Callable<String> callable = () -> {
1111
// Perform some computation
12+
System.out.println("Entered Callable");
1213
Thread.sleep(2000);
1314
return "Hello from Callable";
1415
};
1516

17+
System.out.println("Submitting Callable");
1618
Future<String> future = executorService.submit(callable);
1719
// This line executes immediately
1820
System.out.println("Do something else while callable is getting executed");
Binary file not shown.

‎java-callables-and-futures/src/FutureCancelExample.java renamed to ‎java-callable-and-future-examples/src/FutureCancelExample.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public static void main(String[] args) throws InterruptedException, ExecutionExc
2828
}
2929

3030
// Check if future is cancelled before retrieving the result
31-
if(!future.isCancelled()) {
31+
// if(!future.isCancelled()) {
3232
System.out.println("Task completed! Retrieving the result");
3333
// Future.get() blocks until the result is available
3434
String result = future.get();
3535
System.out.println(result);
36-
} else {
37-
System.out.println("Task was cancelled");
38-
}
36+
// } else {
37+
// System.out.println("Task was cancelled");
38+
// }
3939
executorService.shutdown();
4040
}
4141

Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /