List of usage examples for org.apache.commons.pool PoolUtils erodingPool
public static KeyedObjectPool erodingPool(final KeyedObjectPool keyedPool)
From source file:com.savoirtech.jaxb.engine.JaxbEngineProvider.java
private void initEngine() { try {//from w w w . j a v a2 s . c om // Introduce the additional JAXBIntros //JaxbIntros config = IntroductionsConfigParser.parseConfig(JaxbEngineProvider.class.getResourceAsStream(jaxbIntroFile)); //IntroductionsAnnotationReader reader = new IntroductionsAnnotationReader(config); //Map<String, Object> jaxbConfig = new HashMap<String, Object>(); //jaxbConfig.put(JAXBRIContext.ANNOTATION_READER, reader); String[] packages = packageList.split(","); for (String pkg : packages) { Class clazz = Class.forName(pkg.trim() + ".ObjectFactory"); sizableContextClassesList.add(clazz); } //sizableContextClassesList.add(ExceptionReportMsg.class); jaxbContext = JAXBContext.newInstance(getContextClasses()); } catch (JAXBException e) { LOG.error("Cannot initialize the master JAXB Context : ", e); } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } //Setup the pooling ObjectPool marshallPool = new StackObjectPool(new MarshallerPool(jaxbContext)); marshaller = new PooledMarshaller(PoolUtils.erodingPool(marshallPool)); ObjectPool unMarshallPool = new StackObjectPool(new UnmarshallerPool(jaxbContext)); unMarshaller = new PooledUnmarshaller(PoolUtils.erodingPool(unMarshallPool)); }
From source file:com.mijao.poc.jaxb.JaxbEngineProvider.java
private void initEngine() { try {//from w w w . j av a2 s . c o m // Introduce the additional JAXBIntros //JaxbIntros config = IntroductionsConfigParser.parseConfig(JaxbEngineProvider.class.getResourceAsStream(jaxbIntroFile)); //IntroductionsAnnotationReader reader = new IntroductionsAnnotationReader(config); //Map<String, Object> jaxbConfig = new HashMap<String, Object>(); //jaxbConfig.put(JAXBRIContext.ANNOTATION_READER, reader); String[] packages = packageList.split(","); for (String pkg : packages) { Class clazz = Class.forName(pkg.trim() + ".ObjectFactory"); sizableContextClassesList.add(clazz); } //sizableContextClassesList.add(ExceptionReportMsg.class); jaxbContext = JAXBContext.newInstance(getContextClasses()); } catch (JAXBException e) { logger.error("Cannot initialize the master JAXB Context : ", e); } catch (ClassNotFoundException cnfe) { throw new RuntimeException(cnfe); } //Setup the pooling ObjectPool marshallPool = new StackObjectPool(new MarshallerPool(jaxbContext)); marshaller = new PooledMarshaller(PoolUtils.erodingPool(marshallPool)); ObjectPool unMarshallPool = new StackObjectPool(new UnmarshallerPool(jaxbContext)); unMarshaller = new PooledUnmarshaller(PoolUtils.erodingPool(unMarshallPool)); }