com.amazon.carbonado.sequence
Class SequenceValueProducerPool

java.lang.Object
  extended by com.amazon.carbonado.util.AbstractPool<String,SequenceValueProducer,RepositoryException>
      extended by com.amazon.carbonado.sequence.SequenceValueProducerPool

public abstract class SequenceValueProducerPool
extends AbstractPool<String,SequenceValueProducer,RepositoryException>

A concurrent pool of strongly referenced SequenceValueProducer instances mapped by name. SequenceValueProducer instances are lazily created and pooled.

Since:
1.2
Author:
bcastill, Brian S O'Neill

Constructor Summary
SequenceValueProducerPool()
           
 
Method Summary
protected  SequenceValueProducer create(String name)
          Return a new value instance.
protected abstract  SequenceValueProducer createSequenceValueProducer(String name)
           
 SequenceValueProducer get(String name)
          Returns a SequenceValueProducer instance for the given name, which is lazily created and pooled.
 void returnReservedValues(org.apache.commons.logging.Log log)
          Returns reserved values for all SequenceValueProducers.
 
Methods inherited from class com.amazon.carbonado.util.AbstractPool
remove, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceValueProducerPool

public SequenceValueProducerPool()
Method Detail

get

public SequenceValueProducer get(String name)
                          throws RepositoryException
Returns a SequenceValueProducer instance for the given name, which is lazily created and pooled. If multiple threads are requesting upon the same name concurrently, at most one thread attempts to lazily create the SequenceValueProducer. The others wait for it to become available.

Overrides:
get in class AbstractPool<String,SequenceValueProducer,RepositoryException>
Parameters:
name - name of sequence
Throws:
RepositoryException

returnReservedValues

public void returnReservedValues(org.apache.commons.logging.Log log)
Returns reserved values for all SequenceValueProducers.

Parameters:
log - optional log to report errors; uses default log if null

create

protected final SequenceValueProducer create(String name)
                                      throws RepositoryException
Description copied from class: AbstractPool
Return a new value instance.

Specified by:
create in class AbstractPool<String,SequenceValueProducer,RepositoryException>
Throws:
RepositoryException

createSequenceValueProducer

protected abstract SequenceValueProducer createSequenceValueProducer(String name)
                                                              throws RepositoryException
Throws:
RepositoryException


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