ozone core API

org.ozoneDB.core.storage.gammaStore
Class Serializer

java.lang.Object
  extended byorg.ozoneDB.core.storage.gammaStore.Serializer

public class Serializer
extends java.lang.Object

Takes care of Storable implemeting instances, in that it has different threads for serializing and writing to Storage. Remove() ensures that if a null is returned that the Storable for the given key has been completely written to Storage.

For every instance of this class 2 threads are created, so keep this in mind when creating instances; this might be a resource hog...

Author:
leo

Nested Class Summary
private  class Serializer.SerializeTask
           
 
Field Summary
private static java.util.logging.Logger log
           
private  AsyncExec serializeAsyncExec
           
private  StorageFactory storageFactory
           
private  AsyncExec storeAsyncExec
           
private  StreamFactory streamFactory
           
 
Constructor Summary
Serializer(StorageFactory storageFactory, StreamFactory streamFactory, java.lang.String name)
           
 
Method Summary
 void put(java.lang.Object id, Storable storable)
          Places a storable into a write queue.
 Storable remove(java.lang.Object id)
          Removes a storable from the write queue.
 int size()
           
 void stopWhenReady()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log

serializeAsyncExec

private AsyncExec serializeAsyncExec

storeAsyncExec

private AsyncExec storeAsyncExec

storageFactory

private StorageFactory storageFactory

streamFactory

private StreamFactory streamFactory
Constructor Detail

Serializer

public Serializer(StorageFactory storageFactory,
                  StreamFactory streamFactory,
                  java.lang.String name)
Method Detail

put

public void put(java.lang.Object id,
                Storable storable)
Places a storable into a write queue. Works like 'Fire and forget': method returns fast, while other threads take care of serialization and the actual persisting (writing).


remove

public Storable remove(java.lang.Object id)
Removes a storable from the write queue. If it returns null then the storable has already been written to disk or has never been entered through a call to put(Object, Storable).


size

public int size()

stopWhenReady

public void stopWhenReady()

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.