-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change InterfacedActor<T> to InterfacedActor #20
Ditch CRTP.
- Loading branch information
Showing
16 changed files
with
285 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Concurrent; | ||
|
||
namespace Akka.Interfaced | ||
{ | ||
public class InterfacedActorHandler | ||
{ | ||
public readonly RequestDispatcher RequestDispatcher; | ||
public readonly NotificationDispatcher NotificationDispatcher; | ||
public readonly MessageDispatcher MessageDispatcher; | ||
public readonly List<Func<object, IFilter>> PerInstanceFilterCreators; | ||
|
||
public InterfacedActorHandler(Type type) | ||
{ | ||
var filterHandlerBuilder = new FilterHandlerBuilder(type); | ||
|
||
var requestHandlerBuilder = new RequestHandlerBuilder(); | ||
RequestDispatcher = new RequestDispatcher( | ||
requestHandlerBuilder.Build(type, filterHandlerBuilder)); | ||
|
||
var notificationHandlerBuilder = new NotificationHandlerBuilder(); | ||
NotificationDispatcher = new NotificationDispatcher( | ||
notificationHandlerBuilder.Build(type, filterHandlerBuilder)); | ||
|
||
var messageHandlerBuilder = new MessageHandlerBuilder(); | ||
MessageDispatcher = new MessageDispatcher( | ||
messageHandlerBuilder.Build(type, filterHandlerBuilder)); | ||
|
||
PerInstanceFilterCreators = filterHandlerBuilder.PerInstanceFilterCreators; | ||
} | ||
} | ||
|
||
public static class InterfacedActorHandlerTable | ||
{ | ||
private static ConcurrentDictionary<Type, InterfacedActorHandler> s_table = | ||
new ConcurrentDictionary<Type, InterfacedActorHandler>(); | ||
|
||
public static InterfacedActorHandler Get(Type type) | ||
{ | ||
return s_table.GetOrAdd(type, t => new InterfacedActorHandler(t)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.