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 aCoherenceConfiguration
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 Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoherenceConfiguration
build()
Build aCoherenceConfiguration
from thisCoherenceConfiguration.Builder
.CoherenceConfiguration.Builder
discoverSessions()
Add all of theSessionConfiguration
instances discovered using theServiceLoader
.CoherenceConfiguration.Builder
named(String sName)
Set the name of theCoherence
instance.CoherenceConfiguration.Builder
withApplicationContext(com.tangosol.application.Context context)
Set theapplication context
to associate to theCoherence
instance.CoherenceConfiguration.Builder
withDefaultSession(String sName)
CoherenceConfiguration.Builder
withEventInterceptor(EventInterceptor<?> interceptor)
Add anEventInterceptor
that will be added to allSession
instances as they are created on start-up.CoherenceConfiguration.Builder
withEventInterceptors(EventInterceptor<?>... interceptors)
Add theEventInterceptor
instances that will be added to allSession
instances as they are created on start-up.CoherenceConfiguration.Builder
withEventInterceptors(Iterable<? extends EventInterceptor<?>> interceptors)
Add theEventInterceptor
instances that will be added to allSession
instances as they are created on start-up.CoherenceConfiguration.Builder
withSession(SessionConfiguration config)
Add aSessionConfiguration
to theCoherence
instance that will be used to create the correspondingSession
on start-up.CoherenceConfiguration.Builder
withSessions(SessionConfiguration... configs)
Add theSessionConfiguration
instances to theCoherence
instance that will be used to create the correspondingSession
instances on start-up.CoherenceConfiguration.Builder
withSessions(Iterable<? extends SessionConfiguration> configs)
Add theSessionConfiguration
instances to theCoherence
instance that will be used to create the correspondingSession
instances on start-up.
-
-
-
Method Detail
-
named
public CoherenceConfiguration.Builder named(String sName)
Set the name of theCoherence
instance.If the name is set ot
null
or empty/blank string theCoherence.DEFAULT_NAME
will be used.The name must be unique across all
Coherence
instances.- Parameters:
sName
- the name of theCoherence
instance- 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 theSessionConfiguration
instances discovered using theServiceLoader
.- Returns:
- this
CoherenceConfiguration.Builder
-
withSession
public CoherenceConfiguration.Builder withSession(SessionConfiguration config)
Add aSessionConfiguration
to theCoherence
instance that will be used to create the correspondingSession
on start-up.The name of the
SessionConfiguration
returned by theSessionConfiguration.getName()
method must be unique across allCoherence
instances.Adding a
SessionConfiguration
with the same name as aSessionConfiguration
already added to this builder will overwrite the previously added configuration.- Parameters:
config
- theSessionConfiguration
to configure aSession
- Returns:
- this
CoherenceConfiguration.Builder
-
withSessions
public CoherenceConfiguration.Builder withSessions(Iterable<? extends SessionConfiguration> configs)
Add theSessionConfiguration
instances to theCoherence
instance that will be used to create the correspondingSession
instances on start-up.The name of the
SessionConfiguration
returned by theSessionConfiguration.getName()
method must be unique across allCoherence
instances.Adding a
SessionConfiguration
with the same name as aSessionConfiguration
already added to this builder will overwrite the previously added configuration.- Parameters:
configs
- theSessionConfiguration
instances to configureSession
instances- Returns:
- this
CoherenceConfiguration.Builder
-
withSessions
public CoherenceConfiguration.Builder withSessions(SessionConfiguration... configs)
Add theSessionConfiguration
instances to theCoherence
instance that will be used to create the correspondingSession
instances on start-up.The name of the
SessionConfiguration
returned by theSessionConfiguration.getName()
method must be unique across allCoherence
instances.Adding a
SessionConfiguration
with the same name as aSessionConfiguration
already added to this builder will overwrite the previously added configuration.- Parameters:
configs
- theSessionConfiguration
instances to configureSession
instances- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptor
public CoherenceConfiguration.Builder withEventInterceptor(EventInterceptor<?> interceptor)
Add anEventInterceptor
that will be added to allSession
instances as they are created on start-up.- Parameters:
interceptor
- theEventInterceptor
to add- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptors
public CoherenceConfiguration.Builder withEventInterceptors(EventInterceptor<?>... interceptors)
Add theEventInterceptor
instances that will be added to allSession
instances as they are created on start-up.- Parameters:
interceptors
- theEventInterceptor
instances to add- Returns:
- this
CoherenceConfiguration.Builder
-
withEventInterceptors
public CoherenceConfiguration.Builder withEventInterceptors(Iterable<? extends EventInterceptor<?>> interceptors)
Add theEventInterceptor
instances that will be added to allSession
instances as they are created on start-up.- Parameters:
interceptors
- theEventInterceptor
instances to add- Returns:
- this
CoherenceConfiguration.Builder
-
withApplicationContext
public CoherenceConfiguration.Builder withApplicationContext(com.tangosol.application.Context context)
Set theapplication context
to associate to theCoherence
instance.- Parameters:
context
- theapplication context
to associate to theCoherence
instance- Returns:
- this
CoherenceConfiguration.Builder
-
build
public CoherenceConfiguration build()
Build aCoherenceConfiguration
from thisCoherenceConfiguration.Builder
.- Returns:
- a
CoherenceConfiguration
created from thisCoherenceConfiguration.Builder
-
-