mirror of
https://github.com/apache/maven-mvnd.git
synced 2026-01-16 07:01:48 +08:00
Improve status and daemon selection output
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package org.jboss.fuse.mvnd.daemon;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -24,6 +25,7 @@ import java.util.function.ToLongFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jboss.fuse.mvnd.client.DaemonCompatibilitySpec;
|
||||
import org.jboss.fuse.mvnd.client.DaemonCompatibilitySpec.Result;
|
||||
import org.jboss.fuse.mvnd.client.DaemonExpirationStatus;
|
||||
import org.jboss.fuse.mvnd.client.DaemonInfo;
|
||||
import org.jboss.fuse.mvnd.client.DaemonState;
|
||||
@@ -129,9 +131,10 @@ public class DaemonExpiration {
|
||||
static DaemonExpirationStrategy compatible() {
|
||||
return daemon -> {
|
||||
DaemonCompatibilitySpec constraint = new DaemonCompatibilitySpec(
|
||||
daemon.getInfo().getJavaHome(), daemon.getInfo().getOptions());
|
||||
Paths.get(daemon.getInfo().getJavaHome()), daemon.getInfo().getOptions());
|
||||
long compatible = daemon.getRegistry().getAll().stream()
|
||||
.filter(constraint::isSatisfiedBy)
|
||||
.map(constraint::isSatisfiedBy)
|
||||
.filter(Result::isCompatible)
|
||||
.count();
|
||||
if (compatible > 1) {
|
||||
return new DaemonExpirationResult(GRACEFUL_EXPIRE, "other compatible daemons were started");
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -101,7 +102,8 @@ public class Server implements AutoCloseable, Runnable {
|
||||
|
||||
List<String> opts = new ArrayList<>();
|
||||
long cur = System.currentTimeMillis();
|
||||
info = new DaemonInfo(uid, System.getProperty("java.home"), layout.mavenHome().toString(),
|
||||
final Path javaHome = Paths.get(System.getProperty("java.home")).toRealPath();
|
||||
info = new DaemonInfo(uid, javaHome.toString(), layout.mavenHome().toString(),
|
||||
DaemonRegistry.getProcessId(), socket.socket().getLocalPort(),
|
||||
idleTimeout, Locale.getDefault().toLanguageTag(), opts,
|
||||
Busy, cur, cur);
|
||||
|
||||
Reference in New Issue
Block a user