class KryoBinding<K> implements EntryBinding<K> {

    protected Class<K> baseClass;
    protected AutoKryo kryo = new AutoKryo(); 
    protected ThreadLocal<WeakReference<ObjectBuffer>> threadBuffer = new ThreadLocal<WeakReference<ObjectBuffer>>() {
        @Override
        protected WeakReference<ObjectBuffer> initialValue() {
            return new WeakReference<ObjectBuffer>(new ObjectBuffer(kryo,16*1024,Integer.MAX_VALUE));
        }
    };
    
    /**
     * Constructor. Save parameters locally, as superclass 
     * fields are private. 
     * 
     * @param baseClass is the base class for serialized objects stored using
     * this binding
     */
    public KryoBinding(Class<K> baseClass) {
        this.baseClass = baseClass;
        kryo.autoregister(baseClass);
        // TODO: reevaluate if explicit registration should be required
        kryo.setRegistrationOptional(true);
    }

    public Kryo getKryo() {
        return kryo;
    }
    
    private ObjectBuffer getBuffer() {<FILL_FUNCTION_BODY>}
    
    /**
     * Copies superclass simply to allow different source for FastOoutputStream.
     * 
     * @see com.sleepycat.bind.serial.SerialBinding#entryToObject
     */
    public void objectToEntry(K object, DatabaseEntry entry) {
        entry.setData(getBuffer().writeObjectData(object));
    }

    @Override
    public K entryToObject(DatabaseEntry entry) {
        return getBuffer().readObjectData(entry.getData(), baseClass);
    }
}

        WeakReference<ObjectBuffer> ref = threadBuffer.get();
        ObjectBuffer ob = ref.get();
        if (ob == null) {
            ob = new ObjectBuffer(kryo,16*1024,Integer.MAX_VALUE);
            threadBuffer.set(new WeakReference<ObjectBuffer>(ob));
        }
        return ob;        
    
<no_super_class>