Ejemplo n.º 1
0
        public override void shutdown()
        {
            remoteNodeManager.shutdown(true);
            garbageCollectionMonitor.disable();
            lifecycleManager.shutdown();

            foreach (AudioSourceManager sourceManager in sourceManagers)
            {
                sourceManager.shutdown();
            }

            ExecutorTools.shutdownExecutor(trackPlaybackExecutorService, "track playback");
            ExecutorTools.shutdownExecutor(trackInfoExecutorService, "track info");
            ExecutorTools.shutdownExecutor(scheduledExecutorService, "scheduled operations");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new instance
        /// </summary>
        //JAVA TO C# CONVERTER WARNING: The following constructor is declared outside of its associated class:
        //ORIGINAL LINE: public DefaultAudioPlayerManager()
        public DefaultAudioPlayerManager()
        {
            sourceManagers = new List <>();

            // Executors
            trackPlaybackExecutorService = new ThreadPoolExecutor(1, int.MaxValue, 10, TimeUnit.SECONDS, new SynchronousQueue(), new DaemonThreadFactory("playback"));
            trackInfoExecutorService     = ExecutorTools.createEagerlyScalingExecutor(1, DEFAULT_LOADER_POOL_SIZE, TimeUnit.SECONDS.toMillis(30), LOADER_QUEUE_CAPACITY, new DaemonThreadFactory("info-loader"));
            scheduledExecutorService     = Executors.newScheduledThreadPool(1, new DaemonThreadFactory("manager"));
            orderedInfoExecutor          = new OrderedExecutor(trackInfoExecutorService);

            // Configuration
            trackStuckThreshold = TimeUnit.MILLISECONDS.toNanos(10000);
            configuration       = new AudioConfiguration();
            cleanupThreshold    = new AtomicLong(DEFAULT_CLEANUP_THRESHOLD);
            frameBufferDuration = DEFAULT_FRAME_BUFFER_DURATION;
            useSeekGhosting     = true;
            outputHookFactory   = null;

            // Additional services
            remoteNodeManager        = new RemoteNodeManager(this);
            garbageCollectionMonitor = new GarbageCollectionMonitor(scheduledExecutorService);
            lifecycleManager         = new AudioPlayerLifecycleManager(scheduledExecutorService, cleanupThreshold);
            lifecycleManager.initialise();
        }