com.amazon.carbonado.spi
Class StoragePool

java.lang.Object
  extended by com.amazon.carbonado.util.AbstractPool<Class,Storage,RepositoryException>
      extended by com.amazon.carbonado.spi.StoragePool

public abstract class StoragePool
extends AbstractPool<Class,Storage,RepositoryException>

A concurrent pool of strongly referenced Storage instances mapped by Storable type. Storage instances are lazily created and pooled.

Since:
1.2
Author:
Brian S O'Neill

Constructor Summary
StoragePool()
           
 
Method Summary
protected  Storage create(Class type)
          Return a new value instance.
protected abstract
<S extends Storable>
Storage<S>
createStorage(Class<S> type)
           
<S extends Storable>
Storage<S>
getStorage(Class<S> type)
          Returns a Storage instance for the given Storable type, which is lazily created and pooled.
 
Methods inherited from class com.amazon.carbonado.util.AbstractPool
get, remove, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoragePool

public StoragePool()
Method Detail

getStorage

public <S extends Storable> Storage<S> getStorage(Class<S> type)
                                       throws MalformedTypeException,
                                              SupportException,
                                              RepositoryException
Returns a Storage instance for the given Storable type, which is lazily created and pooled. If multiple threads are requesting upon the same type concurrently, at most one thread attempts to lazily create the Storage. The others wait for it to become available.

Throws:
MalformedTypeException
SupportException
RepositoryException

create

protected final Storage create(Class type)
                        throws SupportException,
                               RepositoryException
Description copied from class: AbstractPool
Return a new value instance.

Specified by:
create in class AbstractPool<Class,Storage,RepositoryException>
Throws:
SupportException
RepositoryException

createStorage

protected abstract <S extends Storable> Storage<S> createStorage(Class<S> type)
                                                      throws SupportException,
                                                             RepositoryException
Throws:
SupportException
RepositoryException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.