Crossfire JXClient, Trunk
Classes | Public Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue Class Reference
Inheritance diagram for com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue:
Collaboration graph

Classes

class  LoadTask
 
class  SaveTask
 

Public Member Functions

 FileCacheFaceQueue (@NotNull final ImageCache imageCacheOriginal, @NotNull final ImageCache imageCacheScaled, @NotNull final ImageCache imageCacheMagicMap)
 
void loadFace (@NotNull final Face face)
 
void reset ()
 
void saveFace (@NotNull final Face face, @NotNull final FaceImages faceImages)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
void addFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 
void removeFaceQueueListener (@NotNull final FaceQueueListener faceQueueListener)
 

Private Attributes

final ExecutorService executorService = Executors.newFixedThreadPool(1)
 
int id
 
final ImageCache imageCacheMagicMap
 
final ImageCache imageCacheOriginal
 
final ImageCache imageCacheScaled
 
final Collection< FacependingLoadFaces = new HashSet<>()
 
final Object sync = new Object()
 

Additional Inherited Members

- Protected Member Functions inherited from com.realtime.crossfire.jxclient.faces.AbstractFaceQueue
void fireFaceFailed (@NotNull final Face face)
 
void fireFaceLoaded (@NotNull final Face face, @NotNull final FaceImages faceImages)
 

Detailed Description

A FaceQueue loading faces from ImageCache instances.

Author
Andreas Kirschbaum

Definition at line 36 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 93 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 108 of file FileCacheFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.executorService, com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.pendingLoadFaces, and 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 100 of file FileCacheFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.pendingLoadFaces, and 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 124 of file FileCacheFaceQueue.java.

References com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.executorService.

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 67 of file FileCacheFaceQueue.java.

Referenced by com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.loadFace(), and com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.saveFace().

◆ 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 82 of file FileCacheFaceQueue.java.

◆ imageCacheMagicMap

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheMagicMap
private

◆ imageCacheOriginal

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheOriginal
private

◆ imageCacheScaled

final ImageCache com.realtime.crossfire.jxclient.faces.FileCacheFaceQueue.imageCacheScaled
private

◆ pendingLoadFaces

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

◆ sync

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

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