You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Demo for showing custom implementation of Execution Path. This path, takes the data that is * captured from the MeasuredExecutionPath and passes it to FileExecutionPath and then the data * is written to the file. * <p>
209
-
* We need to override LogToken also, as for the code that is non contiguous all the measurements * are inside the log token that is handed over to the user by Snippet.startCapture() API * So if we want that our new execution to work for both kinds of APIs that ie. * The one passed through a lambda in Snippet.capture(lambda) and Snippet.startCapture()/LogToken.endCapture() * We need to override both the classes. */
208
+
* Demo for showing custom implementation of Execution Path. This path, takes the data that is * captured from the MeasuredExecutionPath and passes it to FileExecutionPath and then the data * is written to the file. * <p>
209
+
* We need to override LogToken also, as for the code that is non contiguous all the measurements * are inside the log token that is handed over to the user by Snippet.startCapture() API * So if we want that our new execution to work for both kinds of APIs that ie. * The one passed through a lambda in Snippet.capture(lambda) and Snippet.startCapture()/LogToken.endCapture()
210
+
* We need to override both the classes. */
211
+
210
212
public class FileExecutionPath extends Snippet.MeasuredExecutionPath {
211
213
212
-
@Override
214
+
@Override
213
215
public ILogToken startCapture(String tag) {
214
216
return super.startCapture(tag);
215
217
}
216
218
217
-
@NonNull
219
+
@NonNull
218
220
@Override public ExecutionContext capture(String message, Snippet.Closure closure) {
// Code to write to a file goes here, create a thread and write.
227
-
// Finally return a the execution context(could be the same or a new implementation) with some // of the details that you captured.
228
-
// NOTE: always put the relevant information on the context before you start doing IO // so that the execution path could return successfully. return context;
229
+
// Finally return a the execution context(could be the same or a new implementation) with some // of the details that you captured.
230
+
// NOTE: always put the relevant information on the context before you start doing IO // so that the execution path could return successfully.
231
+
return context;
229
232
}
230
233
231
-
@NonNull
234
+
@NonNull
232
235
@Override public ExecutionContext capture(Snippet.Closure closure) {
233
236
return super.capture(closure);
234
237
}
235
238
236
-
// We need to return a log token implementation that writes to a file when we call endCapture()
237
-
// APIs. // USE ExtendableLogToken for the above purpose @Override
239
+
// We need to return a log token implementation that writes to a file when we call endCapture()
240
+
// APIs. // USE ExtendableLogToken for the above purpose @Override
238
241
public ILogToken startCapture() {
239
242
return new ExtendableLogToken(super.startCapture());
0 commit comments