This is an automated email from the ASF dual-hosted git repository.
harshitha pushed a commit to branch harshithasudhakar-eventmesh#4254
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to
refs/heads/harshithasudhakar-eventmesh#4254 by this push:
new 9b7f90f22 Update Utils.java
9b7f90f22 is described below
commit 9b7f90f22ee538c71f469f3201f070a3ecd324ad
Author: Harshitha Sudhakar
<[email protected]>
AuthorDate: Mon Aug 21 14:47:20 2023 +0530
Update Utils.java
---
.../src/main/java/org/apache/eventmesh/util/Utils.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git
a/eventmesh-examples/src/main/java/org/apache/eventmesh/util/Utils.java
b/eventmesh-examples/src/main/java/org/apache/eventmesh/util/Utils.java
index fead0db9b..191cd1ce9 100644
--- a/eventmesh-examples/src/main/java/org/apache/eventmesh/util/Utils.java
+++ b/eventmesh-examples/src/main/java/org/apache/eventmesh/util/Utils.java
@@ -30,12 +30,15 @@ import java.net.SocketException;
import java.util.Enumeration;
import java.util.Properties;
+import lombok.experimental.UtilityClass;
+
+@UtilityClass
public class Utils {
/**
* Get local IP address
*/
- public static String getLocalIP() throws IOException {
+ public String getLocalIP() throws IOException {
if (isWindowsOS()) {
return InetAddress.getLocalHost().getHostAddress();
} else {
@@ -48,7 +51,7 @@ public class Utils {
*
* @return true - Windows false - other OS
*/
- public static boolean isWindowsOS() {
+ public boolean isWindowsOS() {
return SystemUtils.IS_OS_WINDOWS;
}
@@ -57,7 +60,7 @@ public class Utils {
*
* @return IP address
*/
- private static String getLinuxLocalIp() throws SocketException {
+ private String getLinuxLocalIp() throws SocketException {
String ip = ExampleConstants.DEFAULT_EVENTMESH_IP;
for (final Enumeration<NetworkInterface> en =
NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
@@ -85,7 +88,7 @@ public class Utils {
* @param fileName
* @return Properties
*/
- public static Properties readPropertiesFile(final String fileName) throws
IOException {
+ public Properties readPropertiesFile(final String fileName) throws
IOException {
try (InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)) {
final Properties properties = new Properties();
properties.load(inputStream);
@@ -98,7 +101,7 @@ public class Utils {
* @param path path
* @return url
*/
- public static String getURL(String port, String path) {
+ public String getURL(String port, String path) {
return "http://" + IPUtils.getLocalAddress() + ":" + port + path;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]