java.lang.Object
me.ahoo.cosid.runtime.RuntimeOptions.Builder
- Enclosing class:
RuntimeOptions
Builds
RuntimeOptions.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the options.Sets an existing client object of a store, passed asStoreConfig.client.Sets howCodecSpec.Customreferences resolve.countGenerated(boolean countGenerated) Sets whether to count the ids each generator issues through the views the runtime hands out (CosIdRuntime.generated(String)).Sets the executor of refills and renewals; the runtime does not close it.generators(Function<String, Optional<IdGenerator>> generators) Sets howGeneratorSpec.Customreferences resolve (D41).hostResolver(HostResolver hostResolver) Sets the host of a derived owner key.listener(GeneratorListener listener) Sets the event listener.port(int port) Sets the port of a derived owner key,host:port.storeProvider(StoreProvider storeProvider) Adds a provider besides thoseServiceLoaderfinds; it wins for the same type, and of two added for one type the first wins.time(TimeSource time) Sets the time source.
-
Method Details
-
time
Sets the time source.- Parameters:
time- the time source; defaultTimeSource.SYSTEM- Returns:
- this builder
-
executor
Sets the executor of refills and renewals; the runtime does not close it.- Parameters:
executor- the executor; by default the runtime creates a virtual thread executor and closes it- Returns:
- this builder
-
listener
Sets the event listener.- Parameters:
listener- the listener; defaultGeneratorListener.NOOP- Returns:
- this builder
-
storeProvider
Adds a provider besides thoseServiceLoaderfinds; it wins for the same type, and of two added for one type the first wins.- Parameters:
storeProvider- the provider- Returns:
- this builder
-
client
Sets an existing client object of a store, passed asStoreConfig.client.- Parameters:
store- the store nameclient- the client object- Returns:
- this builder
-
hostResolver
Sets the host of a derived owner key.- Parameters:
hostResolver- the resolver; defaultHostResolver.LOCAL- Returns:
- this builder
-
port
Sets the port of a derived owner key,host:port.- Parameters:
port- the port; by default the owner key ishost:pid- Returns:
- this builder
-
codecs
Sets howCodecSpec.Customreferences resolve.- Parameters:
codecs- the resolver, empty for an unknown reference; default by class name- Returns:
- this builder
-
generators
Sets howGeneratorSpec.Customreferences resolve (D41).- Parameters:
generators- the resolver, empty for an unknown reference; by default always empty- Returns:
- this builder
-
countGenerated
Sets whether to count the ids each generator issues through the views the runtime hands out (CosIdRuntime.generated(String)).- Parameters:
countGenerated- whether to count; off by default, which leaves the hot path unchanged- Returns:
- this builder
-
build
Builds the options.- Returns:
- the options
-