-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- BinaryWeightRandomLoadBalancer - ArrayWeightRandomLoadBalancer - TreeWeightRandomLoadBalancer - RandomLoadBalancer - add ServiceListenable api - add GovernAutoServiceRegistrationOfNoneWeb
- Loading branch information
Showing
38 changed files
with
929 additions
and
86 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
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.ahoo.govern.core.util; | ||
|
||
import java.lang.management.ManagementFactory; | ||
|
||
/** | ||
* @author ahoo wang | ||
*/ | ||
public final class Systems { | ||
private Systems() { | ||
} | ||
|
||
|
||
public static String getCurrentProcessName() { | ||
return ManagementFactory.getRuntimeMXBean().getName(); | ||
} | ||
|
||
public static long getCurrentProcessId() { | ||
String processName = getCurrentProcessName(); | ||
String processIdStr = processName.split("@")[0]; | ||
return Long.parseLong(processIdStr); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
core/src/test/java/me/ahoo/govern/core/util/SystemsTest.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package me.ahoo.govern.core.util; | ||
|
||
import lombok.var; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author ahoo wang | ||
*/ | ||
class SystemsTest { | ||
|
||
@Test | ||
public void getCurrentProcessName() { | ||
var currentProcessName = Systems.getCurrentProcessName(); | ||
Assertions.assertNotNull(currentProcessName); | ||
} | ||
|
||
@Test | ||
public void getCurrentProcessId() { | ||
var processId = Systems.getCurrentProcessId(); | ||
Assertions.assertTrue(processId > 0); | ||
} | ||
} |
25 changes: 18 additions & 7 deletions
25
discovery/src/main/java/me/ahoo/govern/discovery/RenewProperties.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 | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
package me.ahoo.govern.discovery; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* @author ahoo wang | ||
*/ | ||
public class RenewProperties { | ||
@Getter | ||
@Setter | ||
|
||
private int initialDelay = 1; | ||
@Getter | ||
@Setter | ||
|
||
private int period = 10; | ||
|
||
public int getInitialDelay() { | ||
return initialDelay; | ||
} | ||
|
||
public void setInitialDelay(int initialDelay) { | ||
this.initialDelay = initialDelay; | ||
} | ||
|
||
public int getPeriod() { | ||
return period; | ||
} | ||
|
||
public void setPeriod(int period) { | ||
this.period = period; | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
discovery/src/main/java/me/ahoo/govern/discovery/ServiceListenable.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package me.ahoo.govern.discovery; | ||
|
||
/** | ||
* @author ahoo wang | ||
*/ | ||
public interface ServiceListenable { | ||
|
||
void addListener(NamespacedServiceId namespacedServiceId, ServiceChangedListener serviceChangedListener); | ||
|
||
void removeListener(NamespacedServiceId namespacedServiceId, ServiceChangedListener serviceChangedListener); | ||
} |
Oops, something went wrong.