java.lang.Object com.realtime.crossfire.jxclient.faces.AbstractFaceQueue com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue
public class FileCacheFaceQueue
A FaceQueue
loading faces from ImageCache
instances.
Nested Class Summary | |
---|---|
private class |
FileCacheFaceQueue.LoadTask
A thread which loads one face from the caches. |
private class |
FileCacheFaceQueue.SaveTask
A thread which saves one face to the caches. |
Field Summary | |
---|---|
private java.util.concurrent.ExecutorService |
executorService
The ExecutorService used to execute face loading. |
private int |
id
Counts the number of calls to reset() . |
private ImageCache |
imageCacheMagicMap
The image cache used for loading magic map images. |
private ImageCache |
imageCacheOriginal
The image cache used for loading original images. |
private ImageCache |
imageCacheScaled
The image cache used for loading scaled images. |
private java.util.Collection<Face> |
pendingLoadFaces
The faces for which loadFace(Face) has been called but that are
not yet processed. |
private java.lang.Object |
sync
The object used for synchronization. |
Constructor Summary | |
---|---|
FileCacheFaceQueue(ImageCache imageCacheOriginal,
ImageCache imageCacheScaled,
ImageCache imageCacheMagicMap)
Creates a new instance. |
Method Summary | |
---|---|
void |
loadFace(Face face)
Request a face. |
void |
reset()
Reset the processing: forget about pending faces. |
void |
saveFace(Face face,
FaceImages faceImages)
Saves a face to the caches. |
Methods inherited from class com.realtime.crossfire.jxclient.faces.AbstractFaceQueue |
---|
addFaceQueueListener, fireFaceFailed, fireFaceLoaded, removeFaceQueueListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final java.util.concurrent.ExecutorService executorService
ExecutorService
used to execute face loading. The pool
consists of one thread; this means all requests are serialized.
private int id
reset()
. An ExecutorService
does not allow to cancel scheduled but still pending
requests. Therefore the thread checks if this ID matches the ID value at
creation time. If the IDs do not match it exits.
@NotNull private final ImageCache imageCacheMagicMap
@NotNull private final ImageCache imageCacheOriginal
@NotNull private final ImageCache imageCacheScaled
@NotNull private final java.util.Collection<Face> pendingLoadFaces
loadFace(Face)
has been called but that are
not yet processed.
@NotNull private final java.lang.Object sync
Constructor Detail |
---|
public FileCacheFaceQueue(@NotNull ImageCache imageCacheOriginal, @NotNull ImageCache imageCacheScaled, @NotNull ImageCache imageCacheMagicMap)
imageCacheOriginal
- the image cache used for loading original image
filesimageCacheScaled
- the image cache used for loading scaled image
filesimageCacheMagicMap
- the image cache used for loading magic map
image filesMethod Detail |
---|
public void loadFace(@NotNull Face face)
FaceQueueListener.faceLoaded(Face, FaceImages)
or FaceQueueListener.faceFailed(Face)
for the face. Faces re-requested
while still processing may be notified only once.
face
- the requested facepublic void reset()
public void saveFace(@NotNull Face face, @NotNull FaceImages faceImages)
face
- the face to writefaceImages
- the image information to write