Crossfire JXClient, Trunk
R20561
|
A FaceQueue loading faces from ImageCache instances. More...
Classes | |
class | LoadTask |
A thread which loads one face from the caches. More... | |
class | SaveTask |
A thread which saves one face to the caches. More... | |
Public Member Functions | |||
FileCacheFaceQueue (@NotNull final ImageCache imageCacheOriginal, @NotNull final ImageCache imageCacheScaled, @NotNull final ImageCache imageCacheMagicMap) | |||
Creates a new instance. More... | |||
void | loadFace (@NotNull final Face face) | ||
Request a face.Must eventually call either FaceQueueListener#faceLoaded(Face, FaceImages) or FaceQueueListener#faceFailed(Face) for the face. Faces re-requested while still processing may be notified only once.
| |||
void | reset () | ||
Reset the processing: forget about pending faces.This function is called whenever the server socket breaks, or when a new connection has been established. More... | |||
void | saveFace (@NotNull final Face face, @NotNull final FaceImages faceImages) | ||
Saves a face to the caches. More... | |||
![]() | |||
void | addFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener) | ||
Adds a FaceQueueListener to be notified about processed faces.
| |||
void | removeFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener) | ||
Removes a FaceQueueListener to be notified about processed faces.
| |||
Private Attributes | |
final ExecutorService | executorService = Executors.newFixedThreadPool(1) |
The ExecutorService used to execute face loading. More... | |
int | id |
Counts the number of calls to reset(). More... | |
final ImageCache | imageCacheMagicMap |
The image cache used for loading magic map images. More... | |
final ImageCache | imageCacheOriginal |
The image cache used for loading original images. More... | |
final ImageCache | imageCacheScaled |
The image cache used for loading scaled images. More... | |
final Collection< Face > | pendingLoadFaces = new HashSet<>() |
The faces for which loadFace(Face) has been called but that are not yet processed. More... | |
final Object | sync = new Object() |
The object used for synchronization. More... | |
Additional Inherited Members | |
![]() | |
void | fireFaceFailed (@NotNull final Face face) |
Notify all listener with FaceQueueListener#faceFailed(Face). More... | |
void | fireFaceLoaded (@NotNull final Face face, @NotNull final FaceImages faceImages) |
Notify all listener with FaceImages). More... | |
A FaceQueue loading faces from ImageCache instances.
Definition at line 35 of file FileCacheFaceQueue.java.
com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.FileCacheFaceQueue | ( | @NotNull final ImageCache | imageCacheOriginal, |
@NotNull final ImageCache | imageCacheScaled, | ||
@NotNull final ImageCache | imageCacheMagicMap | ||
) |
Creates a new instance.
imageCacheOriginal | the image cache used for loading original image files |
imageCacheScaled | the image cache used for loading scaled image files |
imageCacheMagicMap | the image cache used for loading magic map image files |
Definition at line 92 of file FileCacheFaceQueue.java.
References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheMagicMap, com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheOriginal, and com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheScaled.
void com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.loadFace | ( | @NotNull final Face | face | ) |
Request a face.Must eventually call either 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 face |
Implements com.realtime.crossfire.jxclient.faces.FaceQueue.
Definition at line 113 of file FileCacheFaceQueue.java.
References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.sync.
Referenced by com.realtime.crossfire.jxclient.faces.FacesQueue.loadFace().
void com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.reset | ( | ) |
Reset the processing: forget about pending faces.This function is called whenever the server socket breaks, or when a new connection has been established.
Implements com.realtime.crossfire.jxclient.faces.FaceQueue.
Definition at line 102 of file FileCacheFaceQueue.java.
References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.sync.
Referenced by com.realtime.crossfire.jxclient.faces.FacesQueue.reset().
void com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.saveFace | ( | @NotNull final Face | face, |
@NotNull final FaceImages | faceImages | ||
) |
Saves a face to the caches.
This function returns immediately; the faces are written asynchronously.
face | the face to write |
faceImages | the image information to write |
Definition at line 129 of file FileCacheFaceQueue.java.
|
private |
The ExecutorService used to execute face loading.
The pool consists of one thread; this means all requests are serialized.
Definition at line 66 of file FileCacheFaceQueue.java.
|
private |
Counts the number of calls to 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.
Definition at line 81 of file FileCacheFaceQueue.java.
|
private |
The image cache used for loading magic map images.
Definition at line 59 of file FileCacheFaceQueue.java.
Referenced by com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.FileCacheFaceQueue().
|
private |
The image cache used for loading original images.
Definition at line 47 of file FileCacheFaceQueue.java.
Referenced by com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.FileCacheFaceQueue().
|
private |
The image cache used for loading scaled images.
Definition at line 53 of file FileCacheFaceQueue.java.
Referenced by com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.FileCacheFaceQueue().
|
private |
The faces for which loadFace(Face) has been called but that are not yet processed.
Definition at line 73 of file FileCacheFaceQueue.java.
|
private |
The object used for synchronization.
Definition at line 41 of file FileCacheFaceQueue.java.
Referenced by com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.loadFace(), com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.reset(), and com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.LoadTask.run().