Class CoherenceConfiguration.Builder
- java.lang.Object
-
- com.tangosol.net.CoherenceConfiguration.Builder
-
- Enclosing interface:
- CoherenceConfiguration
public static class CoherenceConfiguration.Builder extends Object
A builder to build aCoherenceConfigurationinstance.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 Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoherenceConfigurationbuild()Build aCoherenceConfigurationfrom thisCoherenceConfiguration.Builder.CoherenceConfiguration.BuilderdiscoverSessions()Add all of theSessionConfigurationinstances discovered using theServiceLoader.CoherenceConfiguration.Buildernamed(String sName)Set the name of theCoherenceinstance.CoherenceConfiguration.BuilderwithApplicationContext(com.tangosol.application.Context context)Set theapplication contextto associate to theCoherenceinstance.CoherenceConfiguration.BuilderwithDefaultSession(String sName)CoherenceConfiguration.BuilderwithEventInterceptor(EventInterceptor<?> interceptor)Add anEventInterceptorthat will be added to allSessioninstances as they are created on start-up.CoherenceConfiguration.BuilderwithEventInterceptors(EventInterceptor<?>... interceptors)Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.CoherenceConfiguration.BuilderwithEventInterceptors(Iterable<? extends EventInterceptor<?>> interceptors)Add theEventInterceptorinstances that will be added to allSessioninstances as they are created on start-up.CoherenceConfiguration.BuilderwithSession(SessionConfiguration config)Add aSessionConfigurationto theCoherenceinstance that will be used to create the correspondingSessionon start-up.CoherenceConfiguration.BuilderwithSessions(SessionConfiguration... configs)Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.CoherenceConfiguration.BuilderwithSessions(Iterable<? extends SessionConfiguration> configs)Add theSessionConfigurationinstances to theCoherenceinstance that will be used to create the correspondingSessioninstances on start-up.
-
-
-
Method Detail
-
named
public CoherenceConfiguration.Builder named(String sName)
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
public CoherenceConfiguration.Builder withDefaultSession(String sName)
- 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
public CoherenceConfiguration.Builder discoverSessions()
Add all of theSessionConfigurationinstances discovered using theServiceLoader.- Returns:
- this
CoherenceConfiguration.Builder
-
withSession
public CoherenceConfiguration.Builder withSession(SessionConfiguration config)
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
public CoherenceConfiguration.Builder withSessions(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
-
withEventInterceptor
public CoherenceConfiguration.Builder withEventInterceptor(EventInterceptor<?> interceptor)
Add anEventInterceptorthat will be added to allSessioninstances as they are created on start-up.- Parameters:
interceptor- theEventInterceptorto add- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptors
public CoherenceConfiguration.Builder withEventInterceptors(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
-
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
public CoherenceConfiguration.Builder withApplicationContext(com.tangosol.application.Context context)
Set theapplication contextto associate to theCoherenceinstance.- Parameters:
context- theapplication contextto associate to theCoherenceinstance- Returns:
- this
CoherenceConfiguration.Builder
-
build
public CoherenceConfiguration build()
Build aCoherenceConfigurationfrom thisCoherenceConfiguration.Builder.- Returns:
- a
CoherenceConfigurationcreated from thisCoherenceConfiguration.Builder
-
-