org.archive.crawler.frontier
Class RecyclingSerialBinding

java.lang.Object
  extended by com.sleepycat.bind.serial.SerialBase
      extended by com.sleepycat.bind.serial.SerialBinding
          extended by org.archive.crawler.frontier.RecyclingSerialBinding
All Implemented Interfaces:
com.sleepycat.bind.EntryBinding

public class RecyclingSerialBinding
extends com.sleepycat.bind.serial.SerialBinding

A SerialBinding that recycles a single FastOutputStream per thread, avoiding reallocation of the internal buffer for either repeated serializations or because of mid-serialization expansions. (Cached stream's buffer will quickly grow to a size sufficient for all serialized instances.)

Author:
gojomo

Field Summary
(package private)  java.lang.ThreadLocal<com.sleepycat.util.FastOutputStream> fastOutputStreamHolder
          Thread-local cache of reusable FastOutputStream
 
Constructor Summary
RecyclingSerialBinding(com.sleepycat.bind.serial.ClassCatalog classCatalog, java.lang.Class baseClass)
          Constructor.
 
Method Summary
 void objectToEntry(java.lang.Object object, com.sleepycat.je.DatabaseEntry entry)
          Copies superclass simply to allow different source for FastOoutputStream.
 
Methods inherited from class com.sleepycat.bind.serial.SerialBinding
entryToObject, getBaseClass, getClassLoader
 
Methods inherited from class com.sleepycat.bind.serial.SerialBase
getSerialBufferSize, getSerialOutput, setSerialBufferSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fastOutputStreamHolder

java.lang.ThreadLocal<com.sleepycat.util.FastOutputStream> fastOutputStreamHolder
Thread-local cache of reusable FastOutputStream

Constructor Detail

RecyclingSerialBinding

public RecyclingSerialBinding(com.sleepycat.bind.serial.ClassCatalog classCatalog,
                              java.lang.Class baseClass)
Constructor. Save parameters locally, as superclass fields are private.

Parameters:
classCatalog - is the catalog to hold shared class information
baseClass - is the base class for serialized objects stored using this binding
Method Detail

objectToEntry

public void objectToEntry(java.lang.Object object,
                          com.sleepycat.je.DatabaseEntry entry)
Copies superclass simply to allow different source for FastOoutputStream.

Specified by:
objectToEntry in interface com.sleepycat.bind.EntryBinding
Overrides:
objectToEntry in class com.sleepycat.bind.serial.SerialBinding
See Also:
SerialBinding.entryToObject(com.sleepycat.je.DatabaseEntry)


Copyright © 2003-2011 Internet Archive. All Rights Reserved.