Skip to content
Merged

Dev #49

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
18df77b
Merge pull request #48 from microsphere-projects/main
mercyblitz Dec 21, 2024
ac63153
Update AnnotationUtilsTest.java
mercyblitz Dec 21, 2024
dc5f93b
Remove javax.xml.ws: jaxws-api
mercyblitz Dec 21, 2024
572bb22
Remove the dependency javax.annotation:javax.annotation-api
mercyblitz Dec 21, 2024
2b5b43e
Update JmxUtils.java
mercyblitz Dec 22, 2024
8553da6
Update JmxUtilsTest.java
mercyblitz Dec 22, 2024
635a8e3
Update ManagementUtils.java
mercyblitz Dec 22, 2024
38ed4a2
Update ClassLoaderUtils.java
mercyblitz Dec 22, 2024
1dd5bd5
Update ClassPathUtils.java
mercyblitz Dec 22, 2024
bb65d64
Update ManagementUtils.java
mercyblitz Dec 22, 2024
e2bea85
Update FilterUtils.java
mercyblitz Dec 22, 2024
a2137c2
Update FileUtils.java
mercyblitz Dec 22, 2024
3448399
Update UnsafeUtils.java
mercyblitz Dec 22, 2024
dec2a2b
Update URLUtils.java
mercyblitz Dec 22, 2024
83d3d90
Update FormatUtils.java
mercyblitz Dec 22, 2024
823ea77
Update JarUtils.java
mercyblitz Dec 22, 2024
fdaba9d
Update StringUtils.java
mercyblitz Dec 22, 2024
eddd8f1
Update pom.xml
mercyblitz Dec 22, 2024
2e61c9e
Update JmxUtilsTest.java
mercyblitz Dec 22, 2024
2845046
Update MethodUtilsTest.java
mercyblitz Dec 22, 2024
542f70c
Update JmxUtils.java
mercyblitz Dec 22, 2024
77088fc
Update pom.xml
mercyblitz Dec 23, 2024
143b39f
Update maven-build.yml
mercyblitz Dec 23, 2024
054dfb5
Update dependabot.yml
mercyblitz Dec 23, 2024
e21df2a
Update maven-build.yml
mercyblitz Dec 23, 2024
41d6814
Update maven-build.yml
mercyblitz Dec 23, 2024
70e7b5d
Update pom.xml
mercyblitz Dec 23, 2024
ec931dc
Update MethodUtilsTest.java
mercyblitz Dec 23, 2024
e4121d5
Polish #55
mercyblitz Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "maven" # See documentation for possible values
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache: maven

- name: Build with Maven
run: mvn --batch-mode --update-snapshots --file pom.xml -Drevision=0.0.1-SNAPSHOT clean install
run: mvn --batch-mode --update-snapshots --file pom.xml -Drevision=0.0.1-SNAPSHOT clean install --activate-profiles coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
Expand Down
9 changes: 7 additions & 2 deletions microsphere-annotation-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<name>Microsphere :: Java :: Annotation Processor</name>
<description>Microsphere Annotation Processor</description>

<properties>
<javax.ws.rs.version>2.1</javax.ws.rs.version>
<jaxws-api.version>2.3.1</jaxws-api.version>
</properties>

<dependencies>

<!-- microsphere-->
Expand All @@ -44,28 +49,28 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax.ws.rs.version}</version>
<scope>test</scope>
</dependency>

<!-- JAX-WS API-->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>${jaxws-api.version}</version>
<scope>test</scope>
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

Expand Down
39 changes: 16 additions & 23 deletions microsphere-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<description>Microsphere Java Core</description>

<properties>
<surefire.argLine></surefire.argLine>
<jvm.argLine></jvm.argLine>
<jacoco.argLine></jacoco.argLine>
</properties>

<dependencies>
Expand All @@ -31,6 +32,13 @@
<optional>true</optional>
</dependency>

<!-- Java Common Annotations -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<optional>true</optional>
</dependency>

<!-- Third-Party Dependencies -->
<!-- SLF4j -->
<dependency>
Expand Down Expand Up @@ -59,31 +67,17 @@
<scope>test</scope>
</dependency>

<!-- JAX-WS API-->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<scope>test</scope>
</dependency>

<!-- Logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

<!-- Java Common Annotations -->
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<scope>test</scope>
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

Expand All @@ -107,10 +101,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>${surefire.argLine}</argLine>
<argLine>@{jacoco.argLine} ${jvm.argLine}</argLine>
</configuration>
</plugin>

</plugins>
</build>

Expand All @@ -135,10 +128,10 @@
<jdk>[9,15]</jdk>
</activation>
<properties>
<surefire.argLine>
<jvm.argLine>
--illegal-access=permit
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
</surefire.argLine>
</jvm.argLine>
</properties>
</profile>

Expand All @@ -148,9 +141,9 @@
<jdk>[16,)</jdk>
</activation>
<properties>
<surefire.argLine>
<jvm.argLine>
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
</surefire.argLine>
</jvm.argLine>
</properties>
</profile>

Expand All @@ -162,7 +155,7 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<propertyName>jacoco.argLine</propertyName>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
package io.microsphere.filter;

import io.microsphere.util.BaseUtils;

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -18,7 +20,7 @@
* @see FilterUtils
* @since 1.0.0
*/
public abstract class FilterUtils {
public abstract class FilterUtils extends BaseUtils {

private FilterUtils() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
package io.microsphere.io;

import io.microsphere.util.BaseUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -21,7 +23,7 @@
* @see FileUtils
* @since 1.0.0
*/
public abstract class FileUtils {
public abstract class FileUtils extends BaseUtils {

Check warning on line 26 in microsphere-java-core/src/main/java/io/microsphere/io/FileUtils.java

View check run for this annotation

Codecov / codecov/patch

microsphere-java-core/src/main/java/io/microsphere/io/FileUtils.java#L26

Added line #L26 was not covered by tests

/**
* Resolve Relative Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,28 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import java.lang.management.ClassLoadingMXBean;
import java.lang.management.CompilationMXBean;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryManagerMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.lang.management.ThreadMXBean;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

import static io.microsphere.collection.MapUtils.newHashMap;
import static io.microsphere.logging.LoggerFactory.getLogger;
import static java.util.Collections.emptyMap;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableMap;
import static java.util.Optional.ofNullable;


/**
Expand All @@ -49,7 +63,162 @@ public abstract class JmxUtils extends BaseUtils {

private static final Logger logger = getLogger(JmxUtils.class);

private static final MBeanAttribute[] EMPTY_MBEAN_ATTRIBUTE_ARRAY = new MBeanAttribute[0];
public static final MBeanAttribute[] EMPTY_MBEAN_ATTRIBUTE_ARRAY = new MBeanAttribute[0];

private static ClassLoadingMXBean classLoadingMXBean;

private static MemoryMXBean memoryMXBean;

private static ThreadMXBean threadMXBean;

private static RuntimeMXBean runtimeMXBean;

private static Optional<CompilationMXBean> compilationMXBean;

private static OperatingSystemMXBean operatingSystemMXBean;

private static List<MemoryPoolMXBean> memoryPoolMXBeans;

private static List<MemoryManagerMXBean> memoryManagerMXBeans;

private static List<GarbageCollectorMXBean> garbageCollectorMXBeans;

/**
* Returns the managed bean for the class loading system of the Java virtual machine.
*
* @return a {@link ClassLoadingMXBean} object for
* the Java virtual machine.
* @see {@link ManagementFactory#getClassLoadingMXBean()}
*/
@Nonnull
public static ClassLoadingMXBean getClassLoadingMXBean() {
if (classLoadingMXBean == null) {
classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
}
return classLoadingMXBean;
}

/**
* Returns the managed bean for the memory system of the Java virtual machine.
*
* @return a {@link MemoryMXBean} object for the Java virtual machine.
* @see {@link ManagementFactory#getMemoryMXBean()}
*/
@Nonnull
public static MemoryMXBean getMemoryMXBean() {
if (memoryMXBean == null) {
memoryMXBean = ManagementFactory.getMemoryMXBean();
}
return memoryMXBean;
}

/**
* Returns the managed bean for the thread system of the Java virtual machine.
*
* @return a {@link ThreadMXBean} object for the Java virtual machine.
* @see {@link ManagementFactory#getThreadMXBean()}
*/
@Nonnull
public static ThreadMXBean getThreadMXBean() {
if (threadMXBean == null) {
threadMXBean = ManagementFactory.getThreadMXBean();
}
return threadMXBean;
}

/**
* Returns the managed bean for the runtime system of the Java virtual machine.
*
* @return a {@link RuntimeMXBean} object for the Java virtual machine.
* @see {@link ManagementFactory#getRuntimeMXBean()}
*/
@Nonnull
public static RuntimeMXBean getRuntimeMXBean() {
if (runtimeMXBean == null) {
runtimeMXBean = ManagementFactory.getRuntimeMXBean();
}
return runtimeMXBean;
}

/**
* Returns the managed bean for the compilation system of the Java virtual machine.
* This method returns {@code null} if the Java virtual machine has no compilation system.
*
* @return an instance of {@link Optional} holding a {@link CompilationMXBean} object for the Java virtual machine
* or {@code null if the Java virtual machine has no compilation system.
* @see {@link ManagementFactory#getCompilationMXBean()}
*/
@Nullable
public static Optional<CompilationMXBean> getCompilationMXBean() {
if (compilationMXBean == null) {
compilationMXBean = ofNullable(ManagementFactory.getCompilationMXBean());
}
return compilationMXBean;
}

/**
* Returns the managed bean for the operating system on which
* the Java virtual machine is running.
*
* @return an {@link OperatingSystemMXBean} object for
* the Java virtual machine.
* @see {@link ManagementFactory#getOperatingSystemMXBean()}
*/
@Nonnull
public static OperatingSystemMXBean getOperatingSystemMXBean() {
if (operatingSystemMXBean == null) {
operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
}
return operatingSystemMXBean;
}

/**
* Returns a list of {@link MemoryPoolMXBean} objects in the Java virtual machine.
* The Java virtual machine can have one or more memory pools.
* It may add or remove memory pools during execution.
*
* @return a list of {@code MemoryPoolMXBean} objects.
* @see {@link ManagementFactory#getMemoryPoolMXBeans()}
*/
@Nonnull
public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
if (memoryPoolMXBeans == null) {
memoryPoolMXBeans = unmodifiableList(ManagementFactory.getMemoryPoolMXBeans());
}
return memoryPoolMXBeans;
}

/**
* Returns a list of {@link MemoryManagerMXBean} objects in the Java virtual machine.
* The Java virtual machine can have one or more memory managers.
* It may add or remove memory managers during execution.
*
* @return a list of {@code MemoryManagerMXBean} objects.
* @see {@link ManagementFactory#getMemoryManagerMXBeans()}
*/
@Nonnull
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
if (memoryManagerMXBeans == null) {
memoryManagerMXBeans = unmodifiableList(ManagementFactory.getMemoryManagerMXBeans());
}
return memoryManagerMXBeans;
}

/**
* Returns a list of {@link GarbageCollectorMXBean} objects in the Java virtual machine.
* The Java virtual machine may have one or more {@code GarbageCollectorMXBean} objects.
* It may add or remove {@code GarbageCollectorMXBean} during execution.
*
* @return a list of {@code GarbageCollectorMXBean} objects.
* @see {@link ManagementFactory#getGarbageCollectorMXBeans()}
*/
@Nonnull
public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
if (garbageCollectorMXBeans == null) {
garbageCollectorMXBeans = unmodifiableList(ManagementFactory.getGarbageCollectorMXBeans());
}
return garbageCollectorMXBeans;
}

/**
* Get the {@link Map} with the attribute name and {@link MBeanAttribute MBeanAttributes} from the specified named
Expand Down
Loading
Loading