Class CachingNumericIdSequences
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.CachingNumericIdSequences
-
- All Implemented Interfaces:
IdSequences<Number>
,NumericIdSequences
public class CachingNumericIdSequences extends Object implements NumericIdSequences
- Author:
- Leonid Bushuev from JetBrains
-
-
Constructor Summary
Constructors Constructor Description CachingNumericIdSequences(SchemaDef schema, SQLRunnerEx DB)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(String domainName)
Clears sequence cache for given domainvoid
clearCache()
This method is not thread safe.static int
getReservedIdsCount(DomainDef domain)
NumericIdSequence<? extends Number>
getSequence(String domainName)
Provides with the sequence for the specified domain.NumericIdSequence<? extends Number>
getSequence(DomainDef domain)
void
initIntegerIdSequence(DomainDef domain, int initialValue)
void
initLongIdSequence(DomainDef domain, long initialValue)
Number
nextOne(String domainName)
Produces and returns one next identifier of the specified domain.
-
-
-
Constructor Detail
-
CachingNumericIdSequences
public CachingNumericIdSequences(@NotNull SchemaDef schema, @NotNull SQLRunnerEx DB)
-
-
Method Detail
-
getSequence
@NotNull public NumericIdSequence<? extends Number> getSequence(@NotNull String domainName) throws UnknownDomainException
Description copied from interface:NumericIdSequences
Provides with the sequence for the specified domain.- Specified by:
getSequence
in interfaceIdSequences<Number>
- Specified by:
getSequence
in interfaceNumericIdSequences
- Parameters:
domainName
- domain.- Returns:
- the sequence for this domain.
- Throws:
UnknownDomainException
-
getSequence
public NumericIdSequence<? extends Number> getSequence(@NotNull DomainDef domain) throws UnknownDomainException
- Throws:
UnknownDomainException
-
getReservedIdsCount
public static int getReservedIdsCount(@NotNull DomainDef domain)
-
initIntegerIdSequence
public void initIntegerIdSequence(@NotNull DomainDef domain, int initialValue)
-
initLongIdSequence
public void initLongIdSequence(@NotNull DomainDef domain, long initialValue)
-
nextOne
@NotNull public Number nextOne(@NotNull String domainName) throws UnknownDomainException
Description copied from interface:NumericIdSequences
Produces and returns one next identifier of the specified domain.- Specified by:
nextOne
in interfaceIdSequences<Number>
- Specified by:
nextOne
in interfaceNumericIdSequences
- Parameters:
domainName
- domain.- Returns:
- the new identifier.
- Throws:
UnknownDomainException
-
clearCache
public void clearCache()
This method is not thread safe. It's only for testing purposes. Please never call it from Production code.
-
clear
public void clear(@NotNull String domainName)
Clears sequence cache for given domain- Parameters:
domainName
- domain name- Since:
- 2019.1
-
-