final IExperimentActivationListener listener,
final Function2<WriteGraph, Resource, Object> externalWrite,
final Consumer<Resource> successCallback)
+ {
+ createRun(session, vg,
+ experimentResource, experiment, experimentRunTypeURI,
+ listener, externalWrite, successCallback, true);
+ }
+
+ /**
+ * Create new experiment run in a selected virtual graph.
+ *
+ * @param session
+ * @param vg
+ * @param experimentResource
+ * @param experiment
+ * @param experimentRunTypeURI
+ * @param listener
+ * @param successCallback if non-null invoked with the created run resource
+ * as an argument, just before invoking
+ * listener.onExperimentActivated(experiment)
+ * @param attachDeactivationListener <code>true</code> to run for the created run-resource
+ * {@link #attachStateListener(Session, IExperiment, Resource)}
+ */
+ public static void createRun(
+ Session session,
+ VirtualGraph vg,
+ Resource experimentResource,
+ IExperiment experiment,
+ String experimentRunTypeURI,
+ IExperimentActivationListener listener,
+ Function2<WriteGraph, Resource, Object> externalWrite,
+ Consumer<Resource> successCallback,
+ boolean attachDeactivationListener)
{
final AtomicReference<Resource> run = new AtomicReference<>();
session.asyncRequest(new WriteRequest(vg) {
else
ErrorLogger.defaultLogError(e);
} else {
- attachStateListener(session, experiment, run.get());
+ if (attachDeactivationListener)
+ attachStateListener(session, experiment, run.get());
if (successCallback != null)
successCallback.accept(run.get());
if (listener != null)