Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2010 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
3f2b9283 | 11 | * Marc Dumais (marc.dumais@ericsson.com) - Fix for 316455 (first part) |
5d10d135 ASL |
12 | *******************************************************************************/ |
13 | ||
6c13869b | 14 | package org.eclipse.linuxtools.lttng.core.control; |
5d10d135 ASL |
15 | |
16 | import java.util.HashMap; | |
3f2b9283 FC |
17 | import java.util.Iterator; |
18 | import java.util.List; | |
5d10d135 | 19 | import java.util.Map; |
3f2b9283 | 20 | import java.util.Vector; |
5d10d135 | 21 | |
6c13869b FC |
22 | import org.eclipse.linuxtools.lttng.core.TraceDebug; |
23 | import org.eclipse.linuxtools.lttng.core.event.LttngEvent; | |
24 | import org.eclipse.linuxtools.lttng.core.event.LttngEventType; | |
25 | import org.eclipse.linuxtools.lttng.core.event.LttngSyntheticEvent; | |
6c13869b | 26 | import org.eclipse.linuxtools.lttng.core.event.LttngSyntheticEvent.SequenceInd; |
99005796 | 27 | import org.eclipse.linuxtools.lttng.core.event.LttngTimestamp; |
6c13869b FC |
28 | import org.eclipse.linuxtools.lttng.core.model.LTTngTreeNode; |
29 | import org.eclipse.linuxtools.lttng.core.request.LttngBaseEventRequest; | |
30 | import org.eclipse.linuxtools.lttng.core.state.evProcessor.ITransEventProcessor; | |
31 | import org.eclipse.linuxtools.lttng.core.state.evProcessor.state.StateEventToHandlerFactory; | |
32 | import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState; | |
33 | import org.eclipse.linuxtools.lttng.core.state.trace.IStateTraceManager; | |
34 | import org.eclipse.linuxtools.tmf.core.component.TmfEventProvider; | |
6c13869b FC |
35 | import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange; |
36 | import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp; | |
37 | import org.eclipse.linuxtools.tmf.core.experiment.TmfExperiment; | |
38 | import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest; | |
39 | import org.eclipse.linuxtools.tmf.core.request.ITmfEventRequest; | |
40 | import org.eclipse.linuxtools.tmf.core.request.TmfDataRequest; | |
41 | import org.eclipse.linuxtools.tmf.core.signal.TmfEndSynchSignal; | |
42 | import org.eclipse.linuxtools.tmf.core.signal.TmfStartSynchSignal; | |
43 | import org.eclipse.linuxtools.tmf.core.trace.ITmfContext; | |
44 | import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace; | |
45 | import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpoint; | |
46 | import org.eclipse.linuxtools.tmf.core.trace.TmfContext; | |
5d10d135 ASL |
47 | |
48 | /** | |
49 | * @author alvaro | |
50 | * | |
51 | */ | |
a72a38d9 | 52 | public class LttngSyntheticEventProvider extends TmfEventProvider<LttngSyntheticEvent> { |
5d10d135 ASL |
53 | |
54 | // ======================================================================== | |
55 | // Data | |
56 | // ======================================================================== | |
a79913eb | 57 | public static final int BLOCK_SIZE = 50000; |
3d62f8b7 | 58 | public static final int NB_EVENTS = 1; |
f9673903 | 59 | public static final int QUEUE_SIZE = 1; // lttng specific, one event at a time |
5d10d135 | 60 | |
5d10d135 | 61 | private ITmfDataRequest<LttngSyntheticEvent> fmainRequest = null; |
c1c69938 FC |
62 | private LttngBaseEventRequest fSubRequest = null; |
63 | ||
3f2b9283 FC |
64 | private final List<IStateTraceManager> fEventProviderRequests = new Vector<IStateTraceManager>(); |
65 | ||
5d10d135 | 66 | private final LttngSyntheticEvent fStatusEvent; |
5d10d135 ASL |
67 | volatile boolean startIndSent = false; |
68 | private LTTngTreeNode fExperiment = null; | |
3f2b9283 | 69 | private ITransEventProcessor fstateUpdateProcessor = StateEventToHandlerFactory.getInstance(); |
5d10d135 | 70 | private boolean waitForRequest = false; |
3f2b9283 | 71 | long dispatchTime = 0L; |
a79913eb FC |
72 | long dispatchIndex = 0L; |
73 | long eventIndex; | |
3f2b9283 | 74 | private final Map<ITmfTrace, LttngTraceState> traceToTraceStateModel = new HashMap<ITmfTrace, LttngTraceState>(); |
5d10d135 | 75 | |
c1c69938 FC |
76 | private boolean fIsExperimentNotified = false; |
77 | ||
5d10d135 ASL |
78 | // ======================================================================== |
79 | // Constructor | |
80 | // ======================================================================== | |
81 | /** | |
82 | * Accessibility to package - use factory instead of this constructor | |
83 | * | |
84 | * @param type | |
85 | */ | |
86 | LttngSyntheticEventProvider(Class<LttngSyntheticEvent> type) { | |
9c4eb5f7 | 87 | super("LttngSyntheticEventProvider", type, QUEUE_SIZE); //$NON-NLS-1$ |
5d10d135 ASL |
88 | |
89 | // prepare empty instance status indicators and allow them to travel via | |
90 | // the framework | |
99005796 | 91 | String source = this.toString(); |
5d10d135 | 92 | LttngEventType dtype = new LttngEventType(); |
f9673903 FC |
93 | LttngTimestamp statusTimeStamp = new LttngTimestamp( |
94 | TmfTimestamp.Zero); | |
5d10d135 | 95 | |
f9673903 FC |
96 | fStatusEvent = new LttngSyntheticEvent(null, statusTimeStamp, source, |
97 | dtype, null, null, null); | |
5d10d135 | 98 | fStatusEvent.setSequenceInd(SequenceInd.STARTREQ); |
5d10d135 ASL |
99 | } |
100 | ||
101 | // ======================================================================== | |
102 | // Methods | |
103 | // ======================================================================== | |
550d787e | 104 | |
5d10d135 ASL |
105 | @SuppressWarnings("unchecked") |
106 | @Override | |
3f2b9283 | 107 | public ITmfContext armRequest(final ITmfDataRequest<LttngSyntheticEvent> request) { |
5d10d135 ASL |
108 | // validate |
109 | // make sure we have the right type of request | |
110 | if (!(request instanceof ITmfEventRequest<?>)) { | |
111 | request.cancel(); | |
9c4eb5f7 | 112 | TraceDebug.debug("Request is not an instance of ITmfEventRequest"); //$NON-NLS-1$ |
5d10d135 ASL |
113 | return null; |
114 | } | |
115 | ||
116 | if (fExperiment == null) { | |
9c4eb5f7 | 117 | TraceDebug.debug("Experiment is null"); //$NON-NLS-1$ |
5d10d135 ASL |
118 | request.cancel(); |
119 | return null; | |
120 | } | |
121 | ||
122 | // get ready to start processing | |
123 | reset(fExperiment); | |
124 | ||
125 | // At least one base provider shall be available | |
550d787e | 126 | if (fEventProviderRequests.size() < 1) { |
5d10d135 | 127 | request.cancel(); |
9c4eb5f7 | 128 | TraceDebug.debug("No Base event providers available"); //$NON-NLS-1$ |
5d10d135 ASL |
129 | return null; |
130 | } | |
131 | ||
132 | fmainRequest = request; | |
c1c69938 | 133 | |
5d10d135 ASL |
134 | // define event data handling |
135 | ITmfEventRequest<LttngSyntheticEvent> eventRequest = (ITmfEventRequest<LttngSyntheticEvent>) fmainRequest; | |
136 | TmfTimeRange reqWindow = eventRequest.getRange(); | |
550d787e | 137 | |
9c4eb5f7 | 138 | TraceDebug.debug("Main Synthethic event request started on thread: " + Thread.currentThread().getName()); //$NON-NLS-1$ |
5d10d135 | 139 | |
9b635e61 FC |
140 | TmfExperiment<LttngEvent> experiment = (TmfExperiment<LttngEvent>) fExperiment.getValue(); |
141 | experiment.startSynch(new TmfStartSynchSignal(0)); | |
3f2b9283 FC |
142 | |
143 | TmfTimeRange adjustedRange = reqWindow; | |
a79913eb FC |
144 | long adjustedIndex = eventRequest.getIndex(); |
145 | int nbRequested = eventRequest.getNbRequested(); | |
3f2b9283 FC |
146 | |
147 | // Figure-out if we need to increase the range of the request: if some | |
148 | // checkpoints are before the beginning of the range, increase the | |
149 | // range to catch them. We will then exercise the state system of | |
150 | // those traces until the requested beginning time range, discarding | |
151 | // the unrequested data. | |
152 | IStateTraceManager traceManager; | |
153 | Iterator<IStateTraceManager> iter = fEventProviderRequests.iterator(); | |
154 | // For each traceManager in the current experiment... | |
155 | while(iter.hasNext()) { | |
156 | traceManager = iter.next(); | |
5d10d135 | 157 | // restore trace state system to nearest check point |
a79913eb FC |
158 | TmfCheckpoint checkPoint = null; |
159 | if (eventRequest.getIndex() > 0) { | |
160 | checkPoint = traceManager.restoreCheckPointByIndex(eventRequest.getIndex()); | |
161 | } else { | |
162 | checkPoint = traceManager.restoreCheckPointByTimestamp(reqWindow.getStartTime()); | |
163 | } | |
550d787e | 164 | |
3f2b9283 FC |
165 | // validate that the checkpoint restored is within requested bounds |
166 | // (not outside the current trace's range or after the end of requested range) | |
ce970a71 | 167 | TmfTimeRange traceRange = traceManager.getStateTrace().getTimeRange(); |
a79913eb FC |
168 | if ((checkPoint == null) || |
169 | checkPoint.getTimestamp().getValue() < traceRange.getStartTime().getValue() || | |
170 | checkPoint.getTimestamp().getValue() > traceRange.getEndTime().getValue() || | |
171 | checkPoint.getTimestamp().getValue() >= reqWindow.getEndTime().getValue() | |
550d787e | 172 | ) { |
3f2b9283 FC |
173 | // checkpoint is out of trace bounds; no need to adjust request for this |
174 | // trace | |
175 | } | |
176 | else { | |
177 | // use checkpoint time as new startTime for request if it's earlier than | |
178 | // current startTime | |
a79913eb FC |
179 | if (adjustedRange.getStartTime().getValue() > checkPoint.getTimestamp().getValue() || adjustedIndex > (Long) checkPoint.getLocation().getLocation()) { |
180 | adjustedRange = new TmfTimeRange(checkPoint.getTimestamp(), reqWindow.getEndTime()); | |
181 | adjustedIndex = (Long) checkPoint.getLocation().getLocation(); | |
182 | if (nbRequested < TmfDataRequest.ALL_DATA) { | |
183 | nbRequested += (eventRequest.getIndex() - adjustedIndex); | |
184 | } | |
3f2b9283 FC |
185 | } |
186 | } | |
187 | // Save which trace state model corresponds to current trace | |
ce970a71 | 188 | traceToTraceStateModel.put(traceManager.getStateTrace(), traceManager.getStateModel()); |
3f2b9283 | 189 | } |
c1c69938 | 190 | |
3f2b9283 | 191 | dispatchTime = reqWindow.getStartTime().getValue(); |
a79913eb FC |
192 | dispatchIndex = eventRequest.getIndex(); |
193 | eventIndex = adjustedIndex; | |
c1c69938 | 194 | |
3f2b9283 | 195 | // Create a single request for all traces in the experiment, with coalesced time range. |
c1c69938 | 196 | fSubRequest = new LttngBaseEventRequest(adjustedRange, reqWindow.getStartTime(), |
a79913eb | 197 | adjustedIndex, nbRequested, BLOCK_SIZE, eventRequest.getExecType() /*ITmfDataRequest.ExecutionType.FOREGROUND*/) { |
3f2b9283 FC |
198 | |
199 | private LttngSyntheticEvent syntheticEvent = null; | |
3f2b9283 FC |
200 | |
201 | /* | |
202 | * (non-Javadoc) | |
203 | * | |
204 | * @see org.eclipse.linuxtools.lttng.control.LttngEventRequest#handleData() | |
205 | */ | |
206 | @Override | |
207 | public void handleData(LttngEvent event) { | |
208 | super.handleData(event); | |
209 | if (event != null) { | |
c1c69938 FC |
210 | synchronized (LttngSyntheticEventProvider.this) { |
211 | // Check if request was canceled | |
212 | if ((fmainRequest == null) || (fmainRequest.isCompleted()) ) { | |
9c4eb5f7 | 213 | TraceDebug.debug("fmainRequest was canceled. Ignoring event " + event); //$NON-NLS-1$ |
c1c69938 FC |
214 | return; |
215 | } | |
216 | ||
217 | handleIncomingData(event); | |
218 | } | |
3f2b9283 | 219 | } else { |
9c4eb5f7 | 220 | TraceDebug.debug("handle data received with no data"); //$NON-NLS-1$ |
3f2b9283 | 221 | } |
5d10d135 | 222 | } |
3f2b9283 FC |
223 | |
224 | /* | |
225 | * (non-Javadoc) | |
226 | * | |
c1c69938 | 227 | * @see org.eclipse.linuxtools.tmf.request.TmfDataRequest#handleCompleted() |
3f2b9283 FC |
228 | */ |
229 | @Override | |
c1c69938 | 230 | public void handleCompleted() { |
3f2b9283 | 231 | // mark this sub-request as completed |
c1c69938 FC |
232 | handleProviderDone(!isCancelled() && !isFailed()); |
233 | super.handleCompleted(); | |
550d787e | 234 | } |
5d10d135 | 235 | |
3f2b9283 FC |
236 | /** |
237 | * Trigger the Analysis and sequential control of the events. | |
238 | * | |
239 | * @param e | |
240 | */ | |
241 | private void handleIncomingData(LttngEvent e) { | |
242 | long eventTime = e.getTimestamp().getValue(); | |
243 | ||
ce970a71 | 244 | ITmfTrace inTrace = e.getTrace(); |
3f2b9283 FC |
245 | LttngTraceState traceModel = traceToTraceStateModel.get(inTrace); |
246 | ||
c1c69938 | 247 | // queue the new event data |
3f2b9283 FC |
248 | updateSynEvent(e); |
249 | ||
250 | // If time at or above requested time, update application | |
a79913eb | 251 | if (eventTime >= dispatchTime && eventIndex >= dispatchIndex) { |
3f2b9283 FC |
252 | // Before update |
253 | syntheticEvent.setSequenceInd(SequenceInd.BEFORE); | |
254 | fmainRequest.handleData(syntheticEvent); | |
3f2b9283 FC |
255 | |
256 | // Update state locally | |
257 | syntheticEvent.setSequenceInd(SequenceInd.UPDATE); | |
258 | fstateUpdateProcessor.process(syntheticEvent, traceModel); | |
259 | ||
260 | // After Update | |
261 | syntheticEvent.setSequenceInd(SequenceInd.AFTER); | |
262 | fmainRequest.handleData(syntheticEvent); | |
3f2b9283 | 263 | |
3f2b9283 FC |
264 | } else { |
265 | // event time is between checkpoint adjusted time and | |
266 | // requested time i.e. application does not expect the | |
267 | // event, however the state system needs to be re-built | |
268 | // to the dispatch point | |
269 | syntheticEvent.setSequenceInd(SequenceInd.UPDATE); | |
270 | fstateUpdateProcessor.process(syntheticEvent, traceModel); | |
5d10d135 | 271 | } |
a79913eb | 272 | eventIndex++; |
3f2b9283 FC |
273 | } |
274 | ||
275 | /** | |
276 | * Create a synthetic event from the received new reference, if | |
277 | * the reference is the same there is no need for a new instance | |
278 | * | |
279 | * if this is the first event for this request, call start | |
280 | * handler | |
281 | * | |
282 | * @param e | |
283 | * @return | |
284 | */ | |
285 | private LttngSyntheticEvent updateSynEvent(LttngEvent e) { | |
c1c69938 | 286 | if ((syntheticEvent == null) || (syntheticEvent.getBaseEvent() != e)) { |
3f2b9283 | 287 | syntheticEvent = new LttngSyntheticEvent(e); |
5d10d135 | 288 | } |
3f2b9283 | 289 | |
ce970a71 | 290 | ITmfTrace inTrace = e.getTrace(); |
3f2b9283 | 291 | LttngTraceState traceModel = traceToTraceStateModel.get(inTrace); |
f9673903 | 292 | |
3f2b9283 FC |
293 | // Trace model needed by application handlers |
294 | syntheticEvent.setTraceModel(traceModel); | |
295 | ||
296 | // send the start request indication once per request thread | |
297 | if (!startIndSent) { | |
9c4eb5f7 | 298 | TraceDebug.debug("Thread started: " + Thread.currentThread().getName()); //$NON-NLS-1$ |
3f2b9283 FC |
299 | handleProviderStarted(traceModel); |
300 | startIndSent = true; | |
5d10d135 ASL |
301 | } |
302 | ||
3f2b9283 FC |
303 | return syntheticEvent; |
304 | } | |
305 | }; | |
306 | ||
307 | // start request | |
308 | TmfExperiment<LttngEvent> provider = (TmfExperiment<LttngEvent>) fExperiment.getValue(); | |
c1c69938 | 309 | provider.sendRequest(fSubRequest); |
3f2b9283 | 310 | |
c1c69938 FC |
311 | // notify LTTngEvent provider that all requests were sent |
312 | synchronized (this) { | |
313 | TmfExperiment.getCurrentExperiment().notifyPendingRequest(false); | |
314 | fIsExperimentNotified = false; | |
315 | } | |
5d10d135 | 316 | |
9b635e61 FC |
317 | experiment.endSynch(new TmfEndSynchSignal(0)); |
318 | ||
5d10d135 | 319 | // Return a dummy context, not used for relay provider |
c1c69938 | 320 | return new TmfContext(); |
5d10d135 ASL |
321 | } |
322 | ||
323 | /** | |
324 | * Notify listeners to prepare to receive data e.g. clean previous data etc. | |
325 | */ | |
c1c69938 | 326 | public synchronized void handleProviderStarted(LttngTraceState traceModel) { |
3d62f8b7 | 327 | LttngSyntheticEvent startIndEvent = new LttngSyntheticEvent(fStatusEvent); |
5d10d135 ASL |
328 | startIndEvent.setSequenceInd(SequenceInd.STARTREQ); |
329 | ||
330 | // Notify application | |
f9673903 | 331 | fmainRequest.handleData(startIndEvent); |
5d10d135 ASL |
332 | |
333 | // Notify state event processor | |
334 | fstateUpdateProcessor.process(startIndEvent, null); | |
335 | } | |
336 | ||
337 | /** | |
f9673903 FC |
338 | * Notify listeners, no more events for the current request will be |
339 | * distributed e.g. update view. | |
5d10d135 | 340 | */ |
c1c69938 | 341 | public synchronized void handleProviderDone(boolean isSuccess) { |
3f2b9283 FC |
342 | // Notify application. One notification per trace so the last state of each trace can be |
343 | // drawn | |
c1c69938 FC |
344 | for (LttngTraceState traceModel : traceToTraceStateModel.values()) { |
345 | // Take the trace model from traceToTraceStateModel list since it has a copy | |
346 | // of the state | |
347 | LttngSyntheticEvent finishEvent = new LttngSyntheticEvent(fStatusEvent); | |
348 | finishEvent.setSequenceInd(SequenceInd.ENDREQ); | |
349 | finishEvent.setTraceModel(traceModel); | |
350 | ||
351 | fmainRequest.handleData(finishEvent); | |
352 | } | |
353 | ||
354 | if(isSuccess) { | |
355 | // Finish main request | |
356 | fmainRequest.done(); | |
357 | } | |
358 | else { | |
359 | // Cancel main request | |
360 | fmainRequest.cancel(); | |
361 | ||
362 | } | |
5d10d135 ASL |
363 | } |
364 | ||
365 | /** | |
366 | * Reset provider to a state ready to begin thread execution | |
367 | * | |
368 | * @param experimentNode | |
369 | */ | |
550d787e | 370 | public synchronized void reset(LTTngTreeNode experimentNode) { |
c1c69938 FC |
371 | |
372 | conditionallyCancelRequests(); | |
5d10d135 | 373 | |
550d787e | 374 | fEventProviderRequests.clear(); |
5d10d135 ASL |
375 | startIndSent = false; |
376 | ||
377 | // set of base event providers | |
378 | if (fExperiment != null) { | |
379 | LTTngTreeNode[] traces = fExperiment.getChildren(); | |
380 | for (LTTngTreeNode trace : traces) { | |
381 | IStateTraceManager traceBaseEventProvider = (IStateTraceManager) trace; | |
3f2b9283 | 382 | fEventProviderRequests.add(traceBaseEventProvider); |
5d10d135 ASL |
383 | } |
384 | } | |
385 | ||
386 | if (fExperiment != experimentNode) { | |
387 | updateExperimentNode(experimentNode); | |
388 | } | |
389 | } | |
390 | ||
391 | /** | |
392 | * Point to a new experiment reference | |
393 | * | |
394 | * @param experiment | |
395 | */ | |
396 | private synchronized void updateExperimentNode(LTTngTreeNode experiment) { | |
f9673903 FC |
397 | if (experiment != null |
398 | && experiment.getValue() instanceof TmfExperiment<?>) { | |
5d10d135 ASL |
399 | fExperiment = experiment; |
400 | } else { | |
401 | TraceDebug | |
9c4eb5f7 | 402 | .debug("Experiment received is not instance of TmfExperiment: " //$NON-NLS-1$ |
f9673903 | 403 | + experiment.getClass().getName()); |
5d10d135 ASL |
404 | } |
405 | } | |
406 | ||
407 | /* | |
408 | * (non-Javadoc) | |
409 | * | |
f9673903 FC |
410 | * @see |
411 | * org.eclipse.linuxtools.tmf.component.TmfDataProvider#sendRequest(org. | |
5d10d135 ASL |
412 | * eclipse.linuxtools.tmf.request.TmfDataRequest) |
413 | */ | |
cb866e08 | 414 | @Override |
550d787e | 415 | public void sendRequest(final ITmfDataRequest<LttngSyntheticEvent> request) { |
c1c69938 FC |
416 | synchronized (this) { |
417 | if (!fIsExperimentNotified) { | |
418 | @SuppressWarnings("unchecked") | |
419 | TmfExperiment<LttngSyntheticEvent> experiment = (TmfExperiment<LttngSyntheticEvent>) TmfExperiment.getCurrentExperiment(); | |
420 | if (experiment != null) { | |
421 | experiment.notifyPendingRequest(true); | |
422 | fIsExperimentNotified = true; | |
423 | } | |
424 | } | |
425 | } | |
426 | ||
5d10d135 ASL |
427 | super.sendRequest(request); |
428 | if (waitForRequest) { | |
429 | try { | |
430 | request.waitForCompletion(); | |
431 | } catch (InterruptedException e) { | |
432 | e.printStackTrace(); | |
433 | } | |
434 | } | |
435 | } | |
436 | ||
437 | /** | |
438 | * @return the waitForRequest | |
439 | */ | |
440 | public boolean isWaitForRequest() { | |
441 | return waitForRequest; | |
442 | } | |
443 | ||
444 | /** | |
445 | * @param waitForRequest | |
446 | * configures the provider to wait for the request completion | |
447 | */ | |
448 | public void setWaitForRequest(boolean waitForRequest) { | |
449 | this.waitForRequest = waitForRequest; | |
450 | } | |
451 | ||
cb866e08 | 452 | @Override |
3d62f8b7 FC |
453 | public LttngSyntheticEvent getNext(ITmfContext context) { |
454 | try { | |
455 | fmainRequest.waitForCompletion(); | |
456 | } catch (InterruptedException e) { | |
457 | e.printStackTrace(); | |
458 | } | |
459 | return null; | |
cb866e08 FC |
460 | } |
461 | ||
c1c69938 FC |
462 | /** |
463 | * Cancels the ongoing requests for this data provider if necessary | |
464 | */ | |
465 | public synchronized void conditionallyCancelRequests() { | |
466 | if ((fSubRequest != null) && (!fSubRequest.isCompleted())) { | |
467 | ||
9c4eb5f7 | 468 | TraceDebug.debug("Canceling synthethic event request!"); //$NON-NLS-1$ |
c1c69938 FC |
469 | |
470 | // This will also cancel the fmainRequest | |
471 | fSubRequest.cancel(); | |
472 | // Reset the request references | |
473 | fSubRequest = null; | |
474 | fmainRequest = null; | |
475 | } | |
476 | } | |
a79913eb FC |
477 | |
478 | @Override | |
479 | protected void queueBackgroundRequest(ITmfDataRequest<LttngSyntheticEvent> request, int blockSize, boolean indexing) { | |
480 | // do not split background synthetic requests | |
481 | queueRequest(request); | |
482 | } | |
5d10d135 | 483 | } |