annotate Implab/Components/IRunnable.cs @ 266:254d1f255d87 v3

Добавлена метка v3.0.10 для набора изменений 74e048cbaac8
author cin
date Mon, 16 Apr 2018 19:45:18 +0300
parents f1696cdc3d7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
1 using System;
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
2 using System.Threading;
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
3 using System.Threading.Tasks;
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
4
240aa6994018 component model refactoring
cin
parents:
diff changeset
5 namespace Implab.Components {
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
6 /// <summary>
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
7 /// Interface for the component which performs a long running task.
208
7d07503621fe RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents: 205
diff changeset
8 /// </summary>
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
9 /// <remarks>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
10 /// The access to the runnable component should be sequential, the
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
11 /// componet should support asynchronous completion of the initiated
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
12 /// operation but operations itself must be initiated sequentially.
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
13 /// </remarks>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
14 public interface IRunnable {
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
15 /// <summary>
208
7d07503621fe RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)
cin
parents: 205
diff changeset
16 /// Starts this instance
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
17 /// </summary>
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
18 /// <remarks>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
19 /// This operation is cancellable and it's expected to move to
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
20 /// the failed state or just ignore the cancellation request,
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
21 /// </remarks>
262
f1696cdc3d7a Added IInitializable.Initialize() overload
cin
parents: 256
diff changeset
22 void Start();
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
23 void Start(CancellationToken ct);
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
24
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
25 /// <summary>
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
26 /// Stops this instance and releases all resources, after the
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
27 /// instance is stopped it is moved to Disposed state and
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
28 /// can't be reused.
203
4d9830a9bbb8 Added 'Fail' method to RunnableComponent which allows component to move from
cin
parents: 152
diff changeset
29 /// </summary>
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
30 /// <remarks>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
31 /// If the componet was in the starting state the pending operation
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
32 /// will be requested to cancel. The stop operatin will be
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
33 /// performed only if the component in the running state.
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
34 /// </remarks>
262
f1696cdc3d7a Added IInitializable.Initialize() overload
cin
parents: 256
diff changeset
35 void Stop();
250
9f63dade3a40 Working on runnable component
cin
parents: 208
diff changeset
36 void Stop(CancellationToken ct);
262
f1696cdc3d7a Added IInitializable.Initialize() overload
cin
parents: 256
diff changeset
37
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
38 /// <summary>
256
c52691faaf21 Removed obsolete App, ComponentContainer
cin
parents: 251
diff changeset
39 /// Current state of the componenet, dynamically reflects the current state.
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
40 /// </summary>
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
41 ExecutionState State { get; }
240aa6994018 component model refactoring
cin
parents:
diff changeset
42
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
43 /// <summary>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
44 /// Event to monitor the state of the component.
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
45 /// </summary>
205
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 203
diff changeset
46 event EventHandler<StateChangeEventArgs> StateChanged;
8200ab154c8a Added ResetState to RunnableComponent to reset in case of failure
cin
parents: 203
diff changeset
47
251
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
48 /// <summary>
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
49 /// The last error
7c7e9ad6fe4a Prerelease version of RunnableComponent
cin
parents: 250
diff changeset
50 /// </summary>
152
240aa6994018 component model refactoring
cin
parents:
diff changeset
51 Exception LastError { get; }
240aa6994018 component model refactoring
cin
parents:
diff changeset
52 }
240aa6994018 component model refactoring
cin
parents:
diff changeset
53 }
240aa6994018 component model refactoring
cin
parents:
diff changeset
54