Hi,

> Added:
> santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/utils/PoolingTest.java
> URL:
> http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/utils/PoolingTest.java?rev=1650332&view=auto
> ==============================================================================
> ---
> santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/utils/PoolingTest.java

> +//        final byte[] largeArrays[] = new byte[1024][];
> +//        final DocumentBuilder[] dbLargeArrays = new
> DocumentBuilder[largeArrays.length]; +
> +        int nThreads = Runtime.getRuntime().availableProcessors();
> +        ExecutorService exec =
> Executors.newFixedThreadPool(nThreads);
> +        Future<?>[] results = new Future[nThreads]; 
> +        for(int i = 0; i < nThreads-1; i++) {
> +            results[i] = exec.submit(new Runnable() {
> +                @Override
> +                public void run() {
> +                    for(;;) {
> +                        DocumentBuilder dbA[] = new
> DocumentBuilder[10];
> +                        for (int i = 0; i < dbA.length; i++) {
> +                            try {
> +                                dbA[i] =
> XMLUtils.createDocumentBuilder(false);
> +                                assertNotNull(dbA[i]);
> +                            } catch (ParserConfigurationException e)
> {
> +                                e.printStackTrace();
> +                                fail(e.toString());
> +                            }
> +                            assertNotNull(dbA[i]);
> +                        }
> +                        for(int i = 0; i < new
> Random().nextInt(dbA.length); i++) {
> +
> assertTrue(XMLUtils.repoolDocumentBuilder(dbA[i]));
> +                        }
> +                    }
> +                }
> +            });
> +        }
> +        results[nThreads-1] = exec.submit(new Runnable() {
> +            @Override
> +            public void run() {
> +                for(;;) {
> +                    byte[] largeArrays[] = new byte[1024][];
> +                    for (int i = 0; i < largeArrays.length; i++)
> +                        try {
> +                            largeArrays[i] = new byte[1024*1024];
> +                        } catch (OutOfMemoryError e) {
> +                            System.out.println("OOM from
> largeArray");
> +                            break;
> +                        }
> +                }
> +            }
> +        });

Hmmmppfff...

For what is this good for? Memory test? GC test? VM test? Jenkins
doesn't like it nor do I...

Thanks,

Marc

Reply via email to