import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.linuxtools.internal.tmf.core.Activator;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateSystemDisposedException;
import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
private final CountDownLatch finishedLatch = new CountDownLatch(1);
private boolean buildCancelled = false;
+ private boolean isDisposed = false;
/**
* General constructor
@Override
public synchronized void dispose() {
+ isDisposed = true;
if (transState.isActive()) {
transState.setInactive();
buildCancelled = true;
@Override
public synchronized List<ITmfStateInterval> queryFullState(long t)
- throws TimeRangeException {
+ throws TimeRangeException, StateSystemDisposedException {
+ if (isDisposed) {
+ throw new StateSystemDisposedException();
+ }
+
List<ITmfStateInterval> stateInfo = new ArrayList<ITmfStateInterval>(
attributeTree.getNbAttributes());
@Override
public ITmfStateInterval querySingleState(long t, int attributeQuark)
- throws AttributeNotFoundException, TimeRangeException {
- ITmfStateInterval ret;
+ throws AttributeNotFoundException, TimeRangeException,
+ StateSystemDisposedException {
+ if (isDisposed) {
+ throw new StateSystemDisposedException();
+ }
+ ITmfStateInterval ret;
if (transState.hasInfoAboutStateOf(t, attributeQuark)) {
ret = transState.getOngoingInterval(attributeQuark);
} else {
@Override
public ITmfStateInterval querySingleStackTop(long t, int stackAttributeQuark)
throws StateValueTypeException, AttributeNotFoundException,
- TimeRangeException {
+ TimeRangeException, StateSystemDisposedException {
Integer curStackDepth = querySingleState(t, stackAttributeQuark).getStateValue().unboxInt();
if (curStackDepth == -1) {
@Override
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
long t1, long t2) throws TimeRangeException,
- AttributeNotFoundException {
+ AttributeNotFoundException, StateSystemDisposedException {
+ if (isDisposed) {
+ throw new StateSystemDisposedException();
+ }
+
List<ITmfStateInterval> intervals;
ITmfStateInterval currentInterval;
long ts, tEnd;
@Override
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark,
long t1, long t2, long resolution, IProgressMonitor monitor)
- throws TimeRangeException, AttributeNotFoundException {
+ throws TimeRangeException, AttributeNotFoundException,
+ StateSystemDisposedException {
+ if (isDisposed) {
+ throw new StateSystemDisposedException();
+ }
+
List<ITmfStateInterval> intervals;
ITmfStateInterval currentInterval;
long ts, tEnd;