Brunet.Messaging.RpcManager.AddHandler C# (CSharp) Метод

AddHandler() публичный Метод

public AddHandler ( string name_space, object handler ) : void
name_space string
handler object
Результат void
  public void AddHandler(string name_space, object handler)
  {
    lock( _sync ) {
      IRpcHandler h = handler as IRpcHandler;
      if( h == null ) {
        h = new ReflectionRpcHandler(this, handler, false);
      }
      _method_handlers.Add(name_space, h);
      _method_cache.Clear();
    }
  }
  /**

Usage Example

Пример #1
0
    //Methods:

    protected PathELManager(EdgeListener el, bool thread) {
      _el = el;
      _sync = new object();
      _edges = new List<Edge>();
      _unannounced = new Dictionary<Edge, PathEdge>();
      _pel_map = new Dictionary<string, PathEdgeListener>();
      //Use the reqrep protocol with a special prefix:
      _rrm = new ReqrepManager("PathELManager:" + el.ToString(), PType.Protocol.Pathing);
      _rrm.Subscribe(this, null);
      Rpc = new RpcManager(_rrm);
      Rpc.AddHandler("sys:pathing", this);
      _el.EdgeEvent += HandleEdge;
      _running = true;

      if(thread) {
        _timer_thread = new Thread(
          delegate() {
            int counter = 0;
            int max_counter = EDGE_PERIOD / 1000;
            while(_running) {
              Thread.Sleep(1000);
              ReqrepTimeoutChecker();
              if(++counter == max_counter) {
                counter = 0;
                EdgeTimeoutChecker();
              }
            }
          }
        );

        _timer_thread.IsBackground = true;
        _timer_thread.Start();
      }
    }
All Usage Examples Of Brunet.Messaging.RpcManager::AddHandler