Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue Class Reference

A FaceQueue loading faces from ImageCache instances. More...

+ Inheritance diagram for com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue:
+ Collaboration diagram for com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue:

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.

Parameters
facethe requested face
More...
 
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...
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
void addFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 Adds a FaceQueueListener to be notified about processed faces.
Parameters
faceQueueListenerthe listener to add
More...
 
void removeFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 Removes a FaceQueueListener to be notified about processed faces.
Parameters
faceQueueListenerthe listener to remove
More...
 

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< FacependingLoadFaces = 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

- Protected Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
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...
 

Detailed Description

A FaceQueue loading faces from ImageCache instances.

Author
Andreas Kirschbaum

Definition at line 35 of file FileCacheFaceQueue.java.

Constructor & Destructor Documentation

◆ FileCacheFaceQueue()

com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.FileCacheFaceQueue ( @NotNull final ImageCache  imageCacheOriginal,
@NotNull final ImageCache  imageCacheScaled,
@NotNull final ImageCache  imageCacheMagicMap 
)

Creates a new instance.

Parameters
imageCacheOriginalthe image cache used for loading original image files
imageCacheScaledthe image cache used for loading scaled image files
imageCacheMagicMapthe 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.

Member Function Documentation

◆ loadFace()

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.

Parameters
facethe 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().

+ Here is the caller graph for this function:

◆ reset()

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().

+ Here is the caller graph for this function:

◆ saveFace()

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.

Parameters
facethe face to write
faceImagesthe image information to write

Definition at line 129 of file FileCacheFaceQueue.java.

Member Data Documentation

◆ executorService

final ExecutorService com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.executorService = Executors.newFixedThreadPool(1)
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.

◆ id

int com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.id
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.

◆ imageCacheMagicMap

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheMagicMap
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().

◆ imageCacheOriginal

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheOriginal
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().

◆ imageCacheScaled

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheScaled
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().

◆ pendingLoadFaces

final Collection<Face> com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.pendingLoadFaces = new HashSet<>()
private

The faces for which loadFace(Face) has been called but that are not yet processed.

Definition at line 73 of file FileCacheFaceQueue.java.

◆ sync

final Object com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.sync = new Object()
private

The documentation for this class was generated from the following file: