addURI
This commit is contained in:
@@ -1417,7 +1417,7 @@ public final class Application {
|
|||||||
public List<Object> command(String cmd, String[] params) {
|
public List<Object> command(String cmd, String[] params) {
|
||||||
List<NodeServer> localServers = new ArrayList<>(servers); // 顺序sncps, others, watchs
|
List<NodeServer> localServers = new ArrayList<>(servers); // 顺序sncps, others, watchs
|
||||||
List<Object> results = new ArrayList<>();
|
List<Object> results = new ArrayList<>();
|
||||||
localServers.stream().forEach((server) -> {
|
localServers.stream().forEach(server -> {
|
||||||
try {
|
try {
|
||||||
List<Object> rs = server.command(cmd, params);
|
List<Object> rs = server.command(cmd, params);
|
||||||
if (rs != null) {
|
if (rs != null) {
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.redkale.net;
|
package org.redkale.net;
|
||||||
|
|
||||||
import static org.redkale.net.AsyncGroup.UDP_BUFFER_CAPACITY;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
@@ -17,6 +15,8 @@ import java.util.logging.*;
|
|||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import org.redkale.boot.Application;
|
import org.redkale.boot.Application;
|
||||||
import org.redkale.inject.ResourceFactory;
|
import org.redkale.inject.ResourceFactory;
|
||||||
|
import static org.redkale.net.AsyncGroup.UDP_BUFFER_CAPACITY;
|
||||||
|
import org.redkale.net.Filter;
|
||||||
import org.redkale.util.*;
|
import org.redkale.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -584,12 +584,11 @@ public abstract class Server<
|
|||||||
return serverChannel == null ? -1 : serverChannel.getLivingConnectionCount();
|
return serverChannel == null ? -1 : serverChannel.getLivingConnectionCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static URL[] loadLib(final RedkaleClassLoader classLoader, final Logger logger, final String lib) {
|
public static URI[] loadLib(final RedkaleClassLoader classLoader, final Logger logger, final String lib) {
|
||||||
if (lib == null || lib.isEmpty()) {
|
if (lib == null || lib.isEmpty()) {
|
||||||
return new URL[0];
|
return new URI[0];
|
||||||
}
|
}
|
||||||
final Set<URL> set = new HashSet<>();
|
final Set<URI> set = new HashSet<>();
|
||||||
try {
|
|
||||||
for (String s : lib.split(";")) {
|
for (String s : lib.split(";")) {
|
||||||
if (s.isEmpty()) {
|
if (s.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -602,27 +601,24 @@ public abstract class Server<
|
|||||||
throw new RedkaleException("File(" + root + ") cannot listFiles()");
|
throw new RedkaleException("File(" + root + ") cannot listFiles()");
|
||||||
}
|
}
|
||||||
for (File f : lfs) {
|
for (File f : lfs) {
|
||||||
set.add(f.toURI().toURL());
|
set.add(f.toURI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File f = new File(s);
|
File f = new File(s);
|
||||||
if (f.canRead()) {
|
if (f.canRead()) {
|
||||||
set.add(f.toURI().toURL());
|
set.add(f.toURI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RedkaleException(e);
|
|
||||||
}
|
|
||||||
if (set.isEmpty()) {
|
if (set.isEmpty()) {
|
||||||
return new URL[0];
|
return new URI[0];
|
||||||
}
|
}
|
||||||
for (URL url : set) {
|
for (URI uri : set) {
|
||||||
classLoader.addURL(url);
|
classLoader.addURI(uri);
|
||||||
}
|
}
|
||||||
List<URL> list = new ArrayList<>(set);
|
List<URI> list = new ArrayList<>(set);
|
||||||
list.sort((URL o1, URL o2) -> o1.getFile().compareTo(o2.getFile()));
|
list.sort((URI o1, URI o2) -> o1.toASCIIString().compareTo(o2.toASCIIString()));
|
||||||
return list.toArray(new URL[list.size()]);
|
return list.toArray(new URI[list.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -472,6 +472,14 @@ public class RedkaleClassLoader extends URLClassLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addURI(URI uri) {
|
||||||
|
try {
|
||||||
|
super.addURL(uri.toURL());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RedkaleException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addURL(URL url) {
|
public void addURL(URL url) {
|
||||||
super.addURL(url);
|
super.addURL(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user