You should package well known schemas as jars and contribute them into the mix. This is used when the source of the Schema is unavailable; or if your app is behind a fire wall. See the source code for examples of the OGC schemas handled this way.
-- Jody Garnett On 05/02/2012, at 5:52 PM, NORMAN MANN <[email protected]> wrote: > > > Anyone? > Any advice would really be appreciated. > > Especially on storing schemas locally as this may well avoid the contention . > > Thanks > > Norman > > ------------------------------ > On Fri, Feb 3, 2012 3:26 PM GMT NORMAN MANN wrote: > >> Hi All, >> >> I am using geotools to generate images based on a remote WMS, and a local >> WFS. >> To increase throughput, I am attempted to make the software multithreaded >> (in a non application server environment). >> However I think I am getting deadlock (well maybe not deadlock, but the >> threads seem to be stuck waiting for one of the threads waiting to download >> XML schemas over the internet). >> >> On initial startup of WebMapServer object (each thread keeps it's own >> instance of a WebMapServer for performance - downloading XML schemas in >> particularly time consuming) it seems to download lots of XML schemas from >> the getCapabilities document for the WMS. >> >> Ideally I would like to cache these on the file system, is this possible, if >> so how? This may alleviate the problem in terms of time (it seems to take a >> long time) taken to download the various XML schemas. But would be >> preferential anyway to reduce startup time. >> >> Secondly each WebMapServer object seems to be waiting on a lock on >> org.geotools.xml.SchemaFactory.getInstance which is locked by one of the >> WebMapServer objects. >> Does this have to be the case, or can I remove this area as a bottle neck? >> Is this is a bug? I can see that SchemaFactory.getInstance seems to be >> intended to be thread safe. >> >> I have pasted the stack of some of the example threads below, and any >> help/advice would be very much appreciated!! >> >> Thanks >> >> Norman >> >> >> THREAD with LOCK >> >> "Piper Processor 3" prio=1 tid=0x0966e9d0 nid=0x3b4f runnable >> [0xe7c8f000..0xe7c90130] >> at java.net.SocketInputStream.socketRead0(Native Method) >> at java.net.SocketInputStream.read(SocketInputStream.java:129) >> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) >> at java.io.BufferedInputStream.read1(BufferedInputStream.java:256) >> at java.io.BufferedInputStream.read(BufferedInputStream.java:313) >> - locked <0xeabe3e70> (a java.io.BufferedInputStream) >> at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:606) >> at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554) >> at >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:936) >> - locked <0xeabe2480> (a sun.net.www.protocol.http.HttpURLConnection) >> at >> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) >> at >> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) >> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown >> Source) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:255) >> at >> org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:305) >> - locked <0xeb52acf0> (a org.geotools.xml.SchemaFactory) >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:265) >> - locked <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:430) >> at >> org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:117) >> at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:257) >> at >> org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:310) >> - locked <0xeb52acf0> (a org.geotools.xml.SchemaFactory) >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:265) >> - locked <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:385) >> at >> org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:117) >> at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:257) >> at >> org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:310) >> - locked <0xeb52acf0> (a org.geotools.xml.SchemaFactory) >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:265) >> - locked <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:430) >> at >> org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:117) >> at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:257) >> at >> org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:310) >> - locked <0xeb52acf0> (a org.geotools.xml.SchemaFactory) >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:265) >> - locked <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.ElementHandlerFactory.startPrefixMapping(ElementHandlerFactory.java:87) >> at >> org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:370) >> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown >> Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) >> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown >> Source) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:176) >> at >> org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:133) >> at >> org.geotools.data.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:54) >> at >> org.geotools.data.wms.WMS1_0_0$GetCapsRequest.createResponse(WMS1_0_0.java:231) >> at >> org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:440) >> at >> org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:405) >> at >> org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:240) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:95) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:81) >> at org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:368) >> >> >> THREADS without lock.... >> "Piper Processor 2" prio=1 tid=0x0964bf50 nid=0x3b4e waiting for monitor >> entry [0xe7d10000..0xe7d10fb0] >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:265) >> - waiting to lock <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.ElementHandlerFactory.startPrefixMapping(ElementHandlerFactory.java:87) >> at >> org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:370) >> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown >> Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) >> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown >> Source) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:176) >> at >> org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:133) >> at >> org.geotools.data.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:54) >> at >> org.geotools.data.wms.WMS1_0_0$GetCapsRequest.createResponse(WMS1_0_0.java:231) >> at >> org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:440) >> at >> org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:405) >> at >> org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:240) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:95) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:81) >> at org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:368) >> >> "Piper Processor 1" prio=1 tid=0x0964bdc8 nid=0x3b4d waiting for monitor >> entry [0xe7d91000..0xe7d92030] >> at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:208) >> - waiting to lock <0xef884168> (a java.lang.Class) >> at >> org.geotools.xml.handlers.ElementHandlerFactory.startPrefixMapping(ElementHandlerFactory.java:115) >> at >> org.geotools.xml.XMLSAXHandler.startElement(XMLSAXHandler.java:383) >> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown >> Source) >> at >> org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown >> Source) >> at >> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown >> Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) >> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) >> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) >> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown >> Source) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) >> at javax.xml.parsers.SAXParser.parse(SAXParser.java:176) >> at >> org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:133) >> at >> org.geotools.data.wms.response.WMSGetCapabilitiesResponse.<init>(WMSGetCapabilitiesResponse.java:54) >> at >> org.geotools.data.wms.WMS1_0_0$GetCapsRequest.createResponse(WMS1_0_0.java:231) >> at >> org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:440) >> at >> org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:405) >> at >> org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:240) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:95) >> at >> org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:81) >> at org.geotools.data.wms.WebMapServer.<init>(WebMapServer.java:368) >> at >> com.bt.mbe.processing.PIPERProcessor.getWMSLayer(PIPERProcessor.java:369) >> at >> com.bt.mbe.processing.PIPERProcessor.processItem(PIPERProcessor.java:269) >> at com.bt.mbe.processing.PIPERProcessor.run(PIPERProcessor.java:211) >> at java.lang.Thread.run(Thread.java:595) > > ------------------------------------------------------------------------------ > Try before you buy = See our experts in action! > The most comprehensive online learning library for Microsoft developers > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-dev2 > _______________________________________________ > GeoTools-GT2-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
