Exemplo n.º 1
0
        protected override bool isServiceRunning(TimeSpan timeout, string service)
        {
            bool isRunning = false;

            string host = ParseHostName(ServerName);

            NodeOSInfo osInfo = HostInfo.GetHostInfo(host);

            if (osInfo == null)
            {
                return(isRunning);
            }

            if (osInfo.HostOS == OSInfo.Linux)
            {
                ExecuteUnixServiceCommand(timeout, ServiceOptions.ISRUNNING, "");
                isRunning = isRunningOnUnix;
            }
            else
            {
                isRunning = base.isServiceRunning(timeout, ServiceNames.JVCACHE);
            }

            return(isRunning);
        }
Exemplo n.º 2
0
        public static NodeOSInfo GetHostInfo(string nodeIP)
        {
            NodeOSInfo nodeInfo;

            if (s_hostInfoMap.TryGetValue(nodeIP, out nodeInfo))
            {
                return(s_hostInfoMap[nodeIP]);
            }
            else
            {
                OSInfo osInfo = OSDetector.DetectOS(nodeIP);

                if (OSDetector.hostIP == null)
                {
                    return(null);
                }

                var detectedIP = OSDetector.hostIP;
                if (detectedIP != null)
                {
                    nodeIP = detectedIP;
                }

                if (osInfo == OSInfo.Linux)
                {
                    nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Linux);
                    AddHostInfo(nodeIP, nodeInfo);
                    return(nodeInfo);
                }
                else if (osInfo == OSInfo.Windows)
                {
                    nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Windows);
                    AddHostInfo(nodeIP, nodeInfo);
                    return(nodeInfo);
                }
                else
                {
                    nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Unknown);
                    AddHostInfo(nodeIP, nodeInfo);
                    return(nodeInfo);
                }
            }
        }
Exemplo n.º 3
0
        protected override void Restart(TimeSpan timeout, string service)
        {
            string host = ParseHostName(ServerName);

            NodeOSInfo osInfo = HostInfo.GetHostInfo(host);

            if (osInfo == null)
            {
                return;
            }

            if (osInfo.HostOS == OSInfo.Linux)
            {
                ExecuteUnixServiceCommand(timeout, ServiceOptions.RESTART, "");
            }
            else
            {
                base.Restart(timeout, ServiceNames.JVCACHE);
            }
        }
Exemplo n.º 4
0
        public override void RestartSvcAfterNICChanged(TimeSpan timeout, string previousServerNode)
        {
            string host = ParseHostName(previousServerNode);

            NodeOSInfo osInfo = HostInfo.GetHostInfo(host);

            if (osInfo == null)
            {
                return;
            }

            if (osInfo.HostOS == OSInfo.Linux)
            {
                ExecuteUnixServiceCommand(timeout, ServiceOptions.RESTARTNICCHANGE, previousServerNode);
            }
            else
            {
                base.Restart(timeout, ServiceNames.JVCACHE);
            }
        }
Exemplo n.º 5
0
 public void UpdateHostInfo(string nodeIP, NodeOSInfo nodeInfo)
 {
     s_hostInfoMap[nodeIP] = nodeInfo;
 }
Exemplo n.º 6
0
 public static void AddHostInfo(string nodeIP, NodeOSInfo nodeInfo)
 {
     s_hostInfoMap[nodeIP] = nodeInfo;
 }