Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nested cluster multicast/membership configurations.
- Loading branch information
Showing
10 changed files
with
283 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
cluster/src/main/java/io/atomix/cluster/MembershipConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,91 @@ | |||
/* | |||
* Copyright 2018-present Open Networking Foundation | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
package io.atomix.cluster; | |||
|
|||
import io.atomix.utils.config.Config; | |||
|
|||
/** | |||
* Cluster membership configuration. | |||
*/ | |||
public class MembershipConfig implements Config { | |||
private static final int DEFAULT_BROADCAST_INTERVAL = 100; | |||
private static final int DEFAULT_REACHABILITY_TIMEOUT = 10000; | |||
private static final int DEFAULT_REACHABILITY_THRESHOLD = 10; | |||
|
|||
private int broadcastInterval = DEFAULT_BROADCAST_INTERVAL; | |||
private int reachabilityThreshold = DEFAULT_REACHABILITY_THRESHOLD; | |||
private int reachabilityTimeout = DEFAULT_REACHABILITY_TIMEOUT; | |||
|
|||
/** | |||
* Returns the reachability broadcast interval. | |||
* | |||
* @return the reachability broadcast interval | |||
*/ | |||
public int getBroadcastInterval() { | |||
return broadcastInterval; | |||
} | |||
|
|||
/** | |||
* Sets the reachability broadcast interval. | |||
* | |||
* @param broadcastInterval the reachability broadcast interval | |||
* @return the membership configuration | |||
*/ | |||
public MembershipConfig setBroadcastInterval(int broadcastInterval) { | |||
this.broadcastInterval = broadcastInterval; | |||
return this; | |||
} | |||
|
|||
/** | |||
* Returns the reachability failure detection threshold. | |||
* | |||
* @return the reachability failure detection threshold | |||
*/ | |||
public int getReachabilityThreshold() { | |||
return reachabilityThreshold; | |||
} | |||
|
|||
/** | |||
* Sets the reachability failure detection threshold. | |||
* | |||
* @param reachabilityThreshold the reachability failure detection threshold | |||
* @return the membership configuration | |||
*/ | |||
public MembershipConfig setReachabilityThreshold(int reachabilityThreshold) { | |||
this.reachabilityThreshold = reachabilityThreshold; | |||
return this; | |||
} | |||
|
|||
/** | |||
* Returns the reachability failure timeout. | |||
* | |||
* @return the reachability failure timeout | |||
*/ | |||
public int getReachabilityTimeout() { | |||
return reachabilityTimeout; | |||
} | |||
|
|||
/** | |||
* Sets the reachability failure timeout. | |||
* | |||
* @param reachabilityTimeout the reachability failure timeout | |||
* @return the membership configuration | |||
*/ | |||
public MembershipConfig setReachabilityTimeout(int reachabilityTimeout) { | |||
this.reachabilityTimeout = reachabilityTimeout; | |||
return this; | |||
} | |||
} |
Oops, something went wrong.