gr.uoa.di.madgik.grs.store.buffer
Class BufferStoreReader

java.lang.Object
  extended by java.lang.Thread
      extended by gr.uoa.di.madgik.grs.store.buffer.BufferStoreReader
All Implemented Interfaces:
java.lang.Runnable

public class BufferStoreReader
extends java.lang.Thread

This class accesses the content stored through a IBufferStore, restores the incoming and stored Records and publishes them in a new IBuffer using a RecordWriter whose locator returns to be used by any interested reader. The demultiplexing procedure is performed based on the multiplexing type that was set in the respective IBufferStore

Author:
gpapanikos

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BufferStoreReader(java.lang.String key, IWriterProxy proxy)
          Creates a new instance
 
Method Summary
 void dispose()
          Disposes all managed resources
 java.net.URI populate()
          Starts the background execution of the demultiplex procedure and authors the restored Records using an RecordWriter whose locator is then returned
 void run()
          
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BufferStoreReader

public BufferStoreReader(java.lang.String key,
                         IWriterProxy proxy)
                  throws GRS2BufferStoreInvalidOperationException,
                         GRS2BufferStoreAccessException,
                         GRS2BufferStoreInvalidArgumentException,
                         GRS2WriterException
Creates a new instance

Parameters:
key - the key with which the IBufferStore that is to be demultiplexed is associated
proxy - the proxy to use for the RecordWriter that will make the restored Records available
Throws:
GRS2BufferStoreInvalidOperationException - the IBufferStore did not yield any BufferStoreEntry to use
GRS2BufferStoreAccessException - The RecordDefinitions of the Records could not be found
GRS2BufferStoreInvalidArgumentException - No IBufferStore was found
GRS2WriterException - Could nmot initialize and retrieve the locator of the RecordWriter
Method Detail

populate

public java.net.URI populate()
                      throws GRS2WriterException
Starts the background execution of the demultiplex procedure and authors the restored Records using an RecordWriter whose locator is then returned

Returns:
the locator to the authored IBuffer
Throws:
GRS2WriterException - the state of the demultiplexing procedure does not permit this operation to be completed

dispose

public void dispose()
Disposes all managed resources


run

public void run()

Once the populate() method is invoked, the execution is performed in a background daemon thread that depending on the IBufferStore.getMultiplexType() value, will forward the execution on the appropriate IDemultiplex implementation. Depending on the multiplex type defined, the implementations used are FifoDemultiplex and FirstAvailableDemultiplex

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()