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

Quick Search    Search Deep

org.web3d.vrml.nodes.loader
Class ContentLoader  view ContentLoader download ContentLoader.java

java.lang.Object
  extended byorg.web3d.vrml.nodes.loader.ContentLoader
All Implemented Interfaces:
java.lang.Runnable

class ContentLoader
extends java.lang.Object
implements java.lang.Runnable

A loader thread for a single piece of content at any given time.

The content loader is used to wait on a queue of available content and load the next available item in the queue.

When loading, the content loader loads the complete file, it ignores any reference part of the URI. This allows for better caching. The loader is used to

Version:
$Revision: 1.14 $

Field Summary
private  ResourceConnection currentConnection
          The current resource connection if being used
private  java.util.Map inProgress
          The map of nodes we are currently loading to their loader
private  BlockingQueue pendingList
          The list of data we are fetching from
private  boolean processNext
          Flag indicating we should stop completely
private  boolean terminateCurrent
          Flag indicating that the current load should be terminated
 
Constructor Summary
(package private) ContentLoader(java.lang.ThreadGroup tg, BlockingQueue pending, java.util.Map processing)
          Create a content loader that reads values from the given queue and stores intermediate results in the given map.
 
Method Summary
 void abortCurrentFile()
          Notification to abort loading the current resource.
private  boolean loadExternal(java.lang.String origUri, java.lang.String fileUri, FileCache cache, int field, boolean single, VRMLSingleExternalNodeType sNode, VRMLMultiExternalNodeType mNode)
          Load the file from an external URL because we couldn't find it in the cache.
 void run()
          Run the loader to read content from the list
 void shutdown()
          Notification to shut down the load process entirely for this thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pendingList

private BlockingQueue pendingList
The list of data we are fetching from


inProgress

private java.util.Map inProgress
The map of nodes we are currently loading to their loader


terminateCurrent

private boolean terminateCurrent
Flag indicating that the current load should be terminated


processNext

private boolean processNext
Flag indicating we should stop completely


currentConnection

private ResourceConnection currentConnection
The current resource connection if being used

Constructor Detail

ContentLoader

ContentLoader(java.lang.ThreadGroup tg,
              BlockingQueue pending,
              java.util.Map processing)
Create a content loader that reads values from the given queue and stores intermediate results in the given map.

Method Detail

run

public void run()
Run the loader to read content from the list

Specified by:
run in interface java.lang.Runnable

abortCurrentFile

public void abortCurrentFile()
Notification to abort loading the current resource. If there is one loading, it will terminate the procedure immediately and start fetching the next available URI. This will only work if we are currently processing a file. If we are not processing a file then this is ignored.


shutdown

public void shutdown()
Notification to shut down the load process entirely for this thread. It probably means we are about to close down the whole system. If we are held in the queue, blocked waiting for input, the caller should call org.web3d.util.BlockingQueue#purge() on the queue after calling this method. That will force the block to exit and this thread to end.


loadExternal

private boolean loadExternal(java.lang.String origUri,
                             java.lang.String fileUri,
                             FileCache cache,
                             int field,
                             boolean single,
                             VRMLSingleExternalNodeType sNode,
                             VRMLMultiExternalNodeType mNode)
Load the file from an external URL because we couldn't find it in the cache.