@@ -0,0 +1,2031 @@
+/*%0A * Copyright (c) 2011-2019, PCJ Library, Marek Nowicki%0A * All rights reserved.%0A *%0A * Licensed under New BSD License (3-clause license).%0A *%0A * See the file %22LICENSE%22 for the full license governing this code.%0A */%0Apackage org.pcj.test;%0A%0Aimport org.pcj.PCJ;%0Aimport org.pcj.RegisterStorage;%0Aimport org.pcj.StartPoint;%0Aimport org.pcj.Storage;%0Aimport java.util.Arrays;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0A/**%0A * @author Marek Nowicki (faramir@mat.umk.pl)%0A */%0A@RegisterStorage(AbortTest.Vars.class)%0Apublic class AbortTest implements StartPoint %7B%0A    @Storage(AbortTest.class)%0A    enum Vars %7Bwait%7D%0A%0A    private boolean wait;%0A%0A    public static void main(String%5B%5D args) %7B%0A        Level level = Level.INFO;%0A//        Level level = Level.CONFIG;%0A        Logger logger = Logger.getLogger(%22%22);%0A        Arrays.stream(logger.getHandlers()).forEach(handler -%3E handler.setLevel(level));%0A        logger.setLevel(level);%0A%0A        String%5B%5D nodes = %7B%0A                %22localhost:8091%22,%0A                %22localhost:8002%22,%0A                %22localhost:8003%22,%0A                %22localhost:8004%22,%0A                %22localhost:8091%22,%0A                %22localhost:8002%22,%0A                %22localhost:8003%22,%0A                %22localhost:8004%22,%0A        %7D;%0A%0A        PCJ.executionBuilder(AbortTest.class)%0A                .addNodes(nodes)%0A                .deploy();%0A    %7D%0A%0A    @Override%0A    public void main() throws Throwable %7B%0A        if (PCJ.myId() == 2) %7B%0A            Thread.sleep(1_000);%0A            throw new RuntimeException(%22Thread-%22 + PCJ.myId() + %22: Abort%22);%0A        %7D%0A        PCJ.at(0, () -%3E %7B%0A            try %7B%0A                Thread.sleep(2_000);%0A            %7D catch (Exception e) %7B%0A                System.err.println(%22Thread-%22 + PCJ.myId() + %22 exception: %22 + e);%0A            %7D%0A            PCJ.waitFor(Vars.wait);%0A        %7D);%0A        try %7B%0A            Thread.sleep(2_000);%0A        %7D catch (Exception e) %7B%0A            System.err.println(%22Thread-%22 + PCJ.myId() + %22 exception: %22 + e);%0A        %7D%0A        PCJ.waitFor(Vars.wait);%0A    %7D%0A%7D%0A

Stop PCJ threads on error/abort.