Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jreceiver.server.scanner
Class PlaylistParserDaemon  view PlaylistParserDaemon download PlaylistParserDaemon.java

java.lang.Object
  extended byjreceiver.util.Daemon
      extended byjreceiver.server.scanner.PlaylistParserDaemon

public final class PlaylistParserDaemon
extends jreceiver.util.Daemon

A daemon to parse playlists in the background.

At present it only supports external playlists.

Version:
$Revision: 1.9 $ $Date: 2003/04/27 23:14:31 $

Field Summary
protected static org.apache.commons.logging.Log log
          logging object
protected  java.util.LinkedList queue
          replace with a synchronized LinkedHashSet if moving to JRE 1.4.
private static PlaylistParserDaemon singleton
          this class is implemented as a singleton
 
Fields inherited from class jreceiver.util.Daemon
thread_name, worker_thread
 
Constructor Summary
protected PlaylistParserDaemon()
          ctor
 
Method Summary
protected  void doWork()
          For each item in the queue, the worker thread will (re)populate the SourceList of the playlist with tune src_ids.
static PlaylistParserDaemon getInstance()
          Obtain the instance of the PlaylistParserDaemon singleton
 void queue(int pl_src_id)
          Request that the following playlist be parsed in the background.
 void queue(java.util.Vector ids)
          Request that the following playlists be parsed in the background.
 
Methods inherited from class jreceiver.util.Daemon
makeThread, sleep, start, stop, stopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

private static PlaylistParserDaemon singleton
this class is implemented as a singleton


queue

protected java.util.LinkedList queue
replace with a synchronized LinkedHashSet if moving to JRE 1.4.

Note that we don't use the values -- only the keys -- on which we want to enforce uniqueness.


log

protected static org.apache.commons.logging.Log log
logging object

Constructor Detail

PlaylistParserDaemon

protected PlaylistParserDaemon()
ctor

Method Detail

getInstance

public static PlaylistParserDaemon getInstance()
Obtain the instance of the PlaylistParserDaemon singleton

Note that this uses the questionable DCL pattern (search on DoubleCheckedLockingIsBroken for more info)

Note that the instance method must be called once with a valid status port before the singleton is created.


queue

public void queue(java.util.Vector ids)
Request that the following playlists be parsed in the background.

If not already present in the list, each will be added to the end of the list.

Worker thread will be launched if not running.


queue

public void queue(int pl_src_id)
Request that the following playlist be parsed in the background.

If not already present in the list, it will be added to the end of the list.

Worker thread will be launched if not running.


doWork

protected void doWork()
For each item in the queue, the worker thread will (re)populate the SourceList of the playlist with tune src_ids.