Esempio n. 1
0
        private RedisRunner(IProcessWatcher processWatcher, IPortWatcher portWatcher, IRedisProcessStarter processStarter)
        {
            Port = RedisDefaults.DefaultPort;

            if (processWatcher.IsProcessRunning(RedisDefaults.ProcessName) && !portWatcher.IsPortAvailable(Port))
            {
                State = State.AlreadyRunning;
                return;
            }

            if (!portWatcher.IsPortAvailable(Port))
            {
                throw new PortTakenException(String.Format("Redis can't be started. The TCP port {0} is already taken.", this.Port));
            }

            _redisProcess = processStarter.Start(Port);

            State = State.Running;
        }
Esempio n. 2
0
 private RedisRunner(int port, IRedisProcess redisProcess)
 {
     Port          = port;
     _redisProcess = redisProcess;
     State         = State.Running;
 }