コード例 #1
0
        /// <summary>
        /// Adds a track executor to abandoned tracks. The abandoned track manager will take over managing its lifecycle and
        /// the caller should not use it any further.
        /// </summary>
        /// <param name="executor"> The executor to register as an abandoned track. </param>
        public virtual void add(RemoteAudioTrackExecutor executor)
        {
            if (abandonedExecutors.offer(new AbandonedExecutor(DateTimeHelperClass.CurrentUnixTimeMillis(), executor)))
            {
                log.debug("{} has been put up for adoption.", executor);
            }
            else
            {
                log.debug("{} has been discarded, adoption queue is full.", executor);

                executor.dispatchException(new FriendlyException("Cannot find a node to play the track on.", Severity.COMMON, null));
                executor.stop();
            }
        }
コード例 #2
0
        private void handleTrackStartResponse(TrackStartResponseMessage message)
        {
            if (message.success)
            {
                log.LogDebug("Successful start confirmation from node {} for executor {}.", nodeAddress, message.executorId);
            }
            else
            {
                RemoteAudioTrackExecutor executor = playingTracks.Get(message.executorId);

                if (executor != null)
                {
                    executor.dispatchException(new FriendlyException("Remote machine failed to start track: " + message.failureReason, Severity.SUSPICIOUS, null));
                    executor.stop();
                }
                else
                {
                    log.LogDebug("Received failed track start for an already stopped executor {} from node {}.", message.executorId, nodeAddress);
                }
            }
        }