Interface ClusterFilterSupport<T extends ClusterFilterSupport<T>>
-
- Type Parameters:
T
- Real type that implements/extends this interface.
- All Known Subinterfaces:
ClusterService
,ClusterView
,MessagingChannel<T>
,RpcClientBuilder<T>
- All Known Implementing Classes:
UpdatableClusterView
public interface ClusterFilterSupport<T extends ClusterFilterSupport<T>>
Base interface for types that support cluster topology filtering.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default T
filter(ClusterNodeFilter filter)
Returns a copy of this instance that will use the specified filter along with all the filter criteria that were inherited from this instance.T
filterAll(ClusterFilter filter)
Returns a copy of this instance that will use the specified filter along with all the filter criteria that were inherited from this instance.default T
forNode(ClusterNode node)
Returns a copy of this instance that will useClusterFilters.forNode(ClusterNode)
filter along with all the filter criteria that were inherited from this instance.default T
forNode(ClusterNodeId id)
Returns a copy of this instance that will useClusterFilters.forNode(ClusterNodeId)
filter along with all the filter criteria that were inherited from this instance.default T
forOldest()
Returns a copy of this instance that will useClusterFilters.forOldest()
filter along with all the filter criteria that were inherited from this instance.default T
forProperty(String name)
Returns a copy of this instance that will useClusterFilters.forProperty(String)
filter along with all the filter criteria that were inherited from this instance.default T
forProperty(String name, String value)
Returns a copy of this instance that will useClusterFilters.forProperty(String, String)
filter along with all the filter criteria that were inherited from this instance.default T
forRemotes()
Returns a copy of this instance that will useClusterFilters.forRemotes()
filter along with all the filter criteria that were inherited from this instance.default T
forRole(String role)
Returns a copy of this instance that will useClusterFilters.forRole(String)
filter along with all the filter criteria that were inherited from this instance.default T
forService(Class<? extends Service> type)
Returns a copy of this instance that will useClusterFilters.forService(Class)
filter along with all the filter criteria that were inherited from this instance.default T
forYoungest()
Returns a copy of this instance that will useClusterFilters.forYoungest()
filter along with all the filter criteria that were inherited from this instance.
-
-
-
Method Detail
-
filterAll
T filterAll(ClusterFilter filter)
Returns a copy of this instance that will use the specified filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
filter
- Filter.- Returns:
- Filtered instance.
-
filter
default T filter(ClusterNodeFilter filter)
Returns a copy of this instance that will use the specified filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
filter
- Filter.- Returns:
- Filtered instance.
- See Also:
forRemotes()
,forRole(String)
,forProperty(String)
,forNode(ClusterNode)
,forOldest()
,forYoungest()
-
forRole
default T forRole(String role)
Returns a copy of this instance that will useClusterFilters.forRole(String)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
role
- Role (seeClusterNode.hasRole(String)
).- Returns:
- Filtered instance.
-
forProperty
default T forProperty(String name)
Returns a copy of this instance that will useClusterFilters.forProperty(String)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
name
- Property name (seeClusterNode.hasProperty(String)
).- Returns:
- Filtered instance.
-
forProperty
default T forProperty(String name, String value)
Returns a copy of this instance that will useClusterFilters.forProperty(String, String)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
name
- Property name (seeClusterNode.property(String)
).value
- Property value.- Returns:
- Filtered instance.
-
forService
default T forService(Class<? extends Service> type)
Returns a copy of this instance that will useClusterFilters.forService(Class)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
type
- Service type (seeClusterNode.hasService(Class)
)- Returns:
- Filtered instance.
-
forRemotes
default T forRemotes()
Returns a copy of this instance that will useClusterFilters.forRemotes()
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Returns:
- Filtered instance.
-
forNode
default T forNode(ClusterNode node)
Returns a copy of this instance that will useClusterFilters.forNode(ClusterNode)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
node
- Node.- Returns:
- Filtered instance.
-
forNode
default T forNode(ClusterNodeId id)
Returns a copy of this instance that will useClusterFilters.forNode(ClusterNodeId)
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Parameters:
id
- Node.- Returns:
- Filtered instance.
-
forOldest
default T forOldest()
Returns a copy of this instance that will useClusterFilters.forOldest()
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Returns:
- Filter.
-
forYoungest
default T forYoungest()
Returns a copy of this instance that will useClusterFilters.forYoungest()
filter along with all the filter criteria that were inherited from this instance.Notice: for performance reasons it is highly recommended to cache and reuse the filtered instance instead of re-building it over and over again.
// Bad!!! (filtering is performed on every iteration). for (int i = 0; i < 1000; i++) { cluster.forRemotes().forRole("some_role").doSomething(); } // Good (filtering is performed only once). filtered = cluster.forRemotes().forRole("some_role"); for (int i = 0; i < 1000; i++) { filtered.doSomething(); }
- Returns:
- Filtered instance.
-
-