Github user mharmer commented on the issue:

    https://github.com/apache/ant/pull/81
  
    I have a test case I wrote as well, however I was hesitant on adding it 
since it dealt with non-deterministic behavior of trying to reproduce the race 
condition. If it's desired I can add it, it's basically this:
    
    ```
        /**
         * This test ensures that when requesting Project.getCopyOfReferences a
         * ConcurrentModificationException isn't thrown.
         *
         * ExecutorService is used so Exceptions are rethrown from their 
executors
         * and caught by JUnit as an error.
         */
        @Test
        public void testMultithreadedGetReferences() throws Exception {
            final ExecutorService es1 = Executors.newSingleThreadExecutor();
            final Future<?> getReferencesThread = es1.submit(() -> {
                for (int i = 0; i < 1000; i++) {
                    p.getCopyOfReferences();
                }
            });
    
            final ExecutorService es2 = Executors.newSingleThreadExecutor();
            final Future<?> addReferencesThread = es2.submit(() -> {
                for (int i = 0; i < 1000; i++) {
                    p.addReference("dummy" + i, "dummyValue");
                }
            });
    
            getReferencesThread.get();
            addReferencesThread.get();
        }
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to