private void TestActionHandler( object requestingSender, ActionRequestEventArgs e ) { }
protected internal void BufferActionRequest( object sender, ActionRequestEventArgs e ) { // exception handling not needed, this has to be fast // also buffer NULL // will be checked on dequeue later on lock ( this.actionRequestBufferLock ) { this.actionRequestBuffer.Enqueue( e ); } }
internal void AddMessageToBuffer( ActionRequestEventArgs args ) { if ( args == null ) { ArgumentNullException argnEx = new ArgumentNullException( "args", "The given event args must not be null." ); this.LogManager.Trace( Namespace.LoggerName, LogLevel.Fatal, argnEx, argnEx.Message ); throw argnEx; } lock ( this.messageBufferLock ) { this.messageBuffer.Enqueue( args ); } }
public void SendMessage( object requestingSender, string actionKey, params object[] actionParameters ) { if ( actionKey == null ) { ArgumentNullException argnEx = new ArgumentNullException( "actionKey" ); this.LogManager.Trace( Namespace.LoggerName, LogLevel.Fatal, argnEx, argnEx.Message ); throw argnEx; } DateTime requestTime = DateTime.Now; EventHandler<ActionRequestEventArgs> handlerDelegate = null; ActionRequestEventArgs args = new ActionRequestEventArgs( requestingSender, actionKey, requestTime, actionParameters ); lock ( this.messageHandlersLockObject ) { if ( this.messageHandlers.TryGetValue( actionKey, out handlerDelegate ) ) { this.AddMessageToBuffer( args ); } else { // handler unknown, ignore this.LogManager.Trace( Namespace.LoggerName, LogLevel.Debugging, "No handler for message type {0}.", actionKey ); } } lock ( this.messageHandlerAllMessagesLock ) { if ( this.messageHandlerAllMessages != null ) { this.messageHandlerAllMessages( requestingSender, args ); } } }
private void TestActionHandler( object requestingSender, ActionRequestEventArgs e ) { //this.LogManager.Trace( Namespace.LoggerName, LogLevel.Debugging, "TestExtension: HANDLING action request: " + e.ActionKey ); foreach ( object param in e.ActionParameters ) { //this.LogManager.Trace(Namespace.LoggerName, LogLevel.Debugging, "Param: " + param.ToString() ); } }
public void RequestAction( object requestingSender, string actionKey, params object[] actionParameters ) { DateTime requestTime = DateTime.Now; EventHandler<ActionRequestEventArgs> handlerDelegate = null; lock ( this.actionHandlersLockObject ) { try { this.actionHandlers.TryGetValue( actionKey, out handlerDelegate ); } catch ( ArgumentNullException ) { // TODO: ERROR // LOG? // actionKey was null throw; } } if ( handlerDelegate != null ) { ActionRequestEventArgs args = new ActionRequestEventArgs( requestingSender, actionKey, requestTime, actionParameters ); handlerDelegate.Invoke( requestingSender, args ); } }