我在apache spark上运行UIMA应用程序.UIMA RUTA需要处理数百万个页面才能进行计算.但是有一段时间我面临内存异常.它会在成功处理2000页时抛出异常,但有些时候会在500页上失败.
应用日志
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.apache.uima.internal.util.IntArrayUtils.expand_size(IntArrayUtils.java:57)
at org.apache.uima.internal.util.IntArrayUtils.ensure_size(IntArrayUtils.java:39)
at org.apache.uima.cas.impl.Heap.grow(Heap.java:187)
at org.apache.uima.cas.impl.Heap.add(Heap.java:241)
at org.apache.uima.cas.impl.CASImpl.ll_createFS(CASImpl.java:2844)
at org.apache.uima.cas.impl.CASImpl.createFS(CASImpl.java:489)
at org.apache.uima.cas.impl.CASImpl.createAnnotation(CASImpl.java:3837)
at org.apache.uima.ruta.rule.RuleMatch.getMatchedAnnotations(RuleMatch.java:172)
at org.apache.uima.ruta.rule.RuleMatch.getMatchedAnnotationsOf(RuleMatch.java:68)
at org.apache.uima.ruta.rule.RuleMatch.getLastMatchedAnnotation(RuleMatch.java:73)
at org.apache.uima.ruta.rule.ComposedRuleElement.mergeDisjunctiveRuleMatches(ComposedRuleElement.java:330)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:213)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueOwnMatch(ComposedRuleElement.java:362)
at org.apache.uima.ruta.rule.ComposedRuleElement.fallbackContinue(ComposedRuleElement.java:459)
at org.apache.uima.ruta.rule.ComposedRuleElement.continueMatch(ComposedRuleElement.java:225) …Run Code Online (Sandbox Code Playgroud) 我在使用 RESTful Web 服务时遇到问题,我在 php 中有一个客户端,它在 Java 中调用了 RESTful 服务。在我的 RESTful 服务中,我有一个 Post 方法,它执行更新查询以修改具有 10000 条记录的表中的所有行。我想使用线程来做到这一点。有没有可能做到这一点?请帮助我,我是 Java 的新手。谢谢。
好的,我在我的服务层这样做:
for(int i = 0; i < 10; i++)
{
startRow = i*1000;
finalRow = i*1000 + 1000;
Runnable process = new ProcessRecords(startRow , finalRow);
executor.execute(process);
}
// Wait until all threads are finish
while (!executor.isTerminated()) {
}
System.out.println("\n All threads finished");
Run Code Online (Sandbox Code Playgroud)
我正在调用这个类 (ProcessRecords) 来执行更新:
public ProcessRecords (int start, int final)
{
startRow = start;
finalRow = final;
}
@Override
public void …Run Code Online (Sandbox Code Playgroud) 是否有任何辅助方法或实用程序实际上给我两个字符串的联合.例如,如果我有两个字符串如下:
String s1 = "Isabella,tom,hardy";
String s2 = "Isabella,tom,hardy,victor,smith";
Run Code Online (Sandbox Code Playgroud)
我正在寻找一个解决方案,它将以两个字符串作为输入并输出结果如下:
General syntax: s1.{method/utility}(s2);
output : Isabella,tom,hardy,victor,smith
Run Code Online (Sandbox Code Playgroud)