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 351ba56

Browse files
committed
Add 'don't do this' comments in code examples in Ft.2
1 parent b67fe9d commit 351ba56

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ See also [ETS.3](#unneeded-thread-safety) about unneeded thread-safety of a meth
13301330
`Future` before asynchronous execution is started**, and is it started at all? Here is the
13311331
antipattern:
13321332
```java
1333+
// DON'T DO THIS
13331334
Future<Salary> getSalary(Employee employee) throws ConnectionException {
13341335
Branch branch = retrieveBranch(employee); // A database or an RPC call
13351336
return CompletableFuture.supplyAsync(() -> {
@@ -1341,6 +1342,7 @@ Blocking the caller thread is unexpected for a user seeing a method returning a
13411342

13421343
An example completely without asynchrony:
13431344
```java
1345+
// DON'T DO THIS
13441346
Future<Salary> getSalary(Employee employee) throws ConnectionException {
13451347
SalaryDTO salaryDto = retrieveSalary(employee); // A database or an RPC call
13461348
Salary salary = toSalary(salaryDto);

0 commit comments

Comments
(0)

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