geotools wfs-ng 线程安全和奇怪的行为问题

如何解决geotools wfs-ng 线程安全和奇怪的行为问题

我在使用 geotools wfs-ng 数据存储插件和 geoserver 实例时遇到了大麻烦(geoserver 在这里不是问题,它只是 wfs 实现和数据提供者)。 用例看起来很简单:

  • 作为底层 wfs 代理的自定义 Web 服务
  • 在我的 Web 服务应用程序启动时创建 wfs 数据存储:
final URL wfsUrl = new URL(url);
final WFSConfig wfsConfig = WFSConfig.fromParams(Map.of(
    WFSDataAccessFactory.AXIS_ORDER.key,WFSDataAccessFactory.AXIS_ORDER_EAST_norTH));
final SimpleHttpClient httpClient = new SimpleHttpClient();
return new WFSDataStore(new WFSClient(wfsUrl,httpClient,wfsConfig));
  • 在连续的自定义 api 调用中重用它来代理底层 wfs,下面的许多调用是在多个线程中完成的
final SimpleFeatureSource eventsSource = dataStore.getFeatureSource(typeName);
final String geometryColumn = dataStore.getSchema(typeName).getGeometryDescriptor().getLocalName();
final Filter filter = filterOf(parameters,geometryColumn);
final SimpleFeatureCollection eventsFeatures = eventsSource.getFeatures(new Query(typeName,filter));
final SimpleFeatureIterator features = eventsFeatures.features();
try {
    while (features.hasNext()) {
        final SimpleFeature next = features.next();
        //do something
    }
} finally {
    features.close();
}

geotools wfs-ng 数据存储插件的试用版:22.3、23.5

症状:

  • wfs-ng 插件的奇怪行为是每个 wfs GetFeature 调用都会释放 DescribeFeatureType 调用(对于似乎失败的架构,可能来自 org.geotools.xsd.impl PullParser),为什么一个还不够?
  • 立>
  • 经过多次多线程 wfs 调用(有时更少,有时更多)
Caused by: java.lang.Arrayindexoutofboundsexception: arraycopy: last source index 94 out of bounds for object array[93]
    at java.base/java.lang.System.arraycopy(Native Method) ~[na:na]
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.ensureSafety(BasicNotifierImpl.java:214) ~[org.eclipse.emf.common-2.15.0.jar!/:na]
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.remove(BasicNotifierImpl.java:244) ~[org.eclipse.emf.common-2.15.0.jar!/:na]
    at org.geotools.xsd.impl.SchemaIndexImpl.destroy(SchemaIndexImpl.java:93) ~[gt-xsd-core-22.3.jar!/:na]
    at org.geotools.xsd.Encoder.encode(Encoder.java:1119) ~[gt-xsd-core-22.3.jar!/:na]
    at org.geotools.filter.v2_0.bindings.BinarySpatialOpTypeBinding$1.encode(BinarySpatialOpTypeBinding.java:70) ~[gt-xsd-fes-22.3.jar!/:na]
    at org.geotools.xsd.Encoder.encode(Encoder.java:727) ~[gt-xsd-core-22.3.jar!/:na]
    ... 103 common frames omitted

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?