格式化
This commit is contained in:
@@ -536,7 +536,7 @@ public final class Rest {
|
|||||||
FieldVisitor fv;
|
FieldVisitor fv;
|
||||||
MethodDebugVisitor mv;
|
MethodDebugVisitor mv;
|
||||||
AnnotationVisitor av0;
|
AnnotationVisitor av0;
|
||||||
cw.visit(V11, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, newDynName, null, supDynName, null);
|
cw.visit(V11, ACC_PUBLIC + ACC_SUPER, newDynName, null, supDynName, null);
|
||||||
{ //RestDyn
|
{ //RestDyn
|
||||||
av0 = cw.visitAnnotation(Type.getDescriptor(RestDyn.class), true);
|
av0 = cw.visitAnnotation(Type.getDescriptor(RestDyn.class), true);
|
||||||
av0.visit("simple", false); //WebSocketServlet必须要解析http-header
|
av0.visit("simple", false); //WebSocketServlet必须要解析http-header
|
||||||
@@ -588,7 +588,8 @@ public final class Rest {
|
|||||||
Resource res = field.getAnnotation(Resource.class);
|
Resource res = field.getAnnotation(Resource.class);
|
||||||
javax.annotation.Resource res2 = field.getAnnotation(javax.annotation.Resource.class);
|
javax.annotation.Resource res2 = field.getAnnotation(javax.annotation.Resource.class);
|
||||||
java.lang.reflect.Type fieldType = field.getGenericType();
|
java.lang.reflect.Type fieldType = field.getGenericType();
|
||||||
fv = cw.visitField(ACC_PRIVATE, "_redkale_resource_" + i, Type.getDescriptor(field.getType()), fieldType == field.getType() ? null : Utility.getTypeDescriptor(fieldType), null);
|
fv = cw.visitField(ACC_PRIVATE, "_redkale_resource_" + i, Type.getDescriptor(field.getType()),
|
||||||
|
fieldType == field.getType() ? null : Utility.getTypeDescriptor(fieldType), null);
|
||||||
{
|
{
|
||||||
av0 = fv.visitAnnotation(resDesc, true);
|
av0 = fv.visitAnnotation(resDesc, true);
|
||||||
av0.visit("name", res != null ? res.name() : res2.name());
|
av0.visit("name", res != null ? res.name() : res2.name());
|
||||||
@@ -599,7 +600,8 @@ public final class Rest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ //_redkale_annotations
|
{ //_redkale_annotations
|
||||||
fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "_redkale_annotations", "Ljava/util/Map;", "Ljava/util/Map<Ljava/lang/String;[Ljava/lang/annotation/Annotation;>;", null);
|
fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, "_redkale_annotations", "Ljava/util/Map;",
|
||||||
|
"Ljava/util/Map<Ljava/lang/String;[Ljava/lang/annotation/Annotation;>;", null);
|
||||||
fv.visitEnd();
|
fv.visitEnd();
|
||||||
}
|
}
|
||||||
{ //_DynWebSocketServlet构造函数
|
{ //_DynWebSocketServlet构造函数
|
||||||
@@ -635,7 +637,8 @@ public final class Rest {
|
|||||||
mv.visitEnd();
|
mv.visitEnd();
|
||||||
}
|
}
|
||||||
{ //createWebSocket 方法
|
{ //createWebSocket 方法
|
||||||
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PROTECTED, "createWebSocket", "()" + wsDesc, "<G::Ljava/io/Serializable;T:Ljava/lang/Object;>()L" + WebSocket.class.getName().replace('.', '/') + "<TG;TT;>;", null));
|
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PROTECTED, "createWebSocket", "()" + wsDesc,
|
||||||
|
"<G::Ljava/io/Serializable;T:Ljava/lang/Object;>()L" + WebSocket.class.getName().replace('.', '/') + "<TG;TT;>;", null));
|
||||||
mv.visitTypeInsn(NEW, newDynName + "$" + newDynWebSokcetSimpleName);
|
mv.visitTypeInsn(NEW, newDynName + "$" + newDynWebSokcetSimpleName);
|
||||||
mv.visitInsn(DUP);
|
mv.visitInsn(DUP);
|
||||||
for (int i = 0; i < resourcesFields.size(); i++) {
|
for (int i = 0; i < resourcesFields.size(); i++) {
|
||||||
@@ -648,7 +651,8 @@ public final class Rest {
|
|||||||
mv.visitEnd();
|
mv.visitEnd();
|
||||||
}
|
}
|
||||||
{ //createRestOnMessageConsumer
|
{ //createRestOnMessageConsumer
|
||||||
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PROTECTED, "createRestOnMessageConsumer", "()Ljava/util/function/BiConsumer;", "()Ljava/util/function/BiConsumer<" + wsDesc + "Ljava/lang/Object;>;", null));
|
mv = new MethodDebugVisitor(cw.visitMethod(ACC_PROTECTED, "createRestOnMessageConsumer",
|
||||||
|
"()Ljava/util/function/BiConsumer;", "()Ljava/util/function/BiConsumer<" + wsDesc + "Ljava/lang/Object;>;", null));
|
||||||
mv.visitTypeInsn(NEW, newDynConsumerFullName);
|
mv.visitTypeInsn(NEW, newDynConsumerFullName);
|
||||||
mv.visitInsn(DUP);
|
mv.visitInsn(DUP);
|
||||||
mv.visitMethodInsn(INVOKESPECIAL, newDynConsumerFullName, "<init>", "()V", false);
|
mv.visitMethodInsn(INVOKESPECIAL, newDynConsumerFullName, "<init>", "()V", false);
|
||||||
@@ -1683,7 +1687,7 @@ public final class Rest {
|
|||||||
final List<Object[]> restConverts = new ArrayList<>();
|
final List<Object[]> restConverts = new ArrayList<>();
|
||||||
final Map<String, Method> mappingurlToMethod = new HashMap<>();
|
final Map<String, Method> mappingurlToMethod = new HashMap<>();
|
||||||
|
|
||||||
cw.visit(V11, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, newDynName, null, supDynName, null);
|
cw.visit(V11, ACC_PUBLIC + ACC_SUPER, newDynName, null, supDynName, null);
|
||||||
|
|
||||||
{ //RestDynSourceType
|
{ //RestDynSourceType
|
||||||
av0 = cw.visitAnnotation(Type.getDescriptor(RestDynSourceType.class), true);
|
av0 = cw.visitAnnotation(Type.getDescriptor(RestDynSourceType.class), true);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.redkale.convert.bson.BsonConvert;
|
|||||||
import org.redkale.mq.MessageAgent;
|
import org.redkale.mq.MessageAgent;
|
||||||
import org.redkale.net.http.WebSocketNode;
|
import org.redkale.net.http.WebSocketNode;
|
||||||
import org.redkale.net.sncp.SncpRemoteInfo.SncpRemoteAction;
|
import org.redkale.net.sncp.SncpRemoteInfo.SncpRemoteAction;
|
||||||
|
import org.redkale.schedule.Scheduled;
|
||||||
import org.redkale.service.*;
|
import org.redkale.service.*;
|
||||||
import org.redkale.util.AnyValue;
|
import org.redkale.util.AnyValue;
|
||||||
import org.redkale.util.RedkaleClassLoader;
|
import org.redkale.util.RedkaleClassLoader;
|
||||||
@@ -30,7 +31,6 @@ import org.redkale.util.ResourceFactory;
|
|||||||
import org.redkale.util.TypeToken;
|
import org.redkale.util.TypeToken;
|
||||||
import org.redkale.util.Uint128;
|
import org.redkale.util.Uint128;
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
import org.redkale.schedule.Scheduled;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service Node Communicate Protocol
|
* Service Node Communicate Protocol
|
||||||
@@ -173,7 +173,8 @@ public abstract class Sncp {
|
|||||||
Method old = actionids.get(actionid);
|
Method old = actionids.get(actionid);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
if (old.getDeclaringClass().equals(method.getDeclaringClass())) {
|
if (old.getDeclaringClass().equals(method.getDeclaringClass())) {
|
||||||
throw new SncpException(serviceTypeOrImplClass.getName() + " have one more same action(Method=" + method + ", " + old + ", actionid=" + actionid + ")");
|
throw new SncpException(serviceTypeOrImplClass.getName()
|
||||||
|
+ " have one more same action(Method=" + method + ", " + old + ", actionid=" + actionid + ")");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -324,7 +325,9 @@ public abstract class Sncp {
|
|||||||
if (WebSocketNode.class.isAssignableFrom(resourceType)) {
|
if (WebSocketNode.class.isAssignableFrom(resourceType)) {
|
||||||
return getSncpReqTopicPrefix() + "module.wsnode" + nodeid + (resourceName.isEmpty() ? "" : ("-" + resourceName));
|
return getSncpReqTopicPrefix() + "module.wsnode" + nodeid + (resourceName.isEmpty() ? "" : ("-" + resourceName));
|
||||||
}
|
}
|
||||||
return getSncpReqTopicPrefix() + "module." + resourceType.getSimpleName().replaceAll("Service.*$", "").toLowerCase() + (resourceName.isEmpty() ? "" : ("-" + resourceName));
|
return getSncpReqTopicPrefix() + "module."
|
||||||
|
+ resourceType.getSimpleName().replaceAll("Service.*$", "").toLowerCase()
|
||||||
|
+ (resourceName.isEmpty() ? "" : ("-" + resourceName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSncpReqTopicPrefix() {
|
public static String getSncpReqTopicPrefix() {
|
||||||
@@ -557,7 +560,7 @@ public abstract class Sncp {
|
|||||||
MethodDebugVisitor mv;
|
MethodDebugVisitor mv;
|
||||||
AnnotationVisitor av0;
|
AnnotationVisitor av0;
|
||||||
|
|
||||||
cw.visit(V11, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, newDynName, null, supDynName, null);
|
cw.visit(V11, ACC_PUBLIC + ACC_SUPER, newDynName, null, supDynName, null);
|
||||||
{ //给动态生成的Service类标记上Resource
|
{ //给动态生成的Service类标记上Resource
|
||||||
av0 = cw.visitAnnotation(resDesc, true);
|
av0 = cw.visitAnnotation(resDesc, true);
|
||||||
av0.visit("name", name);
|
av0.visit("name", name);
|
||||||
@@ -786,7 +789,8 @@ public abstract class Sncp {
|
|||||||
if (!java.lang.reflect.Modifier.isPublic(mod)) {
|
if (!java.lang.reflect.Modifier.isPublic(mod)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final SncpRemoteInfo info = createSncpRemoteInfo(name, getResourceType(serviceTypeOrImplClass), serviceTypeOrImplClass, BsonConvert.root(), sncpRpcGroups, client, agent, remoteGroup);
|
final SncpRemoteInfo info = createSncpRemoteInfo(name, getResourceType(serviceTypeOrImplClass),
|
||||||
|
serviceTypeOrImplClass, BsonConvert.root(), sncpRpcGroups, client, agent, remoteGroup);
|
||||||
final String supDynName = serviceTypeOrImplClass.getName().replace('.', '/');
|
final String supDynName = serviceTypeOrImplClass.getName().replace('.', '/');
|
||||||
final String sncpInfoName = SncpRemoteInfo.class.getName().replace('.', '/');
|
final String sncpInfoName = SncpRemoteInfo.class.getName().replace('.', '/');
|
||||||
final String resDesc = Type.getDescriptor(Resource.class);
|
final String resDesc = Type.getDescriptor(Resource.class);
|
||||||
@@ -836,7 +840,8 @@ public abstract class Sncp {
|
|||||||
MethodDebugVisitor mv;
|
MethodDebugVisitor mv;
|
||||||
AnnotationVisitor av0;
|
AnnotationVisitor av0;
|
||||||
|
|
||||||
cw.visit(V11, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, newDynName, null, serviceTypeOrImplClass.isInterface() ? "java/lang/Object" : supDynName, serviceTypeOrImplClass.isInterface() ? new String[]{supDynName} : null);
|
cw.visit(V11, ACC_PUBLIC + ACC_SUPER, newDynName, null, serviceTypeOrImplClass.isInterface() ? "java/lang/Object" : supDynName,
|
||||||
|
serviceTypeOrImplClass.isInterface() ? new String[]{supDynName} : null);
|
||||||
{ //给动态生成的Service类标记上Resource
|
{ //给动态生成的Service类标记上Resource
|
||||||
av0 = cw.visitAnnotation(resDesc, true);
|
av0 = cw.visitAnnotation(resDesc, true);
|
||||||
av0.visit("name", name);
|
av0.visit("name", name);
|
||||||
@@ -956,7 +961,8 @@ public abstract class Sncp {
|
|||||||
mv.visitVarInsn(ILOAD, insn);
|
mv.visitVarInsn(ILOAD, insn);
|
||||||
}
|
}
|
||||||
Class bigclaz = TypeToken.primitiveToWrapper((Class) pt);
|
Class bigclaz = TypeToken.primitiveToWrapper((Class) pt);
|
||||||
mv.visitMethodInsn(INVOKESTATIC, bigclaz.getName().replace('.', '/'), "valueOf", "(" + Type.getDescriptor((Class) pt) + ")" + Type.getDescriptor(bigclaz), false);
|
mv.visitMethodInsn(INVOKESTATIC, bigclaz.getName().replace('.', '/'), "valueOf",
|
||||||
|
"(" + Type.getDescriptor((Class) pt) + ")" + Type.getDescriptor(bigclaz), false);
|
||||||
} else {
|
} else {
|
||||||
mv.visitVarInsn(ALOAD, insn);
|
mv.visitVarInsn(ALOAD, insn);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user