com.bigdata.io.compression
Class ThreadLocalRecordCompressorFactory<A extends RecordCompressor>

java.lang.Object
  extended by com.bigdata.io.compression.ThreadLocalRecordCompressorFactory<A>
All Implemented Interfaces:
IRecordCompressorFactory<A>

public class ThreadLocalRecordCompressorFactory<A extends RecordCompressor>
extends Object
implements IRecordCompressorFactory<A>

An IRecordCompressorFactory with thread-local semantics based on an internal weak value cache and providing instances based on a delegate IRecordCompressorFactory. This is designed to work well when the application is single-threaded as well as when there are concurrent threads demanding instances from the delegate factory.

Version:
$Id: ThreadLocalRecordCompressorFactory.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
ThreadLocalRecordCompressorFactory(IRecordCompressorFactory<A> delegate)
           
 
Method Summary
 A getInstance()
          Return an instance for use by the current thread.
protected  A newInstance()
          Return a new IRecordCompressor instance from the delegate IRecordCompressorFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadLocalRecordCompressorFactory

public ThreadLocalRecordCompressorFactory(IRecordCompressorFactory<A> delegate)
Parameters:
delegate - The factory used to create instances of the IRecordCompressor when there is none in the cache.
Method Detail

getInstance

public A getInstance()
Return an instance for use by the current thread.

Specified by:
getInstance in interface IRecordCompressorFactory<A extends RecordCompressor>

newInstance

protected A newInstance()
Return a new IRecordCompressor instance from the delegate IRecordCompressorFactory.



Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.