@Override protected Marshaller createMarshaller() throws JAXBException { final Marshaller marshaller = super.createMarshaller(); if (schemaLocation != null) { marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation); } return marshaller; }
/** * Returns a JAXB marshaller from the pool. If there is no marshaller currently available * in the pool, then this method will {@linkplain #createMarshaller() create} a new one. * * <p>This method shall be used as below:</p> * * {@preformat java * Marshaller marshaller = pool.acquireMarshaller(); * marshaller.marchall(...); * pool.recycle(marshaller); * } * * Note that {@link #recycle(Marshaller)} shall not be invoked in case of exception, * since the marshaller may be in an invalid state. * * @return a marshaller configured for formatting OGC/ISO XML. * @throws JAXBException if an error occurred while creating and configuring a marshaller. */ public Marshaller acquireMarshaller() throws JAXBException { Marshaller marshaller = marshallers.poll(); if (marshaller == null) { marshaller = new PooledMarshaller(createMarshaller(), template); } return marshaller; }
/** * Returns a JAXB marshaller from the pool. If there is no marshaller currently available * in the pool, then this method will {@linkplain #createMarshaller() create} a new one. * * <p>This method shall be used as below:</p> * * {@preformat java * Marshaller marshaller = pool.acquireMarshaller(); * marshaller.marchall(...); * pool.recycle(marshaller); * } * * Note that {@link #recycle(Marshaller)} shall not be invoked in case of exception, * since the marshaller may be in an invalid state. * * @return a marshaller configured for formatting OGC/ISO XML. * @throws JAXBException if an error occurred while creating and configuring a marshaller. */ public Marshaller acquireMarshaller() throws JAXBException { Marshaller marshaller = marshallers.poll(); if (marshaller == null) { marshaller = new PooledMarshaller(createMarshaller(), template); } return marshaller; }