Package me.ahoo.cosid.jdbc
Class JdbcIdSegmentDistributor
java.lang.Object
me.ahoo.cosid.segment.AbstractIdSegmentDistributor
me.ahoo.cosid.jdbc.JdbcIdSegmentDistributor
- All Implemented Interfaces:
Grouped,IdSegmentDistributor
Jdbc IdSegment Distributor.
-
Field Summary
FieldsFields inherited from interface me.ahoo.cosid.segment.IdSegmentDistributor
DEFAULT_OFFSET, DEFAULT_SEGMENTS, DEFAULT_STEP -
Constructor Summary
ConstructorsConstructorDescriptionJdbcIdSegmentDistributor(String namespace, String name, long step, String incrementMaxIdSql, String fetchMaxIdSql, DataSource dataSource) JdbcIdSegmentDistributor(String namespace, String name, long step, String incrementMaxIdSql, String fetchMaxIdSql, DataSource dataSource, Duration queryTimeout) Create a JDBC segment distributor.JdbcIdSegmentDistributor(String namespace, String name, long step, DataSource dataSource) -
Method Summary
Modifier and TypeMethodDescriptionprotected longdoNextMaxId(long step) Ask the store for the next max id,stepafter the previous one.Methods inherited from class me.ahoo.cosid.segment.AbstractIdSegmentDistributor
getLastMaxId, getName, getNamespace, getStep, nextMaxIdMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.ahoo.cosid.segment.IdSegmentDistributor
allowReset, getNamespacedName, getStep, nextIdSegment, nextIdSegment, nextIdSegment, nextIdSegmentChain, nextIdSegmentChain, nextMaxId
-
Field Details
-
INCREMENT_MAX_ID_SQL
- See Also:
-
FETCH_MAX_ID_SQL
- See Also:
-
-
Constructor Details
-
JdbcIdSegmentDistributor
-
JdbcIdSegmentDistributor
public JdbcIdSegmentDistributor(String namespace, String name, long step, String incrementMaxIdSql, String fetchMaxIdSql, DataSource dataSource) -
JdbcIdSegmentDistributor
public JdbcIdSegmentDistributor(String namespace, String name, long step, String incrementMaxIdSql, String fetchMaxIdSql, DataSource dataSource, Duration queryTimeout) Create a JDBC segment distributor.- Parameters:
queryTimeout- timeout applied to each statement,nullor zero means no timeout
-
-
Method Details
-
doNextMaxId
protected long doNextMaxId(long step) Description copied from class:AbstractIdSegmentDistributorAsk the store for the next max id,stepafter the previous one.- Specified by:
doNextMaxIdin classAbstractIdSegmentDistributor- Parameters:
step- the step, already validated- Returns:
- the new max id
-