Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
51b78f9
Internalize TaskExtensions
cptjazz Feb 22, 2020
23f353f
Remove unused methods from DeprecatedSchedulerExtensions. Those were …
cptjazz Feb 22, 2020
c3eba4b
Review Cancelables and clean up XML comments.
cptjazz Feb 22, 2020
737fcf0
Make remaining DeprecatedSchedulerExtensions methods internal.
cptjazz Feb 22, 2020
85a037a
Internalize DedicatedThreadScheduler -- obsolete since 1.1.2
cptjazz Feb 22, 2020
d46193f
Remove obsolete (since 1.1.2) methods on SupervisorStrategy
cptjazz Feb 22, 2020
2d4266f
Remove obsolete methods on ByteString.
cptjazz Feb 22, 2020
1964b8b
Remove obsolete (since 1.1.3) methods on ListPriorityQueue.
cptjazz Feb 22, 2020
141fc1b
Update public API list.
cptjazz Feb 22, 2020
e83d869
Update public API list.
cptjazz Feb 22, 2020
9210243
Internalize obsolete constructors for FSM types that should only be a…
cptjazz Feb 23, 2020
7ff2bca
Remove obsolete method (since 1.1.2) in SupervisorStrategy.
cptjazz Feb 23, 2020
c37f07b
Remove obsolete, unused method in CoordinatedShutdown
cptjazz Feb 23, 2020
54bcb8d
Minor cleanups for Children Containers by using new language features…
cptjazz Feb 23, 2020
3070df9
Update public API list.
cptjazz Feb 23, 2020
7b8473a
Removed obsolete DedicatedThreadScheduler and used HashedWheelTimerSc…
cptjazz Feb 24, 2020
4423da4
Internalize TaskExtensions
cptjazz Feb 22, 2020
415cc37
Remove unused methods from DeprecatedSchedulerExtensions. Those were …
cptjazz Feb 22, 2020
d10ec6d
Review Cancelables and clean up XML comments.
cptjazz Feb 22, 2020
1f4d758
Make remaining DeprecatedSchedulerExtensions methods internal.
cptjazz Feb 22, 2020
dcf056b
Internalize DedicatedThreadScheduler -- obsolete since 1.1.2
cptjazz Feb 22, 2020
df406d6
Remove obsolete (since 1.1.2) methods on SupervisorStrategy
cptjazz Feb 22, 2020
c0b25d3
Remove obsolete methods on ByteString.
cptjazz Feb 22, 2020
80f6ced
Remove obsolete (since 1.1.3) methods on ListPriorityQueue.
cptjazz Feb 22, 2020
848837b
Update public API list.
cptjazz Feb 22, 2020
2c23267
Update public API list.
cptjazz Feb 22, 2020
f735802
Internalize obsolete constructors for FSM types that should only be a…
cptjazz Feb 23, 2020
fdad5f8
Remove obsolete method (since 1.1.2) in SupervisorStrategy.
cptjazz Feb 23, 2020
23db013
Remove obsolete, unused method in CoordinatedShutdown
cptjazz Feb 23, 2020
f206ad7
Minor cleanups for Children Containers by using new language features…
cptjazz Feb 23, 2020
c1ebca2
Update public API list.
cptjazz Feb 23, 2020
a9bf1ac
Removed obsolete DedicatedThreadScheduler and used HashedWheelTimerSc…
cptjazz Feb 24, 2020
48fd195
Fixup rebase: update public API list
cptjazz Feb 25, 2020
b1aeb11
Merge branch 'internalize_types_2' of github.com:cptjazz/akka.net int…
cptjazz Feb 25, 2020
fece9d1
Merge branch 'dev' into internalize_types_2
Aaronontheweb Feb 27, 2020
71f32f2
Merge branch 'dev' into internalize_types_2
Aaronontheweb Feb 27, 2020
cfaaecb
Merge branch 'dev' into internalize_types_2
Aaronontheweb Feb 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 1 addition & 99 deletions src/core/Akka.API.Tests/CoreAPISpec.ApproveCore.approved.txt

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions src/core/Akka.TestKit/DelegatingSupervisorStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ protected override Directive Handle(IActorRef child, Exception exception)
{
throw new NotImplementedException();
}

protected override void ProcessFailure(IActorContext context, bool restart, Exception cause, ChildRestartStats failedChildStats,
IReadOnlyCollection<ChildRestartStats> allChildren)
{
Delegates[failedChildStats.Child].ProcessFailure(context, restart, failedChildStats.Child, cause, failedChildStats, allChildren);
}


public override void ProcessFailure(IActorContext context, bool restart, IActorRef child, Exception cause, ChildRestartStats stats,
IReadOnlyCollection<ChildRestartStats> children)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void When_ScheduleOnce_using_canceled_Cancelable_Then_their_actions_shoul
public void When_ScheduleRepeatedly_using_canceled_Cancelable_Then_their_actions_should_not_be_invoked()
{
// Prepare, set up actions to be fired
IActionScheduler scheduler = new DedicatedThreadScheduler(Sys.Settings.Config, Log);
IActionScheduler scheduler = new HashedWheelTimerScheduler(Sys.Settings.Config, Log);

try
{
Expand All @@ -61,7 +61,7 @@ public void When_ScheduleRepeatedly_using_canceled_Cancelable_Then_their_actions
public void When_ScheduleOnce_and_then_canceling_before_they_occur_Then_their_actions_should_not_be_invoked()
{
// Prepare, set up actions to be fired
IActionScheduler scheduler = new DedicatedThreadScheduler(Sys.Settings.Config, Log);
IActionScheduler scheduler = new HashedWheelTimerScheduler(Sys.Settings.Config, Log);

try
{
Expand All @@ -82,7 +82,7 @@ public void When_ScheduleOnce_and_then_canceling_before_they_occur_Then_their_ac
public void When_ScheduleRepeatedly_and_then_canceling_before_they_occur_Then_their_actions_should_not_be_invoked()
{
// Prepare, set up actions to be fired
IActionScheduler scheduler = new DedicatedThreadScheduler(Sys.Settings.Config, Log);
IActionScheduler scheduler = new HashedWheelTimerScheduler(Sys.Settings.Config, Log);

try
{
Expand All @@ -103,7 +103,7 @@ public void When_ScheduleRepeatedly_and_then_canceling_before_they_occur_Then_th
public void When_canceling_existing_running_repeaters_Then_their_future_actions_should_not_be_invoked()
{
// Prepare, set up actions to be fired
IActionScheduler scheduler = new DedicatedThreadScheduler(Sys.Settings.Config, Log);
IActionScheduler scheduler = new HashedWheelTimerScheduler(Sys.Settings.Config, Log);

try
{
Expand All @@ -125,7 +125,7 @@ public void When_canceling_existing_running_repeaters_Then_their_future_actions_
public void When_canceling_existing_running_repeaters_by_scheduling_the_cancellation_ahead_of_time_Then_their_future_actions_should_not_be_invoked()
{
// Prepare, set up actions to be fired
IActionScheduler scheduler = new DedicatedThreadScheduler(Sys.Settings.Config, Log);
IActionScheduler scheduler = new HashedWheelTimerScheduler(Sys.Settings.Config, Log);

try
{
Expand Down
31 changes: 9 additions & 22 deletions src/core/Akka/Actor/Cancellation/AlreadyCanceledCancelable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,28 @@ namespace Akka.Actor
/// <summary>
/// A <see cref="ICancelable"/> that is already canceled.
/// </summary>
public class AlreadyCanceledCancelable : ICancelable
internal sealed class AlreadyCanceledCancelable : ICancelable
{
private static readonly AlreadyCanceledCancelable _instance = new AlreadyCanceledCancelable();

private AlreadyCanceledCancelable() { }

/// <summary>
/// TBD
/// </summary>
/// <inheritdoc/>
public void Cancel()
{
//Intentionally left blank
}

/// <summary>
/// TBD
/// </summary>
public bool IsCancellationRequested { get { return true; } }
/// <inheritdoc/>
public bool IsCancellationRequested => true;

/// <summary>
/// TBD
/// Gets an instance of an already canceled <see cref="ICancelable"/>.
/// </summary>
public static ICancelable Instance { get { return _instance; } }
public static ICancelable Instance => _instance;

/// <summary>
/// TBD
/// </summary>
public CancellationToken Token
{
get { return new CancellationToken(true); }
}
/// <inheritdoc/>
public CancellationToken Token => new CancellationToken(true);

void ICancelable.CancelAfter(TimeSpan delay)
{
Expand All @@ -55,11 +46,7 @@ void ICancelable.CancelAfter(int millisecondsDelay)
//Intentionally left blank
}

/// <summary>
/// TBD
/// </summary>
/// <param name="throwOnFirstException">TBD</param>
public void Cancel(bool throwOnFirstException)
void ICancelable.Cancel(bool throwOnFirstException)
{
//Intentionally left blank
}
Expand Down
70 changes: 14 additions & 56 deletions src/core/Akka/Actor/Cancellation/Cancelable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class Cancelable : ICancelable, IDisposable
private readonly CancellationTokenSource _source;

/// <summary>
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after the specified amount of time.
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after
/// the specified amount of time.
/// </summary>
/// <param name="scheduler">The scheduler.</param>
/// <param name="delay">The delay before the cancelable is canceled.</param>
Expand All @@ -31,9 +32,9 @@ public Cancelable(IActionScheduler scheduler, TimeSpan delay)
CancelAfter(delay);
}


/// <summary>
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after the specified amount of time.
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after
/// the specified amount of time.
/// </summary>
/// <param name="scheduler">The scheduler.</param>
/// <param name="delay">The delay before the cancelable is canceled.</param>
Expand All @@ -43,9 +44,9 @@ public Cancelable(IScheduler scheduler, TimeSpan delay)
CancelAfter(delay);
}


/// <summary>
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after the specified amount of milliseconds.
/// Initializes a new instance of the <see cref="Cancelable"/> class that will be cancelled after
/// the specified amount of milliseconds.
/// </summary>
/// <param name="scheduler">The scheduler.</param>
/// <param name="millisecondsDelay">The delay in milliseconds.</param>
Expand Down Expand Up @@ -83,76 +84,35 @@ internal Cancelable(IActionScheduler scheduler, CancellationTokenSource source)
}


/// <summary>
/// TBD
/// </summary>
public bool IsCancellationRequested
{
get { return _source.IsCancellationRequested; }
}
/// <inheritdoc/>
public bool IsCancellationRequested => _source.IsCancellationRequested;

/// <summary>
/// TBD
/// </summary>
public CancellationToken Token
{
get { return _source.Token; }
}
/// <inheritdoc/>
public CancellationToken Token => _source.Token;


/// <summary>
/// TBD
/// </summary>
/// <inheritdoc/>
public void Cancel()
{
Cancel(false);
}

/// <summary>
/// Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed.
/// </summary>
/// <param name="throwOnFirstException"><c>true</c> if exceptions should immediately propagate; otherwise, <c>false</c>.</param>
/// <remarks>
/// The associated cancelable will be notified of the cancellation and will transition to a state where
/// <see cref="IsCancellationRequested" /> returns <c>true</c>.
/// Any callbacks or cancelable operations registered with the cancelable will be executed.
/// Cancelable operations and callbacks registered with the token should not throw exceptions.
/// If <paramref name="throwOnFirstException" /> is <c>true</c>, an exception will immediately propagate out of
/// the call to Cancel, preventing the remaining callbacks and cancelable operations from being processed.
/// If <paramref name="throwOnFirstException" /> is <c>false</c>, this overload will aggregate any exceptions
/// thrown into an <see cref="AggregateException" />, such that one callback throwing an exception will not
/// prevent other registered callbacks from being executed.
/// The <see cref="ExecutionContext" /> that was captured when each callback was registered will be reestablished when the callback is invoked.
/// </remarks>
/// <exception cref="ObjectDisposedException">
/// This exception is thrown if this cancelable has already been disposed.
/// </exception>
/// <inheritdoc/>
public void Cancel(bool throwOnFirstException)
{
ThrowIfDisposed();
_source.Cancel(throwOnFirstException);
}


/// <summary>
/// Schedules a cancel operation on this cancelable after the specified delay.
/// </summary>
/// <param name="delay">The delay before this instance is canceled.</param>
/// <exception cref="ArgumentOutOfRangeException">This exception is thrown if the given <paramref name="delay"/> is less than or equal to 0.</exception>
/// <exception cref="ObjectDisposedException">This exception is thrown if this cancelable has already been disposed.</exception>
/// <inheritdoc/>
public void CancelAfter(TimeSpan delay)
{
if(delay < TimeSpan.Zero)
throw new ArgumentOutOfRangeException(nameof(delay), $"The delay must be >0, it was {delay}");
InternalCancelAfter(delay);
}

/// <summary>
/// Schedules a cancel operation on this cancelable after the specified number of milliseconds.
/// </summary>
/// <param name="millisecondsDelay">The delay in milliseconds before this instance is canceled.</param>
/// <exception cref="ArgumentOutOfRangeException">This exception is thrown if the given <paramref name="millisecondsDelay"/> is less than or equal to 0.</exception>
/// <exception cref="ObjectDisposedException">This exception is thrown if this cancelable has already been disposed.</exception>
/// <inheritdoc/>
public void CancelAfter(int millisecondsDelay)
{
if(millisecondsDelay < 0)
Expand Down Expand Up @@ -182,7 +142,6 @@ private void InternalCancelAfter(TimeSpan delay)
/// <summary>
/// Returns a <see cref="ICancelable"/> that has already been canceled.
/// </summary>
/// <returns>TBD</returns>
public static ICancelable CreateCanceled()
{
return AlreadyCanceledCancelable.Instance;
Expand All @@ -202,7 +161,6 @@ public static ICancelable CreateLinkedCancelable(IScheduler scheduler, params IC
return new Cancelable(scheduler.Advanced, cts);
}


/// <summary>
/// Creates a <see cref="ICancelable"/> that will be in the canceled state
/// when any of the source cancelables are in the canceled state.
Expand Down
5 changes: 2 additions & 3 deletions src/core/Akka/Actor/Cancellation/CancelableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Akka.Actor
{
/// <summary>
/// TBD
/// Provides extensions methods for <see cref="ICancelable"/>.
/// </summary>
public static class CancelableExtensions
{
Expand All @@ -18,9 +18,8 @@ public static class CancelableExtensions
/// <param name="cancelable">The cancelable. Will be canceled if it's not <c>null</c></param>
public static void CancelIfNotNull(this ICancelable cancelable)
{
if(cancelable != null) cancelable.Cancel();
cancelable?.Cancel();
}

}
}

24 changes: 14 additions & 10 deletions src/core/Akka/Actor/Cancellation/ICancelable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public interface ICancelable
/// <summary>
/// Communicates a request for cancellation.
/// </summary>
/// <remarks>The associated cancelable will be notified of the cancellation and will transition to a state where
/// <see cref="IsCancellationRequested"/> returns <c>true</c>.
/// <remarks>The associated cancelable will be notified of the cancellation and will transition
/// to a state where <see cref="IsCancellationRequested"/> returns <c>true</c>.
/// Any callbacks or cancelable operations registered with the cancelable will be executed.
/// Cancelable operations and callbacks registered with the token should not throw exceptions.
/// However, this overload of Cancel will aggregate any exceptions thrown into an
Expand All @@ -35,7 +35,7 @@ public interface ICancelable
bool IsCancellationRequested { get; }

/// <summary>
/// TBD
/// Gets the <see cref="CancellationToken"/> associated with this <see cref="ICancelable"/>.
/// </summary>
CancellationToken Token { get; }

Expand All @@ -52,19 +52,23 @@ public interface ICancelable
void CancelAfter(int millisecondsDelay);

/// <summary>
/// Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed.
/// Communicates a request for cancellation, and specifies whether remaining callbacks and
/// cancelable operations should be processed.
/// </summary>
/// <param name="throwOnFirstException"><c>true</c> if exceptions should immediately propagate; otherwise, <c>false</c>.</param>
/// <remarks>The associated cancelable will be notified of the cancellation and will transition to a state where
/// <see cref="IsCancellationRequested"/> returns <c>true</c>.
/// <param name="throwOnFirstException"><c>true</c> if exceptions should immediately propagate;
/// otherwise, <c>false</c>.</param>
/// <remarks>The associated cancelable will be notified of the cancellation and will transition
/// to a state where <see cref="IsCancellationRequested"/> returns <c>true</c>.
/// Any callbacks or cancelable operations registered with the cancelable will be executed.
/// Cancelable operations and callbacks registered with the token should not throw exceptions.
/// If <paramref name="throwOnFirstException"/> is <c>true</c>, an exception will immediately propagate out of
/// the call to Cancel, preventing the remaining callbacks and cancelable operations from being processed.
/// If <paramref name="throwOnFirstException"/> is <c>true</c>, an exception will immediately
/// propagate out of the call to Cancel, preventing the remaining callbacks and cancelable operations
/// from being processed.
/// If <paramref name="throwOnFirstException"/> is <c>false</c>, this overload will aggregate any exceptions
/// thrown into an <see cref="AggregateException"/>, such that one callback throwing an exception will not
/// prevent other registered callbacks from being executed.
/// The <see cref="ExecutionContext"/> that was captured when each callback was registered will be reestablished when the callback is invoked.</remarks>
/// The <see cref="ExecutionContext"/> that was captured when each callback was registered will be
/// reestablished when the callback is invoked.</remarks>
void Cancel(bool throwOnFirstException);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using Akka.Util.Internal.Collections;

namespace Akka.Actor.Internal
{
Expand Down Expand Up @@ -183,8 +182,7 @@ public bool TryGetByRef(IActorRef actor, out ChildRestartStats childRestartStats
/// <returns>TBD</returns>
public bool Contains(IActorRef actor)
{
ChildRestartStats stats;
return TryGetByRef(actor, out stats);
return TryGetByRef(actor, out _);
}

/// <summary>
Expand Down
11 changes: 4 additions & 7 deletions src/core/Akka/Actor/ChildrenContainer/Internal/SuspendReason.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@ public class Creation : SuspendReason, IWaitingForChildren
/// </summary>
public class Recreation : SuspendReason, IWaitingForChildren
{
private readonly Exception _cause;

/// <summary>
/// TBD
/// </summary>
/// <param name="cause">TBD</param>
public Recreation(Exception cause)
{
_cause = cause;
Cause = cause;
}

/// <summary>
/// TBD
/// </summary>
public Exception Cause { get { return _cause; } }
public Exception Cause { get; }
}

/// <summary>
Expand All @@ -63,12 +62,11 @@ public Recreation(Exception cause)
/// </summary>
public class Termination : SuspendReason
{
private static readonly Termination _instance = new Termination();
private Termination() { }
/// <summary>
/// TBD
/// </summary>
public static Termination Instance { get { return _instance; } }
public static Termination Instance { get; } = new Termination();
}

/// <summary>
Expand All @@ -77,12 +75,11 @@ private Termination() { }
/// </summary>
public class UserRequest : SuspendReason
{
private static readonly UserRequest _instance = new UserRequest();
private UserRequest() { }
/// <summary>
/// TBD
/// </summary>
public static UserRequest Instance { get { return _instance; } }
public static UserRequest Instance { get; } = new UserRequest();
}
}
}
Expand Down
Loading