public IInvokable RegisterInvokable(InvokableInfo info, Delegate del)
        {
            IInvokable invokable = InvokableFactory.MakeInvokable(info, del);

            RegisterInvokable(invokable);
            return(invokable);
        }
Beispiel #2
0
        public static bool MayInterleave(IInvokable req)
        {
            // not interested
            if (req.ArgumentCount == 0)
            {
                return(false);
            }

            string arg = null;

            // assume single argument message
            if (req.ArgumentCount == 1)
            {
                arg = (string)UnwrapImmutable(req.GetArgument <object>(0));
            }

            // assume stream message
            if (req.ArgumentCount == 2)
            {
                arg = (string)UnwrapImmutable(req.GetArgument <object>(1));
            }

            if (arg == "err")
            {
                throw new ApplicationException("boom");
            }

            return(arg == "reentrant");
        }
Beispiel #3
0
 protected void AddActorHandler(Address address, IInvokable invokable)
 {
     if (ChannelTree.Add(address, invokable))
     {
         invokable.OnAdd(address, new Invoker(this));
     }
 }
Beispiel #4
0
        public PartialCall(IInvokable function)
        {
            Function = function;
            ArgumentsLeft = function.Signature.InputSignature.Count;

            Expecting = GetExpecting();
        }
Beispiel #5
0
        public int RaiseEvent(byte[] buffer, uint cb)
        {
#pragma warning disable 6500
            try
            {
                Verify();
                IInvokable invokable = (IInvokable)target.Target;
                if (invokable != null)
                {
                    invokable.RaiseEvent(buffer, (int)cb);
                }
                else
                {
                    // return E_HANDLE to notify that object is no longer alive

                    return(NativeMethods.E_HANDLE);
                }
            }
            catch (Exception e)
            {
                return(Marshal.GetHRForException(e));
            }
#pragma warning restore 6500

            return(NativeMethods.S_OK);
        }
        public IInvokable RegisterInvokable(InvokableInfo info, EventInfo eventInfo, object instance = null)
        {
            IInvokable invokable = InvokableFactory.MakeInvokable(info, eventInfo, instance);

            RegisterInvokable(invokable);
            return(invokable);
        }
        private void EvaluateFunctionCall(IScriptContext context)
        {
            EvaluateIdentifier(context);

            foreach (ScriptAst node in Modifiers)
            {
                ScriptFunctionCall funcCall = node as ScriptFunctionCall;
                if (funcCall != null)
                {
                    IInvokable function = context.Result as IInvokable;
                    if (function == null)
                    {
                        throw new ScriptException("Is not a function type");
                    }
                    context.Result = CallFunction(function, funcCall, context);
                    continue;
                }

                ScriptArrayResolution arrayResolution = node as ScriptArrayResolution;
                if (arrayResolution != null)
                {
                    GetArrayValue(context.Result, arrayResolution, context);
                    continue;
                }

                ScriptGenericsPostfix genericPostfix = node as ScriptGenericsPostfix;
                if (genericPostfix != null)
                {
                    throw new NotSupportedException();
                    //genericPostfix.Evaluate(Context);
                    //continue;
                }
            }
        }
        public IInvokable RegisterInvokable(InvokableInfo info, MethodInfo methodInfo, object instance = null)
        {
            IInvokable invokable = InvokableFactory.MakeInvokable(info, methodInfo, instance);

            RegisterInvokable(invokable);
            return(invokable);
        }
Beispiel #9
0
        internal static void RemoveEvent(EventInfo ei, object targetObject, IInvokable function)
        {
            Dictionary <EventInfo, List <InvocationInfo> > targetSubscriptions;

            if (Subscriptions.TryGetValue(targetObject, out targetSubscriptions))
            {
                List <InvocationInfo> eventSubscriptions;
                if (targetSubscriptions.TryGetValue(ei, out eventSubscriptions))
                {
                    foreach (InvocationInfo invocation_info in eventSubscriptions)
                    {
                        if (invocation_info.HandlerFunction != function)
                        {
                            continue;
                        }

                        ei.RemoveEventHandler(targetObject, invocation_info.HandlerDelegate);
                        eventSubscriptions.Remove(invocation_info);

                        if (eventSubscriptions.Count == 0)
                        {
                            targetSubscriptions.Remove(ei);
                        }

                        break;
                    }
                }

                if (eventSubscriptions.Count == 0)
                {
                    Subscriptions.Remove(targetObject);
                }
            }
        }
        public void Invoke(int notificationId, IInvokable message)
        {
            // Keep processing order

            if (_isKeepingOrder)
            {
                var expectedNotification = _lastNotificationId + 1;
                if (expectedNotification <= 0)
                {
                    expectedNotification = 1;
                }

                if (expectedNotification != notificationId)
                {
                    // keep outOfOrderQueue in order
                    var fi = _outOfOrderQueue.FindIndex(i => notificationId < i.Item1);
                    if (fi != -1)
                    {
                        _outOfOrderQueue.Insert(fi, Tuple.Create(notificationId, message));
                    }
                    else
                    {
                        _outOfOrderQueue.Add(Tuple.Create(notificationId, message));
                    }
                    return;
                }

                _lastNotificationId = expectedNotification;
            }

            // Process message

            InvokeInternal(message);

            // Check outOfOrderQueue if we can process further messages in order

            if (_isKeepingOrder)
            {
                while (_outOfOrderQueue.Count > 0)
                {
                    var expectedId = _lastNotificationId + 1;
                    if (expectedId <= 0)
                    {
                        expectedId = 1;
                    }

                    var item = _outOfOrderQueue[0];
                    if (expectedId != item.Item1)
                    {
                        break;
                    }

                    _outOfOrderQueue.RemoveAt(0);
                    _lastNotificationId = expectedId;

                    InvokeInternal(item.Item2);
                }
            }
        }
 public void Invoke()
 {
     while (this.invokables.Any())
     {
         IInvokable invokable = this.invokables.Pop();
         invokable.Invoke();
     }
 }
Beispiel #12
0
 public static void RemoveEvent(EventInfo ei, object targetObject, IInvokable function)
 {
     if (subscriptions[targetObject].ContainsKey(ei))
     {
         ei.RemoveEventHandler(targetObject, subscriptions[targetObject][ei]);
         subscriptions[targetObject].Remove(ei);
     }
 }
Beispiel #13
0
        public bool AddActor(Address address, IInvokable actor)
        {
            var node = GetNodeOrCreateByPath(address);

            Debug.Log($"add actor to: {node.Address}");
            node._invokable = actor;
            return(true);
        }
Beispiel #14
0
        public void SendRequest(GrainReference target, IInvokable request, IResponseCompletionSource context, InvokeMethodOptions options)
        {
            var message = this.messageFactory.CreateMessage(request, options);

            OrleansOutsideRuntimeClientEvent.Log.SendRequest(message);

            SendRequestMessage(target, message, context, options);
        }
 public DataProcessor(IInvokable invoke, INotifiable notify, ILobby lobby) {
     if(invoke != null)
         _invokable = new Invokable(invoke);
     if(notify != null)
         _notifiable = new Notifiable(notify);
     if (lobby != null)
         _lobby = new Lobby(lobby);
 }
Beispiel #16
0
 public void Dispose()
 {
     if (invokable != null && invokable.Manager != null)
     {
         AutoInvokableBase.Manager.UnregisterInvokable(invokable);
     }
     invokable = null;
 }
Beispiel #17
0
 public GoGame(IInvokable onUpdate, IInvokable onDraw)
 {
     this.onUpdate         = onUpdate;
     this.onDraw           = onDraw;
     graphics              = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     IsMouseVisible        = true;
 }
    public CommunicationHandler(TcpClient serverCon, IErrorHandler error, IInvokable invoke, INotifiable notify, ILobby lobby) {
        _errorHandler = error;
        _tcpClient = serverCon;
        _tcpClient.DataReceived += TcpClient_DataReceived;
        _tcpClient.Disconnected += TcpClient_Disconnnected; 
        _tcpClient.Start();

        _processor = new DataProcessor(invoke, notify, lobby);
    }
Beispiel #19
0
        ///Calls a custom function in the flowgraph async. When the function is done, it will callback with return value
        public void CallFunctionAsync(string name, System.Action <object> callback, params object[] args)
        {
            IInvokable func = null;

            if (functions.TryGetValue(name, out func))
            {
                func.InvokeAsync(callback, args);
            }
        }
 public void RegisterInvokable(IInvokable invokable)
 {
     if (invokable.Manager != null && invokable.Manager != this)
     {
         invokable.Manager.UnregisterInvokable(invokable);
     }
     invokable.Manager = this;
     baseManager.RegisterObject(invokable);
 }
Beispiel #21
0
            internal static WhenStep When(Scenario scenario, IInvokable invokable)
            {
                scenario.NewWhenStep();
                scenario.Step("When({0})", invokable.GetType().Name);
                scenario.InjectDependencies(invokable);

                scenario.InvokeOrFail(invokable.Invoke);
                return(new WhenStep(scenario));
            }
Beispiel #22
0
 public InvokableNode(IInvokable invokable)
     : base((invokable != null) ? invokable.Name : "Virtual")
 {
     Invokable = invokable;
     if (invokable != null)
     {
         BindArgsToTweakables();
     }
 }
        public CommunicationHandler(IInvokable invokable, IRequestable requestable) {
            _client = new UdpClient(Properties.Settings.Default.DefaultPort);
            _client.DataReceived += UdpClient_DataReceived;
            _client.Start();
            Console.WriteLine($"Started listening on udp port: {Properties.Settings.Default.DefaultPort}");

            _processor = new DataProcessor(_client, invokable, requestable);

        }
Beispiel #24
0
        /// <summary>
        /// Registers an <see cref="IInvokable"/> implementation to the <see cref="ITransaction"/>.
        /// </summary>
        /// <param name="invokation">The invokation to register.</param>
        /// <exception cref="ArgumentNullException"><paramref name="invokation"/> is a <see langword="null"/> reference.</exception>
        public void RegisterInvokation(IInvokable invokation)
        {
            if (invokation == null)
            {
                throw new ArgumentNullException("transaction");
            }

            this.invokables.Push(invokation);
        }
Beispiel #25
0
 public AutoInvokable(string name, Delegate del, IBoundInstance instance = null, string description = "", string[] argDescriptions = null, string returnDescription = "")
 {
     if (CheckForManager())
     {
         uint   num   = instance?.UniqueId ?? 0;
         string name2 = $"{name}#{num}";
         invokable = AutoInvokableBase.Manager.RegisterInvokable(new InvokableInfo(name2, num, CustomTweakerAttributes.Get(del.Method), description, argDescriptions, returnDescription), del);
     }
 }
Beispiel #26
0
    private void AddActorInternal(Address address, IInvokable invokable)
    {
        if (_core == null)
        {
            RunCoreAtMainTread();
        }

        _core.AddActorHandler(address, invokable);
    }
Beispiel #27
0
        public static void InvokeConstructor(Machine machine, IInvokable invokable, Arguments arguments, Fields fields)
        {
            var returnAddress = machine.Address + 1;
            var frame         = new Frame(returnAddress, arguments, fields);

            machine.PushFrame(frame);
            frame.SetFields(invokable.Parameters);
            machine.GoTo(invokable.Address);
        }
Beispiel #28
0
        public static void InvokeIfNeeded(IInvokable control, Action method)
        {
            if (control.InvokeRequired)
            {
                control.Invoke(new Action(() => InvokeIfNeeded(control, method)));
                return;
            }

            method();
        }
Beispiel #29
0
 public void Deconstruct(out Selector selector, out Parameters parameters, out Block block, out bool yielding,
                         out IInvokable invokable, out bool overriding)
 {
     selector   = this.selector;
     parameters = this.parameters;
     block      = this.block;
     yielding   = this.yielding;
     invokable  = GetInvokable();
     overriding = this.overriding;
 }
Beispiel #30
0
        ///Calls and returns a value of a custom function in the flowgraph
        public object CallFunction(string name, params object[] args)
        {
            IInvokable func = null;

            if (functions.TryGetValue(name, out func))
            {
                return(func.Invoke(args));
            }
            return(null);
        }
        public object Invoke(string name, params object[] args)
        {
            IInvokable @object = baseManager.GetObject(name);

            if (@object == null)
            {
                throw new NotFoundException(name);
            }
            return(Invoke(@object, args));
        }
        public void TestThatPageExists(IInvokable page)
        {
            page.Invoke();
            var pageClassName = page.GetType().ToString();

            Assert.IsTrue(page.Exists(), "Page should exist: " + pageClassName);
            
            Console.WriteLine(pageClassName + "Done. Current title is: "
                              + WebBrowser.Driver.Title);
        }
Beispiel #33
0
        ///Calls a custom function in the flowgraph async. When the function is done, it will callback with return value
        public void CallFunctionAsync(string name, System.Action <object> callback, params object[] args)
        {
            Debug.Assert(isRunning, "Trying to Execute Function but graph is not running");
            IInvokable func = null;

            if (functions.TryGetValue(name, out func))
            {
                func.InvokeAsync(callback, args);
            }
        }
Beispiel #34
0
        private PartialCall(Value arg, PartialCall last, bool right = false)
        {
            ArgumentsLeft = last.ArgumentsLeft - 1;
            if (right && ArgumentsLeft != 1) throw new RightArgumentPassedToNonInfixFunction();
            Function = last.Function;
            Argument = arg;
            this.last = last;
            this.right = right;

            Expecting = GetExpecting();
        }
Beispiel #35
0
            public object Invoke(IScriptContext context, object[] args)
            {
                IInvokable method = GetValue() as IInvokable;

                if (method != null)
                {
                    return(method.Invoke(context, args));
                }

                throw new ScriptIdNotFoundException(string.Format("Method {0} not found", name));
            }
Beispiel #36
0
        public GoGame(IInvokable onUpdate, IInvokable onDraw)
        {
            this.onUpdate = onUpdate;
            this.onDraw   = onDraw;
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth  = 640;
            this.graphics.PreferredBackBufferHeight = 480;

            this.Content.RootDirectory = "Content";
            this.IsMouseVisible        = true;
        }
        public void Invoke(int notificationId, IInvokable message)
        {
            // Keep processing order

            if (_isKeepingOrder)
            {
                var expectedNotification = _lastNotificationId + 1;
                if (expectedNotification <= 0)
                    expectedNotification = 1;

                if (expectedNotification != notificationId)
                {
                    // keep outOfOrderQueue in order
                    var fi = _outOfOrderQueue.FindIndex(i => notificationId < i.Item1);
                    if (fi != -1)
                        _outOfOrderQueue.Insert(fi, Tuple.Create(notificationId, message));
                    else
                        _outOfOrderQueue.Add(Tuple.Create(notificationId, message));
                    return;
                }

                _lastNotificationId = expectedNotification;
            }

            // Process message

            InvokeInternal(message);

            // Check outOfOrderQueue if we can process further messages in order

            if (_isKeepingOrder)
            {
                while (_outOfOrderQueue.Count > 0)
                {
                    var expectedId = _lastNotificationId + 1;
                    if (expectedId <= 0)
                        expectedId = 1;

                    var item = _outOfOrderQueue[0];
                    if (expectedId != item.Item1)
                        break;

                    _outOfOrderQueue.RemoveAt(0);
                    _lastNotificationId = expectedId;

                    InvokeInternal(item.Item2);
                }
            }
        }
Beispiel #38
0
 private void AddFunction(IInvokable func)
 {
     var partialCall = new PartialCall(func);
     AddFunction(partialCall);
 }
Beispiel #39
0
 public static void setDispatcher(IInvokable dispatcher)
 {
     _dispatcher = dispatcher;
 }
Beispiel #40
0
 private static object CallFunction(IInvokable functionDefinition, ScriptFunctionCall scriptFunctionCall, IScriptContext context)
 {
   scriptFunctionCall.Evaluate(context);
   return functionDefinition.Invoke(context, (object[])context.Result);
 }
 protected void Notify(IInvokable message)
 {
     Channel.Notify(new NotificationMessage { ObserverId = ObserverId, InvokePayload = message });
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxyInvokableAdapter"/> class.
 /// </summary>
 /// <param name="proxyType">Type of the proxy.</param>
 /// <param name="invokable">The invokable.</param>
 public ProxyInvokableAdapter(Type proxyType, IInvokable invokable)
     : base(proxyType)
 {
     this.invokable = invokable;
 }
 internal DataProcessor(UdpClient client, IInvokable invoke, IRequestable request) {
     _invoke = new Invoke(client, invoke);
     _request = new Request(client, request);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProxiedObjectIdentity"/> class.
 /// </summary>
 /// <param name="identityProvider">The identity provider.</param>
 /// <param name="next">The next object to be invoked.</param>
 public ProxiedObjectIdentity(object identityProvider, IInvokable next)
 {
     this.identityProvider = identityProvider;
     this.next = next;
 }
 public Invokable(IInvokable invoke) {
     _invoke = invoke;
 }
        internal static SafeMILHandle CreateEventProxyWrapper(IInvokable invokable)
        {
            if (invokable == null)
            {
                throw new System.ArgumentNullException("invokable");
            }

            SafeMILHandle eventProxy = null;

            EventProxyWrapper epw = new EventProxyWrapper(invokable);
            EventProxyDescriptor epd = new EventProxyDescriptor();

            epd.pfnDispose = EventProxyStaticPtrs.pfnDispose;
            epd.pfnRaiseEvent = EventProxyStaticPtrs.pfnRaiseEvent;

            epd.m_handle = System.Runtime.InteropServices.GCHandle.Alloc(epw, System.Runtime.InteropServices.GCHandleType.Normal);

            HRESULT.Check(MILCreateEventProxy(ref epd, out eventProxy));

            return eventProxy;
        }
 private EventProxyWrapper(IInvokable invokable)
 {
     target = new WeakReference(invokable);
 }
Beispiel #48
0
 public PartialApplication Merge(IInvokable function)
 {
     var appl = new PartialApplication(PotentialMatches.Clone(), Fixity, funcName);
     appl.AddFunction(function);
     return appl;
 }
 internal Invoke(UdpClient client, IInvokable invoke) {
     _client = client;
     _invoke = invoke;
 }
Beispiel #50
0
        internal async Task Invoke(IAddressable target, IInvokable invokable, Message message)
        {
            try
            {
                // Don't process messages that have already timed out
                if (message.IsExpired)
                {
                    message.DropExpiredMessage(MessagingStatisticsGroup.Phase.Invoke);
                    return;
                }

                //MessagingProcessingStatisticsGroup.OnRequestProcessed(message, "Invoked");
                if (Message.WriteMessagingTraces)
                    message.AddTimestamp(Message.LifecycleTag.InvokeIncoming);

                RequestContext.ImportFromMessage(message);
                if (Config.Globals.PerformDeadlockDetection && !message.TargetGrain.IsSystemTarget)
                {
                    UpdateDeadlockInfoInRequestContext(new RequestInvocationHistory(message));
                    // RequestContext is automatically saved in the msg upon send and propagated to the next hop
                    // in RuntimeClient.CreateMessage -> RequestContext.ExportToMessage(message);
                }

                var invoker = invokable.GetInvoker(message.InterfaceId, message.GenericGrainType);

                object resultObject;
                try
                {
                    var request = (InvokeMethodRequest) message.BodyObject;

                    if (invoker is IGrainExtensionMethodInvoker
                        && !(target is IGrainExtension))
                    {
                        // We are trying the invoke a grain extension method on a grain 
                        // -- most likely reason is that the dynamic extension is not installed for this grain
                        // So throw a specific exception here rather than a general InvalidCastException
                        var error = String.Format(
                            "Extension not installed on grain {0} attempting to invoke type {1} from invokable {2}", 
                            target.GetType().FullName, invoker.GetType().FullName, invokable.GetType().FullName);
                        var exc = new GrainExtensionNotInstalledException(error);
                        string extraDebugInfo = null;
#if DEBUG
                        extraDebugInfo = new StackTrace().ToString();
#endif
                        logger.Warn(ErrorCode.Stream_ExtensionNotInstalled, 
                            string.Format("{0} for message {1} {2}", error, message, extraDebugInfo), exc);

                        throw exc;
                    }
                    resultObject = await invoker.Invoke(target, request.InterfaceId, request.MethodId, request.Arguments);
                }
                catch (Exception exc1)
                {
                    if (invokeExceptionLogger.IsVerbose || message.Direction == Message.Directions.OneWay)
                    {
                        invokeExceptionLogger.Warn(ErrorCode.GrainInvokeException,
                            "Exception during Grain method call of message: " + message, exc1);
                    }
                    if (message.Direction != Message.Directions.OneWay)
                    {
                        SafeSendExceptionResponse(message, exc1);
                    }
                    return;
                }

                if (message.Direction == Message.Directions.OneWay) return;

                SafeSendResponse(message, resultObject);
            }
            catch (Exception exc2)
            {
                logger.Warn(ErrorCode.Runtime_Error_100329, "Exception during Invoke of message: " + message, exc2);
                if (message.Direction != Message.Directions.OneWay)
                    SafeSendExceptionResponse(message, exc2);             
            }
        }
        internal async Task Invoke(IAddressable target, IInvokable invokable, Message message)
        {
            try
            {
                // Don't process messages that have already timed out
                if (message.IsExpired)
                {
                    message.DropExpiredMessage(MessagingStatisticsGroup.Phase.Invoke);
                    return;
                }

                RequestContext.Import(message.RequestContextData);
                if (Config.Globals.PerformDeadlockDetection && !message.TargetGrain.IsSystemTarget)
                {
                    UpdateDeadlockInfoInRequestContext(new RequestInvocationHistory(message));
                    // RequestContext is automatically saved in the msg upon send and propagated to the next hop
                    // in RuntimeClient.CreateMessage -> RequestContext.ExportToMessage(message);
                }

                object resultObject;
                try
                {
                    var request = (InvokeMethodRequest) message.BodyObject;

                    var invoker = invokable.GetInvoker(request.InterfaceId, message.GenericGrainType);

                    if (invoker is IGrainExtensionMethodInvoker
                        && !(target is IGrainExtension))
                    {
                        // We are trying the invoke a grain extension method on a grain 
                        // -- most likely reason is that the dynamic extension is not installed for this grain
                        // So throw a specific exception here rather than a general InvalidCastException
                        var error = String.Format(
                            "Extension not installed on grain {0} attempting to invoke type {1} from invokable {2}", 
                            target.GetType().FullName, invoker.GetType().FullName, invokable.GetType().FullName);
                        var exc = new GrainExtensionNotInstalledException(error);
                        string extraDebugInfo = null;
#if DEBUG
                        extraDebugInfo = new StackTrace().ToString();
#endif
                        logger.Warn(ErrorCode.Stream_ExtensionNotInstalled, 
                            string.Format("{0} for message {1} {2}", error, message, extraDebugInfo), exc);

                        throw exc;
                    }

                    // If the target has a grain-level interceptor or there is a silo-level interceptor, intercept the call.
                    var shouldCallSiloWideInterceptor = SiloProviderRuntime.Instance.GetInvokeInterceptor() != null && target is IGrain;
                    var intercepted = target as IGrainInvokeInterceptor;
                    if (intercepted != null || shouldCallSiloWideInterceptor)
                    {
                        // Fetch the method info for the intercepted call.
                        var implementationInvoker =
                            invocationMethodInfoMap.GetInterceptedMethodInvoker(target.GetType(), request.InterfaceId,
                                invoker);
                        var methodInfo = implementationInvoker.GetMethodInfo(request.MethodId);
                        if (shouldCallSiloWideInterceptor)
                        {
                            // There is a silo-level interceptor and possibly a grain-level interceptor.
                            var runtime = SiloProviderRuntime.Instance;
                            resultObject =
                                await runtime.CallInvokeInterceptor(methodInfo, request, target, implementationInvoker);
                        }
                        else
                        {
                            // The grain has an interceptor, but there is no silo-wide interceptor.
                            resultObject = await intercepted.Invoke(methodInfo, request, invoker);
                        }
                    }
                    else
                    {
                        // The call is not intercepted.
                        resultObject = await invoker.Invoke(target, request);
                    }
                }
                catch (Exception exc1)
                {
                    if (invokeExceptionLogger.IsVerbose || message.Direction == Message.Directions.OneWay)
                    {
                        invokeExceptionLogger.Warn(ErrorCode.GrainInvokeException,
                            "Exception during Grain method call of message: " + message, exc1);
                    }
                    if (message.Direction != Message.Directions.OneWay)
                    {
                        SafeSendExceptionResponse(message, exc1);
                    }
                    return;
                }

                if (message.Direction == Message.Directions.OneWay) return;

                SafeSendResponse(message, resultObject);
            }
            catch (Exception exc2)
            {
                logger.Warn(ErrorCode.Runtime_Error_100329, "Exception during Invoke of message: " + message, exc2);
                if (message.Direction != Message.Directions.OneWay)
                    SafeSendExceptionResponse(message, exc2);             
            }
        }
 public void SetUp()
 {
     receiver = new NamedObject("receiver");
     identityProvider = new NamedObject("identityProvider");
     next = new MockInvokable();
     id = new ProxiedObjectIdentity(identityProvider, next);
 }
Beispiel #53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Invoker"/> class.
 /// </summary>
 /// <param name="targetType">Type of the target. Can not be inferred from <paramref name="target"/> 
 /// because it could be a base type.</param>
 /// <param name="target">The target.</param>
 /// <param name="next">The next <see cref="IInvokable"/> to pass the invocation to, 
 /// if this instance is not responsible for the target type on an invocation.</param>
 public Invoker(Type targetType, object target, IInvokable next)
 {
     this.targetType = targetType;
     this.target = target;
     this.next = next;
 }
 private void InvokeInternal(IInvokable message)
 {
     if (_isPending)
     {
         if (_pendingMessages == null)
             _pendingMessages = new List<IInvokable>();
         _pendingMessages.Add(message);
     }
     else
     {
         foreach (var observer in _observers)
             message.Invoke(observer);
     }
 }