public MsgDispatcher(Channel channel, MessageListener l, MembershipListener l2, RequestHandler req_handler, MessageResponder responder, bool deadlock_detection, bool concurrent_processing) { this.channel = channel; this._ncacheLog = ((GroupChannel)channel).NCacheLog; this.deadlock_detection = deadlock_detection; this.concurrent_processing = concurrent_processing; msg_listener = l; membership_listener = l2; _req_handler = req_handler; _msgResponder = responder; channel.UpHandler = this; start(); }
public void Initialize(IDictionary properties, string channelName, string domain, NodeIdentity identity, bool twoPhaseInitialization,bool isPor) { if (properties == null) throw new ArgumentNullException("properties"); try { if (properties.Contains("op-timeout")) { long val = Convert.ToInt64(properties["op-timeout"]); if (val < 60) val = 60; val = val * 1000; Timeout = val; } if (properties.Contains("notification-priority")) { string priority = Convert.ToString(properties["notification-priority"]); if (priority.ToLower() == "normal") _eventPriority = Priority.Normal; } IDictionary clusterProps = properties["cluster"] as IDictionary; string channelProps = ConfigHelper.GetClusterPropertyString(clusterProps, Timeout, isPor); string name = channelName != null? channelName.ToLower(): null ; if (clusterProps.Contains("group-id")) name = Convert.ToString(clusterProps["group-id"]); if (clusterProps.Contains("sub-group-id")) { _subgroupid = Convert.ToString(clusterProps["sub-group-id"]); if (_subgroupid != null) _subgroupid = _subgroupid.ToLower(); identity.SubGroupName = _subgroupid; } // ======================================= else _subgroupid = name; // ======================================= this.PopulateClusterNodes(new Hashtable(clusterProps)); if (name != null) name = name.ToLower(); if (_subgroupid != null) _subgroupid = _subgroupid.ToLower(); //A property or indexer may not be passed as an out or ref parameter. _channel = new GroupChannel(channelProps, _context.NCacheLog); Hashtable config = new Hashtable(); config["additional_data"] = CompactBinaryFormatter.ToByteBuffer(identity, _context.SerializationContext); _channel.down(new Event(Event.CONFIG, config)); _msgDisp = new MsgDispatcher(_channel, this, this, this, this, false, true); _channel.connect(name + domain, _subgroupid, identity.IsStartedAsMirror,twoPhaseInitialization); localIp = LocalAddress.IpAddress.ToString(); _msgDisp.start(); } catch (Exception e) { Dispose(); throw new ConfigurationException("Configuration Error: " + e.ToString(), e); } }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or /// resetting unmanaged resources. /// </summary> public void Dispose() { if (_msgDisp != null) { _msgDisp.stop(); _msgDisp = null; } if (_channel != null) { _channel.close(); _channel = null; } if (_asynHandler != null) { _asynHandler.Dispose(); } }
public MsgDispatcher(Channel channel, MessageListener l, MembershipListener l2, RequestHandler req_handler, MessageResponder responder, bool deadlock_detection):this(channel, l, l2, req_handler, responder, deadlock_detection, false) { }
public MsgDispatcher(Channel channel, MessageListener l, MembershipListener l2, RequestHandler req_handler, MessageResponder responder):this(channel, l, l2, req_handler, responder, false) { }