1 21 22 package org.jacorb.notification.impl; 23 24 import org.apache.avalon.framework.configuration.Configuration; 25 import org.jacorb.notification.filter.ETCLEvaluator; 26 import org.jacorb.notification.filter.EvaluationContext; 27 import org.jacorb.notification.interfaces.EvaluationContextFactory; 28 import org.jacorb.notification.util.AbstractObjectPool; 29 import org.jacorb.notification.util.AbstractPoolable; 30 31 35 public class PoolingEvaluationContextFactory implements EvaluationContextFactory 36 { 37 private final AbstractObjectPool evaluationContextPool_; 38 39 public PoolingEvaluationContextFactory(final Configuration configuration, 40 final ETCLEvaluator evaluator) 41 { 42 evaluationContextPool_ = new AbstractObjectPool("EvaluationContextPool") 43 { 44 public Object newInstance() 45 { 46 return new EvaluationContext(evaluator); 47 } 48 49 public void activateObject(Object o) 50 { 51 AbstractPoolable obj = (AbstractPoolable) o; 52 obj.reset(); 55 obj.setObjectPool(this); 56 } 57 }; 58 59 evaluationContextPool_.configure(configuration); 60 } 61 62 public EvaluationContext newEvaluationContext() 63 { 64 return ( EvaluationContext ) evaluationContextPool_.lendObject(); 65 } 66 } | Popular Tags |