Untitled

 avatar
unknown
java
a year ago
700 B
11
Indexable
    @Data
    static class TestDto {
        int a, b, c;

        void setA(int a) {
            this.a = a;
            log.info("Setting A");
        }

        void setB(int b) {
            this.b = b;
            log.info("Setting B");
        }

        void setC(int c) {
            this.c = c;
            log.info("Setting C");
        }
    }

    @Test
    void execute() {
        TestDto test = new TestDto();
        CompletableFuture.allOf(
                CompletableFuture.runAsync(() -> test.setA(1)),
                CompletableFuture.runAsync(() -> test.setB(2)),
                CompletableFuture.runAsync(() -> test.setC(3))
        ).join();
    }
Editor is loading...
Leave a Comment