Package org.switchyard.transform.xslt.internal

Examples of org.switchyard.transform.xslt.internal.TransformerPool


        templates = tFactory.newTemplates(new StreamSource(xsltStream));
    }

    @Test
    public void takeAndGive() throws Exception {
        TransformerPool pool = new TransformerPool(templates, 1);
        Transformer t1 = pool.take();
        Assert.assertNotNull(t1);
        pool.give(t1);
        Transformer t2 = pool.take();
        Assert.assertNotNull(t2);
        Assert.assertEquals(t1, t2);
    }
View Full Code Here


        Assert.assertEquals(t1, t2);
    }
   
    @Test
    public void blockOnTake() throws Exception {
        final TransformerPool pool = new TransformerPool(templates, 3);
        // draw down the pool
        pool.take();
        pool.take();
        final Transformer t = pool.take();
       
        // spin up a thread to offer back
        new Thread() {
            public void run() {
                try {
                    Thread.sleep(2000);
                    pool.give(t);
                } catch (Exception ex) {
                    ex.printStackTrace();
                    Assert.fail();
                }
            }
        }.start();
       
        // This will block until the give from our thread above
        Transformer t2 = pool.take();
        Assert.assertEquals(t, t2);
    }
View Full Code Here

TOP

Related Classes of org.switchyard.transform.xslt.internal.TransformerPool

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.