info.archinnov.achilles.context.ThriftImmediateFlushContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of achilles-thrift Show documentation
Show all versions of achilles-thrift Show documentation
Thrift implementation for Achilles using Hector library
package info.archinnov.achilles.context;
import static info.archinnov.achilles.context.AchillesFlushContext.FlushType.IMMEDIATE;
import info.archinnov.achilles.consistency.AchillesConsistencyLevelPolicy;
import info.archinnov.achilles.dao.ThriftAbstractDao;
import info.archinnov.achilles.type.ConsistencyLevel;
import info.archinnov.achilles.type.Pair;
import java.util.Map;
import me.prettyprint.hector.api.mutation.Mutator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
/**
* ThriftImmediateFlushContext
*
* @author DuyHai DOAN
*
*/
public class ThriftImmediateFlushContext extends
ThriftAbstractFlushContext
{
private static final Logger log = LoggerFactory.getLogger(ThriftImmediateFlushContext.class);
public ThriftImmediateFlushContext(ThriftDaoContext thriftDaoContext,
AchillesConsistencyLevelPolicy policy, Optional readLevelO,
Optional writeLevelO, Optional ttlO)
{
super(thriftDaoContext, policy, readLevelO, writeLevelO, ttlO);
}
public ThriftImmediateFlushContext(ThriftDaoContext thriftDaoContext,
ThriftConsistencyContext consistencyContext,
Map, ThriftAbstractDao>> mutatorMap,
boolean hasCustomConsistencyLevels,
Optional ttlO)
{
super(thriftDaoContext, consistencyContext, mutatorMap, hasCustomConsistencyLevels, ttlO);
}
@Override
public void startBatch()
{
throw new UnsupportedOperationException(
"Cannot start a batch with a normal EntityManager. Please create a BatchingEntityManager instead");
}
@Override
public void flush()
{
log.debug("Flush immediatly all pending mutations");
doFlush();
}
@Override
public void endBatch()
{
throw new UnsupportedOperationException(
"Cannot end a batch with a normal EntityManager. Please create a BatchingEntityManager instead");
}
@Override
public FlushType type()
{
return IMMEDIATE;
}
@Override
public ThriftImmediateFlushContext duplicateWithoutTtl()
{
return new ThriftImmediateFlushContext(thriftDaoContext,
consistencyContext,
mutatorMap,
hasCustomConsistencyLevels,
Optional. absent());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy