src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/ParserPool.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 38,58 **** /** * Pool of SAXParser objects */ public class ParserPool { ! private final BlockingQueue queue; private SAXParserFactory factory; - private int capacity; public ParserPool(int capacity) { ! this.capacity = capacity; ! queue = new ArrayBlockingQueue(capacity); //factory = SAXParserFactory.newInstance(); factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl(); factory.setNamespaceAware(true); ! for (int i=0; i < capacity; i++) { try { queue.put(factory.newSAXParser()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new RuntimeException(ex); --- 38,56 ---- /** * Pool of SAXParser objects */ public class ParserPool { ! private final BlockingQueue<SAXParser> queue; private SAXParserFactory factory; public ParserPool(int capacity) { ! queue = new ArrayBlockingQueue<SAXParser>(capacity); //factory = SAXParserFactory.newInstance(); factory = new com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl(); factory.setNamespaceAware(true); ! for (int i = 0; i < capacity; i++) { try { queue.put(factory.newSAXParser()); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new RuntimeException(ex);
*** 73,84 **** throw new SAXException(ex); } } ! public void put(SAXParser parser) { ! queue.offer(parser); } public void returnParser(SAXParser saxParser) { saxParser.reset(); resetSaxParser(saxParser); --- 71,82 ---- throw new SAXException(ex); } } ! public boolean put(SAXParser parser) { ! return queue.offer(parser); } public void returnParser(SAXParser saxParser) { saxParser.reset(); resetSaxParser(saxParser);