You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2015/04/10 22:32:11 UTC
svn commit: r1672755 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
Author: schor
Date: Fri Apr 10 20:32:10 2015
New Revision: 1672755
URL: http://svn.apache.org/r1672755
Log:
[UIMA-4344] add cas id and cas reset counter
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1672755&r1=1672754&r2=1672755&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Fri Apr 10 20:32:10 2015
@@ -42,6 +42,7 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.uima.UIMAFramework;
import org.apache.uima.UIMARuntimeException;
@@ -100,6 +101,11 @@ import org.apache.uima.util.Misc;
*
*/
public class CASImpl extends AbstractCas_ImplBase implements CAS, CASMgr, LowLevelCAS {
+
+ private static final boolean trace = false;
+
+ // debug
+ private static final AtomicInteger casIdProvider = new AtomicInteger(0);
// Notes on the implementation
// ---------------------------
@@ -322,11 +328,16 @@ public class CASImpl extends AbstractCas
*/
private boolean fsTobeAddedbackSingleInUse = false;
+ private final AtomicInteger casResets = new AtomicInteger(0);
+
+ private final int casId;
+
private SharedViewData(boolean useFSCache, Heap heap, CASImpl baseCAS, CASMetadata casMetadata) {
this.useFSCache = useFSCache;
this.heap = heap;
this.baseCAS = baseCAS;
this.casMetadata = casMetadata;
+ casId = casIdProvider.incrementAndGet();
}
}
@@ -1052,6 +1063,11 @@ public class CASImpl extends AbstractCas
}
public void resetNoQuestions() {
+ svd.casResets.incrementAndGet();
+ if (trace) {
+ System.out.println("CAS Reset in thread " + Thread.currentThread().getName() +
+ " for CasId = " + getCasId() + ", new reset count = " + svd.casResets.get());
+ }
int numViews = this.getBaseSofaCount();
// Flush indexRepository for all Sofa
for (int view = 1; view <= numViews; view++) {
@@ -5127,5 +5143,12 @@ public class CASImpl extends AbstractCas
getSofa(this.mySofaRef).getSofaID();
return "CASImpl [view: " + sofa + "]";
}
+
+ int getCasResets() {
+ return svd.casResets.get();
+ }
+ int getCasId() {
+ return svd.casId;
+ }
}