You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Marc Giger <gi...@apache.org> on 2015/02/01 17:17:20 UTC
Re: svn commit: r1650332 - in
/santuario/xml-security-java/trunk/src:
main/java/org/apache/xml/security/utils/WeakObjectPool.java
test/java/org/apache/xml/security/test/dom/utils/PoolingTest.java
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
Re: svn commit: r1650332 - in /santuario/xml-security-java/trunk/src:
main/java/org/apache/xml/security/utils/WeakObjectPool.java test/java/org/apache/xml/security/test/dom/utils/PoolingTest.java
Posted by Colm O hEigeartaigh <co...@apache.org>.
It was committed as part of SANTUARIO-394 - maybe ask Anli on the JIRA? In
the meantime, we can just @Ignore it...
Colm.
On Sun, Feb 1, 2015 at 4:17 PM, Marc Giger <gi...@apache.org> wrote:
> 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
>
>
--
Colm O hEigeartaigh
Talend Community Coder
http://coders.talend.com