-
Notifications
You must be signed in to change notification settings - Fork 1.2k
framework-cluster: use bind.interface for cluster communication #11797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
shwstppr
wants to merge
1
commit into
apache:main
Choose a base branch
from
shapeblue:clustercom-usebindintf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+125
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
66 changes: 66 additions & 0 deletions
66
utils/src/main/java/org/apache/cloudstack/utils/ServerPropertiesUtil.java
This file contains hidden or 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you 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 org.apache.cloudstack.utils; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.util.Properties; | ||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.cloud.utils.PropertiesUtil; | ||
|
||
public class ServerPropertiesUtil { | ||
private static final Logger logger = LoggerFactory.getLogger(ServerPropertiesUtil.class); | ||
private static final String PROPERTIES_FILE = "server.properties"; | ||
private static final AtomicReference<Properties> propertiesRef = new AtomicReference<>(); | ||
|
||
public static String getProperty(String name) { | ||
Properties props = propertiesRef.get(); | ||
if (props != null) { | ||
return props.getProperty(name); | ||
} | ||
File propsFile = PropertiesUtil.findConfigFile(PROPERTIES_FILE); | ||
if (propsFile == null) { | ||
logger.error("{} file not found", PROPERTIES_FILE); | ||
return null; | ||
} | ||
Properties tempProps = new Properties(); | ||
try (FileInputStream is = new FileInputStream(propsFile)) { | ||
tempProps.load(is); | ||
} catch (IOException e) { | ||
logger.error("Error loading {}: {}", PROPERTIES_FILE, e.getMessage(), e); | ||
return null; | ||
} | ||
if (!propertiesRef.compareAndSet(null, tempProps)) { | ||
tempProps = propertiesRef.get(); | ||
} | ||
return tempProps.getProperty(name); | ||
} | ||
|
||
public static String getProperty(String name, String defaultValue) { | ||
String value = getProperty(name); | ||
if (value == null) { | ||
value = defaultValue; | ||
} | ||
return value; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bind.interface
is a bit misleading, maybebind.address
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weizhouapache I'm not sure why it is named that way
https://github.com/apache/cloudstack/blob/main/client/conf/server.properties.in#L20
https://github.com/apache/cloudstack/blob/main/client/src/main/java/org/apache/cloudstack/ServerDaemon.java#L252
I didn't want to change the property name as it already exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I see
let's keep the name
can you update the description in server.properties ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the javadoc
https://javadoc.jetty.org/jetty-12/org/eclipse/jetty/server/AbstractNetworkConnector.html#setHost(java.lang.String)
so IP/hostname/null/0.0.0.0 are valid values. maybe we need to consider them ?