org.hd.d.pg2k.test.dev
Class SimpleCacheTest.RawDataAccessMonitor

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
      extended by org.hd.d.pg2k.test.dev.SimpleCacheTest.RawDataAccessMonitor
All Implemented Interfaces:
SimpleExhibitPipelineIF, BasicVarMgrInterface, SimpleVariablePipelineIF
Enclosing class:
SimpleCacheTest

static final class SimpleCacheTest.RawDataAccessMonitor
extends SimpleExhibitPipelineFilter

Thread-safe monitor of data-read activity. An instance of this class can be inserted into a pipeline to record data-read activity.

This filter stage does not generally impede normal operation, but simply records the data access pattern for processing.


Nested Class Summary
(package private) static class SimpleCacheTest.RawDataAccessMonitor.GetRawDataEvent
          A "getRawData()" event.
 
Nested classes/interfaces inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF
SimpleExhibitPipelineIF.PropsKey
 
Field Summary
private  java.util.List<SimpleCacheTest.RawDataAccessMonitor.GetRawDataEvent> events
          A List of GetRawDataEvent values in the order they occurred.
 
Fields inherited from class org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
source
 
Fields inherited from interface org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineIF
MAX_USER_READ_SIZE
 
Constructor Summary
SimpleCacheTest.RawDataAccessMonitor(SimpleExhibitPipelineIF upstream)
          Construct instance wrapped round upstream source.
 
Method Summary
 java.util.List<SimpleCacheTest.RawDataAccessMonitor.GetRawDataEvent> getEventList()
          Retrieve the List of events in order; never null though possibly empty.
 void getRawFile(java.nio.ByteBuffer buf, Name.ExhibitFull exhibitName, int position, boolean dontCache)
          Read a chunk of the raw exhibit binary into the given buffer.
 
Methods inherited from class org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
destroy, getAllExhibitImmutableData, getAllExhibitProperties, getEventValue, getEventValues, getGenProps, getGenSecProps, getProperties, getStaticAttr, getThumbnails, getVariable, getVariables, poll, setVariable, setVariables, syncVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

events

private final java.util.List<SimpleCacheTest.RawDataAccessMonitor.GetRawDataEvent> events
A List of GetRawDataEvent values in the order they occurred. A Vector is used for thread-safety.

Constructor Detail

SimpleCacheTest.RawDataAccessMonitor

SimpleCacheTest.RawDataAccessMonitor(SimpleExhibitPipelineIF upstream)
Construct instance wrapped round upstream source.

Parameters:
upstream - datasource; never null
Method Detail

getRawFile

public void getRawFile(java.nio.ByteBuffer buf,
                       Name.ExhibitFull exhibitName,
                       int position,
                       boolean dontCache)
                throws java.io.IOException
Read a chunk of the raw exhibit binary into the given buffer. This passes the request upstream without modification, but records it in a trace buffer before passing it upstream. The trace is taken before in case the fulfillment of the request happens to be vetoed by the data source; it is the requests that we are interested in here.

Specified by:
getRawFile in interface SimpleExhibitPipelineIF
Overrides:
getRawFile in class SimpleExhibitPipelineFilter
Parameters:
buf - the buffer into which to read the data; must be non-null, in put()able state, and with remaining capacity of at least the requested number of bytes
exhibitName - the full name of the exhibit to read from; never null and must be syntactically valid
position - position/index of first byte in exhibitFile to read; non-negative
dontCache - if true, this is a hint not to attempt to cache this or displace anything from extant caches for this data as it maqy for example be precaching or random activity; by default callers should leave this false to allow cacheing
Throws:
java.io.IOException - for requests that cannot be fulfilled because of I/O restrictions or problems, such as link failure or an upper bound on the length of a request

getEventList

public java.util.List<SimpleCacheTest.RawDataAccessMonitor.GetRawDataEvent> getEventList()
Retrieve the List of events in order; never null though possibly empty. This returns a private snapshot of the event list.


DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.