예제 #1
0
        public void Deserialize(Runtime.Serialization.IO.CompactReader reader)
        {
           
            topology = reader.ReadObject() as string;
          
            opTimeout = reader.ReadInt32();
            statsRepInterval = reader.ReadInt32();
            useHeartBeat = reader.ReadBoolean();
            channel = reader.ReadObject() as Channel;
            bool nodeExists = reader.ReadBoolean();
            if (nodeExists)
            {
                nodes = new Dictionary<NodeIdentity, StatusInfo>();
                int count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    nodes.Add(reader.ReadObject() as NodeIdentity , reader.ReadObject() as StatusInfo);
                }
            }
        }
예제 #2
0
        public Cluster() 
        {
            channel = new Channel();

            nodes = new Dictionary<NodeIdentity, StatusInfo>();
        }
예제 #3
0
 private static Hashtable GetTcp(Channel channel, bool useHeartBeat)
 {
     Hashtable settings = new Hashtable();
     settings.Add("start_port", channel.TcpPort.ToString());
     settings.Add("port_range", channel.PortRange.ToString());
     settings.Add("connection_retries", channel.ConnectionRetries);
     settings.Add("connection_retry_interval", channel.ConnectionRetryInterval);
     settings.Add("use_heart_beat", useHeartBeat);
     return settings;
 }
예제 #4
0
 private static Hashtable GetGMS(Channel channel)
 {
     Hashtable settings = new Hashtable();
     settings.Add("join_retry_count", channel.JoinRetries.ToString());
     settings.Add("join_retry_timeout", channel.JoinRetryInterval.ToString());
     return settings;
 }
예제 #5
0
 private static Hashtable GetChannel(Channel channel, bool useHeartBeat)
 {
     Hashtable settings = new Hashtable();
     settings.Add("tcp", GetTcp(channel, useHeartBeat));
     settings.Add("tcpping", GetTcpPing(channel));
     settings.Add("pbcast.gms", GetGMS(channel));
     return settings;
 }
예제 #6
0
 private static Hashtable GetTcpPing(Channel channel)
 {
     Hashtable settings = new Hashtable();
     settings.Add("initial_hosts", channel.InitialHosts.ToString());
     settings.Add("num_initial_members", channel.NumInitHosts.ToString());
     settings.Add("port_range", channel.PortRange.ToString());
     return settings;
 }
예제 #7
0
 private static void GetGMS(Channel channel, Hashtable settings)
 {
     if (settings.ContainsKey("join_retry_count"))
         channel.JoinRetries = Convert.ToInt32(settings["join_retry_count"].ToString());
     if (settings.ContainsKey("join_retry_timeout"))
         channel.JoinRetryInterval = Convert.ToInt32(settings["join_retry_timeout"]);
 }
예제 #8
0
            private static void GetTcp(Channel channel, Hashtable settings)
            {
                if (settings.ContainsKey("start_port"))
                    channel.TcpPort = Convert.ToInt32(settings["start_port"]);
                if (settings.ContainsKey("port_range"))
                    channel.PortRange = Convert.ToInt32(settings["port_range"]);
                if (settings.ContainsKey("connection_retries"))
                    channel.ConnectionRetries = Convert.ToInt32(settings["connection_retries"]);
                if (settings.ContainsKey("connection_retry_interval"))
                    channel.ConnectionRetryInterval = Convert.ToInt32(settings["connection_retry_interval"]);

            }
예제 #9
0
 private static void GetTcpPing(Channel channel, Hashtable settings)
 {
     if (settings.ContainsKey("initial_hosts"))
         channel.InitialHosts = settings["initial_hosts"].ToString();
     if (settings.ContainsKey("num_initial_members"))
         channel.NumInitHosts = Convert.ToInt32(settings["num_initial_members"]);
     if (settings.ContainsKey("port_range"))
         channel.PortRange = Convert.ToInt32(settings["port_range"]);
 }
예제 #10
0
 private static Channel GetChannel(Hashtable settings, int defaultPortRange)
 {
     Channel channel = new Channel(defaultPortRange);
     if (settings.ContainsKey("tcp"))
         GetTcp(channel, (Hashtable)settings["tcp"]);
     if (settings.ContainsKey("tcpping"))
         GetTcpPing(channel, (Hashtable)settings["tcpping"]);
     if (settings.ContainsKey("pbcast.gms"))
         GetGMS(channel, (Hashtable)settings["pbcast.gms"]);
     return channel;
 }
예제 #11
0
 public object Clone()
 {
     Channel channel = new Channel();
     channel.TcpPort = TcpPort;
     channel.PortRange = PortRange;
     channel.ConnectionRetries = ConnectionRetries;
     channel.ConnectionRetryInterval = ConnectionRetryInterval;
     channel.InitialHosts = InitialHosts != null ? (string) InitialHosts.Clone(): null;
     channel.NumInitHosts = NumInitHosts;
     return channel;
 }