Package org.jacorb.notification.util

Examples of org.jacorb.notification.util.AbstractObjectPool


    private final AbstractObjectPool evaluationContextPool_;
   
    public PoolingEvaluationContextFactory(final Configuration configuration,
              final EvaluationContextFactory delegate)
    {
        evaluationContextPool_ = new AbstractObjectPool("EvaluationContextPool")
        {
            public Object newInstance()
            {
                return delegate.newEvaluationContext();
            }
View Full Code Here


    private final AbstractObjectPool evaluationContextPool_;
   
    public PoolingEvaluationContextFactory(final Configuration configuration,
              final EvaluationContextFactory delegate)
    {
        evaluationContextPool_ = new AbstractObjectPool("EvaluationContextPool")
        {
            public Object newInstance()
            {
                return delegate.newEvaluationContext();
            }
View Full Code Here

    {
        final AtomicInteger counter = new AtomicInteger(0);

        int testSize = 10;

        AbstractObjectPool pool = new AbstractObjectPool("Test", testSize, 1, 2, 20, 0)
        {
            public Object newInstance()
            {
                return new Integer(counter.incrementAndGet());
            }
        };

        pool.configure(null);
       
        HashSet unique = new HashSet();

        for (int x = 0; x < testSize * 2; ++x)
        {
            Integer i = (Integer) pool.lendObject();
            assertFalse(unique.contains(i));
            unique.add(i);
        }
    }
View Full Code Here

    public void testMaximumElements() throws Exception
    {
        final AtomicInteger counter = new AtomicInteger(0);

        AbstractObjectPool pool = new AbstractObjectPool("Test", 0, 0, 0, 0, 1)
        {
            public Object newInstance()
            {
                return new Integer(counter.incrementAndGet());
            }
        };
       
        pool.configure(null);

        Object lended = pool.lendObject();

        try
        {
            pool.lendObject();
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        try
        {
            pool.returnObject(new Integer(10));
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        try
        {
            pool.lendObject();
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        pool.returnObject(lended);
       
        pool.lendObject();
    }
View Full Code Here

    private final AbstractObjectPool evaluationContextPool_;
   
    public PoolingEvaluationContextFactory(final Configuration configuration,
              final EvaluationContextFactory delegate)
    {
        evaluationContextPool_ = new AbstractObjectPool("EvaluationContextPool")
        {
            public Object newInstance()
            {
                return delegate.newEvaluationContext();
            }
View Full Code Here

    private final AbstractObjectPool evaluationContextPool_;
   
    public PoolingEvaluationContextFactory(final Configuration configuration,
              final EvaluationContextFactory delegate)
    {
        evaluationContextPool_ = new AbstractObjectPool("EvaluationContextPool")
        {
            public Object newInstance()
            {
                return delegate.newEvaluationContext();
            }
View Full Code Here

    {
        final AtomicInteger counter = new AtomicInteger(0);

        int testSize = 10;

        AbstractObjectPool pool = new AbstractObjectPool("Test", testSize, 1, 2, 20, 0)
        {
            public Object newInstance()
            {
                return new Integer(counter.incrementAndGet());
            }
        };

        pool.configure(null);
       
        HashSet unique = new HashSet();

        for (int x = 0; x < testSize * 2; ++x)
        {
            Integer i = (Integer) pool.lendObject();
            assertFalse(unique.contains(i));
            unique.add(i);
        }
    }
View Full Code Here

    @Test
    public void testMaximumElements() throws Exception
    {
        final AtomicInteger counter = new AtomicInteger(0);

        AbstractObjectPool pool = new AbstractObjectPool("Test", 0, 0, 0, 0, 1)
        {
            public Object newInstance()
            {
                return new Integer(counter.incrementAndGet());
            }
        };
       
        pool.configure(null);

        Object lended = pool.lendObject();

        try
        {
            pool.lendObject();
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        try
        {
            pool.returnObject(new Integer(10));
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        try
        {
            pool.lendObject();
            fail();
        } catch (RuntimeException e)
        {
            // expected
        }

        pool.returnObject(lended);
       
        pool.lendObject();
    }
View Full Code Here

TOP

Related Classes of org.jacorb.notification.util.AbstractObjectPool

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.