Package org.xj3d.core.loading
Class ContentLoadQueue
java.lang.Object
org.xj3d.core.loading.ContentLoadQueue
Customized queue implementation specifically designed to handle the needs
of X3D/VRML external content loading by compressing multi requests for the
same URL into a single structure.
The queue sorts the incoming requests based on priority. The priority can
be defined based on the value of the system property
org.xj3d.core.loading.sort.order
. See the package documentation
for details on the value of this property. This can be changed at runtime
and have the queue resorted by calling the requestResort()
method
called on this class.
- Version:
- $Revision: 1.6 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String loadConstantsType, String[] url, LoadRequestHandler loadRequestHandler, LoadDetails loadDetails) Add the given load request onto the queue.void
clear()
Clear the queue of items.getNext()
Get the next item from the queue.void
purge()
Remove all elements from queue.void
remove
(String[] url, LoadDetails loadDetails) Remove the given item from the queue.void
If the sorting priority system property has changed, call this method to reload the property and force a resorting of the queue.int
size()
Return the size of the queue.
-
Method Details
-
add
public void add(String loadConstantsType, String[] url, LoadRequestHandler loadRequestHandler, LoadDetails loadDetails) Add the given load request onto the queue. If the URL is already sitting on the queue, the details will be inserted into the existing load request so that they may all be serviced at once.- Parameters:
loadConstantsType
- The node loadConstantsType classification. One of the defined constants inLoadConstants
.url
- The urls of the item to loadloadRequestHandler
- The class that will process the load request once it is pulled grabbed from the queue for processingloadDetails
- Detail set for what should be loaded- Throws:
IllegalArgumentException
- Either the URL list was null/zero length, or the loadConstantsType was null
-
getNext
Get the next item from the queue. Block until an item is available.- Returns:
- The next item on the queue
-
size
public int size()Return the size of the queue.- Returns:
- size of queue
-
purge
public void purge()Remove all elements from queue. Also unblock those who are waiting for items in the queue. They leave the getNext() method with null. -
clear
public void clear()Clear the queue of items. If there are users of the class that are blocked while waiting for elements in the queue, they remain so. -
remove
Remove the given item from the queue.- Parameters:
url
- The url of the object to be removedloadDetails
- The instance of the detail to be removed from the URL
-
requestResort
public void requestResort()If the sorting priority system property has changed, call this method to reload the property and force a resorting of the queue. This will not effect items that are currently being processed, only items that are waiting to be processed.
-