Class CoherenceConfiguration.Builder
- Enclosing interface:
CoherenceConfiguration
CoherenceConfiguration instance.
This class is not thread-safe, application code that calls methods on this builder from multiple threads must implement its own thread-safety.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build aCoherenceConfigurationfrom thisCoherenceConfiguration.Builder.Add all of theSessionConfigurationinstances discovered using theServiceLoader.Set the name of theCoherenceinstance.withApplicationContext(Context context) Set theapplication contextto associate to theCoherenceinstance.withDefaultSession(String sName) withEventInterceptor(EventInterceptor<?> interceptor) Add anEventInterceptorthat will be added to allSessioninstances as they are created on start-up.withEventInterceptors(EventInterceptor<?>... interceptors) Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.withEventInterceptors(Iterable<? extends EventInterceptor<?>> interceptors) Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.withSession(SessionConfiguration config) Add aSessionConfigurationto theCoherenceinstance that will be used to create the correspondingSessionon start-up.withSessions(SessionConfiguration... configs) Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.withSessions(Iterable<? extends SessionConfiguration> configs) Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
named
Set the name of theCoherenceinstance.If the name is set ot
nullor empty/blank string theCoherence.DEFAULT_NAMEwill be used.The name must be unique across all
Coherenceinstances.- Parameters:
sName- the name of theCoherenceinstance- Returns:
- this
CoherenceConfiguration.Builder
-
withDefaultSession
- Parameters:
sName- the name of the defaultSession- Returns:
- this
CoherenceConfiguration.Builder - Throws:
IllegalArgumentException- if this configuration does not contain a session with the specified name
-
discoverSessions
Add all of theSessionConfigurationinstances discovered using theServiceLoader.- Returns:
- this
CoherenceConfiguration.Builder
-
withSession
Add aSessionConfigurationto theCoherenceinstance that will be used to create the correspondingSessionon start-up.The name of the
SessionConfigurationreturned by theSessionConfiguration.getName()method must be unique across allCoherenceinstances.Adding a
SessionConfigurationwith the same name as aSessionConfigurationalready added to this builder will overwrite the previously added configuration.- Parameters:
config- theSessionConfigurationto configure aSession- Returns:
- this
CoherenceConfiguration.Builder
-
withSessions
public CoherenceConfiguration.Builder withSessions(Iterable<? extends SessionConfiguration> configs) Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.The name of the
SessionConfigurationreturned by theSessionConfiguration.getName()method must be unique across allCoherenceinstances.Adding a
SessionConfigurationwith the same name as aSessionConfigurationalready added to this builder will overwrite the previously added configuration.- Parameters:
configs- theSessionConfigurationinstances to configureSessioninstances- Returns:
- this
CoherenceConfiguration.Builder
-
withSessions
Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.The name of the
SessionConfigurationreturned by theSessionConfiguration.getName()method must be unique across allCoherenceinstances.Adding a
SessionConfigurationwith the same name as aSessionConfigurationalready added to this builder will overwrite the previously added configuration.- Parameters:
configs- theSessionConfigurationinstances to configureSessioninstances- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptor
Add anEventInterceptorthat will be added to allSessioninstances as they are created on start-up.- Parameters:
interceptor- theEventInterceptorto add- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptors
Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.- Parameters:
interceptors- theEventInterceptorinstances to add- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptors
public CoherenceConfiguration.Builder withEventInterceptors(Iterable<? extends EventInterceptor<?>> interceptors) Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.- Parameters:
interceptors- theEventInterceptorinstances to add- Returns:
- this
CoherenceConfiguration.Builder
-
withApplicationContext
Set theapplication contextto associate to theCoherenceinstance.- Parameters:
context- theapplication contextto associate to theCoherenceinstance- Returns:
- this
CoherenceConfiguration.Builder
-
build
Build aCoherenceConfigurationfrom thisCoherenceConfiguration.Builder.- Returns:
- a
CoherenceConfigurationcreated from thisCoherenceConfiguration.Builder
-