1 10 11 package org.mule.impl.model.seda.optimised; 12 13 import org.mule.config.PoolingProfile; 14 import org.mule.config.i18n.Message; 15 import org.mule.config.i18n.Messages; 16 import org.mule.impl.MuleDescriptor; 17 import org.mule.impl.model.seda.SedaComponent; 18 import org.mule.umo.lifecycle.InitialisationException; 19 20 28 public class OptimisedSedaComponent extends SedaComponent 29 { 30 33 private static final long serialVersionUID = 4710126404530397113L; 34 35 38 public OptimisedSedaComponent(MuleDescriptor descriptor, OptimisedSedaModel model) 39 { 40 super(descriptor, model); 41 } 42 43 protected void initialisePool() throws InitialisationException 44 { 45 try 46 { 47 49 proxyPool = descriptor.getPoolingProfile().getPoolFactory().createPool(descriptor, 51 new OptimisedProxyFactory(descriptor)); 52 53 if (descriptor.getPoolingProfile().getInitialisationPolicy() == PoolingProfile.POOL_INITIALISE_ALL_COMPONENTS) 54 { 55 int threads = descriptor.getPoolingProfile().getMaxActive(); 56 for (int i = 0; i < threads; i++) 57 { 58 proxyPool.returnObject(proxyPool.borrowObject()); 59 } 60 } 61 else if (descriptor.getPoolingProfile().getInitialisationPolicy() == PoolingProfile.POOL_INITIALISE_ONE_COMPONENT) 62 { 63 proxyPool.returnObject(proxyPool.borrowObject()); 64 } 65 poolInitialised.set(true); 66 } 67 catch (Exception e) 68 { 69 throw new InitialisationException(new Message(Messages.X_FAILED_TO_INITIALISE, "Proxy Pool"), e, 70 this); 71 } 72 } 73 } 74 | Popular Tags |