This commit is contained in:
@@ -155,7 +155,7 @@ public class NodeHttpServer extends NodeServer {
|
|||||||
if (ws1 == ws2) {
|
if (ws1 == ws2) {
|
||||||
Priority p1 = o1.getType().getAnnotation(Priority.class);
|
Priority p1 = o1.getType().getAnnotation(Priority.class);
|
||||||
Priority p2 = o2.getType().getAnnotation(Priority.class);
|
Priority p2 = o2.getType().getAnnotation(Priority.class);
|
||||||
int v = (p1 == null ? 0 : p1.value()) - (p2 == null ? 0 : p2.value());
|
int v = (p2 == null ? 0 : p2.value()) - (p1 == null ? 0 : p1.value());
|
||||||
return v == 0 ? o1.getType().getName().compareTo(o2.getType().getName()) : 0;
|
return v == 0 ? o1.getType().getName().compareTo(o2.getType().getName()) : 0;
|
||||||
}
|
}
|
||||||
return ws1 ? -1 : 1;
|
return ws1 ? -1 : 1;
|
||||||
|
|||||||
@@ -400,9 +400,8 @@ public abstract class NodeServer {
|
|||||||
Collections.sort(swlist, (o1, o2) -> {
|
Collections.sort(swlist, (o1, o2) -> {
|
||||||
Priority p1 = o1.getClass().getAnnotation(Priority.class);
|
Priority p1 = o1.getClass().getAnnotation(Priority.class);
|
||||||
Priority p2 = o2.getClass().getAnnotation(Priority.class);
|
Priority p2 = o2.getClass().getAnnotation(Priority.class);
|
||||||
int v1 = p1 == null ? 0 : p1.value();
|
int v = (p2 == null ? 0 : p2.value()) - (p1 == null ? 0 : p1.value());
|
||||||
int v2 = p2 == null ? 0 : p2.value();
|
if (v != 0) return v;
|
||||||
if (v1 != v2) return v1 - v2;
|
|
||||||
int rs = Sncp.getResourceType(o1).getName().compareTo(Sncp.getResourceType(o2).getName());
|
int rs = Sncp.getResourceType(o1).getName().compareTo(Sncp.getResourceType(o2).getName());
|
||||||
if (rs == 0) rs = Sncp.getResourceName(o1).compareTo(Sncp.getResourceName(o2));
|
if (rs == 0) rs = Sncp.getResourceName(o1).compareTo(Sncp.getResourceName(o2));
|
||||||
return rs;
|
return rs;
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ public abstract class Filter<C extends Context, R extends Request<C>, P extends
|
|||||||
if (!(o instanceof Filter)) return 1;
|
if (!(o instanceof Filter)) return 1;
|
||||||
Priority p1 = this.getClass().getAnnotation(Priority.class);
|
Priority p1 = this.getClass().getAnnotation(Priority.class);
|
||||||
Priority p2 = o.getClass().getAnnotation(Priority.class);
|
Priority p2 = o.getClass().getAnnotation(Priority.class);
|
||||||
return (p1 == null ? 0 : p1.value()) - (p2 == null ? 0 : p2.value());
|
return (p2 == null ? 0 : p2.value()) - (p1 == null ? 0 : p1.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static java.lang.annotation.ElementType.*;
|
|||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优先级, 值越小越靠前执行
|
* 优先级, 值越大优先级最高,越靠前执行
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
|
|||||||
Reference in New Issue
Block a user