Beispiel #1
1
 public void Start(ExecutorService timer, int storageIntervalMillis)
 {
     timer.ScheduleAtFixedRate(StorageMaintenanceTask, null, storageIntervalMillis, storageIntervalMillis);
 }
Beispiel #2
0
        public void Init(Peer peer, ExecutorService timer)
        {
            _peer  = peer;
            _timer = timer.ScheduleAtFixedRate(Run, null, IntervalMillis, IntervalMillis);

            // MSDN: The method can be executed simultaneously on two thread pool threads
            // if the timer interval is less than the time required to execute the method, or
            // if all thread pool threads are in use and the method is queued multiple times.
        }
        public void Init(Peer peer, ExecutorService timer)
        {
            _peer = peer;
            _timer = timer.ScheduleAtFixedRate(Run, null, IntervalMillis, IntervalMillis);

            // MSDN: The method can be executed simultaneously on two thread pool threads 
            // if the timer interval is less than the time required to execute the method, or
            // if all thread pool threads are in use and the method is queued multiple times.
        }
Beispiel #4
0
        private void Initialize(ChannelHandlerContext ctx)
        {
            switch (_state)
            {
            case 1:
                return;

            case 2:
                return;
            }
            _state = 1;

            // .NET-specific:
            if (_executor == null)
            {
                _executor = new ExecutorService();
            }
            var currentMillis = Convenient.CurrentTimeMillis();

            _lastReadTime.Set(currentMillis);
            _lastWriteTime.Set(currentMillis);

            _timer = _executor.ScheduleAtFixedRate(Heartbeating, ctx, TimeToHeartBeatMillis, TimeToHeartBeatMillis);
        }
Beispiel #5
0
 public void Start(ExecutorService timer, int storageIntervalMillis)
 {
     timer.ScheduleAtFixedRate(StorageMaintenanceTask, null, storageIntervalMillis, storageIntervalMillis);
 }