This commit is contained in:
@@ -138,17 +138,17 @@ public abstract class Sncp {
|
|||||||
* return "hello";
|
* return "hello";
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @MultiRun(selfrun = false)
|
* @RpcMultiRun(selfrun = false)
|
||||||
* public void createSomeThing(TestBean bean){
|
public void createSomeThing(TestBean bean){
|
||||||
* //do something
|
//do something
|
||||||
* }
|
}
|
||||||
*
|
|
||||||
* @MultiRun
|
@RpcMultiRun
|
||||||
* public String updateSomeThing(String id){
|
public String updateSomeThing(String id){
|
||||||
* return "hello" + id;
|
return "hello" + id;
|
||||||
* }
|
}
|
||||||
* }
|
}
|
||||||
* </pre></blockquote>
|
</pre></blockquote>
|
||||||
*
|
*
|
||||||
* <blockquote><pre>
|
* <blockquote><pre>
|
||||||
* @Resource(name = "")
|
* @Resource(name = "")
|
||||||
@@ -339,7 +339,7 @@ public abstract class Sncp {
|
|||||||
}
|
}
|
||||||
int i = - 1;
|
int i = - 1;
|
||||||
for (final Method method : methods) {
|
for (final Method method : methods) {
|
||||||
final MultiRun mrun = method.getAnnotation(MultiRun.class);
|
final RpcMultiRun mrun = method.getAnnotation(RpcMultiRun.class);
|
||||||
if (mrun == null) continue;
|
if (mrun == null) continue;
|
||||||
final Class returnType = method.getReturnType();
|
final Class returnType = method.getReturnType();
|
||||||
final String methodDesc = Type.getMethodDescriptor(method);
|
final String methodDesc = Type.getMethodDescriptor(method);
|
||||||
@@ -352,7 +352,7 @@ public abstract class Sncp {
|
|||||||
final Annotation[][] anns = method.getParameterAnnotations();
|
final Annotation[][] anns = method.getParameterAnnotations();
|
||||||
for (int k = 0; k < anns.length; k++) {
|
for (int k = 0; k < anns.length; k++) {
|
||||||
for (Annotation ann : anns[k]) {
|
for (Annotation ann : anns[k]) {
|
||||||
if (ann instanceof SncpDyn || ann instanceof MultiRun) continue; //必须过滤掉 MultiRun、SncpDyn,否则生成远程模式Service时会出错
|
if (ann instanceof SncpDyn || ann instanceof RpcMultiRun) continue; //必须过滤掉 RpcMultiRun、SncpDyn,否则生成远程模式Service时会出错
|
||||||
visitAnnotation(mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true), ann);
|
visitAnnotation(mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true), ann);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,7 +405,7 @@ public abstract class Sncp {
|
|||||||
final Annotation[][] anns = method.getParameterAnnotations();
|
final Annotation[][] anns = method.getParameterAnnotations();
|
||||||
for (int k = 0; k < anns.length; k++) {
|
for (int k = 0; k < anns.length; k++) {
|
||||||
for (Annotation ann : anns[k]) {
|
for (Annotation ann : anns[k]) {
|
||||||
if (ann instanceof SncpDyn || ann instanceof MultiRun) continue; //必须过滤掉 MultiRun、SncpDyn,否则生成远程模式Service时会出错
|
if (ann instanceof SncpDyn || ann instanceof RpcMultiRun) continue; //必须过滤掉 RpcMultiRun、SncpDyn,否则生成远程模式Service时会出错
|
||||||
visitAnnotation(mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true), ann);
|
visitAnnotation(mv.visitParameterAnnotation(k, Type.getDescriptor(ann.annotationType()), true), ann);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -811,7 +811,7 @@ public abstract class Sncp {
|
|||||||
}
|
}
|
||||||
sb.append(", diffaddrs = ").append(addrs);
|
sb.append(", diffaddrs = ").append(addrs);
|
||||||
} else {
|
} else {
|
||||||
sb.append(", ").append(MultiRun.class.getSimpleName().toLowerCase()).append(" = false");
|
sb.append(", ").append(RpcMultiRun.class.getSimpleName().toLowerCase()).append(" = false");
|
||||||
}
|
}
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
Field s = newClazz.getDeclaredField(FIELDPREFIX + "_selfstring");
|
Field s = newClazz.getDeclaredField(FIELDPREFIX + "_selfstring");
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修饰由SNCP协议动态生成的class、和method
|
* 修饰由SNCP协议动态生成的class、和method
|
||||||
* 本地模式:动态生成的_DynLocalXXXXService类其带有@MultiRun方法均会打上@SncpDyn(remote = false, index=N) 的注解
|
* 本地模式:动态生成的_DynLocalXXXXService类其带有@RpcMultiRun方法均会打上@SncpDyn(remote = false, index=N) 的注解
|
||||||
* 远程模式:动态生成的_DynRemoteXXXService类会打上@SncpDyn(remote = true) 的注解
|
* 远程模式:动态生成的_DynRemoteXXXService类会打上@SncpDyn(remote = true) 的注解
|
||||||
*
|
*
|
||||||
* <p> 详情见: http://redkale.org
|
* <p> 详情见: http://redkale.org
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public V getAndRefresh(K key, final int expireSeconds) {
|
public V getAndRefresh(K key, final int expireSeconds) {
|
||||||
if (key == null) return null;
|
if (key == null) return null;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -215,7 +215,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void refresh(K key, final int expireSeconds) {
|
public void refresh(K key, final int expireSeconds) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -225,7 +225,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void set(K key, V value) {
|
public void set(K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -240,7 +240,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void set(int expireSeconds, K key, V value) {
|
public void set(int expireSeconds, K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -255,7 +255,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void setExpireSeconds(K key, int expireSeconds) {
|
public void setExpireSeconds(K key, int expireSeconds) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -264,7 +264,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void remove(K key) {
|
public void remove(K key) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
container.remove(key);
|
container.remove(key);
|
||||||
@@ -281,7 +281,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void appendListItem(K key, V value) {
|
public void appendListItem(K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -297,7 +297,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void removeListItem(K key, V value) {
|
public void removeListItem(K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -306,7 +306,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void appendSetItem(K key, V value) {
|
public void appendSetItem(K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
@@ -322,7 +322,7 @@ public class CacheSourceService<K extends Serializable, V extends Object> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun
|
@RpcMultiRun
|
||||||
public void removeSetItem(K key, V value) {
|
public void removeSetItem(K key, V value) {
|
||||||
if (key == null) return;
|
if (key == null) return;
|
||||||
CacheEntry entry = container.get(key);
|
CacheEntry entry = container.get(key);
|
||||||
|
|||||||
@@ -25,19 +25,19 @@ public class DataCacheListenerService implements DataCacheListener, Service {
|
|||||||
private DataSource source;
|
private DataSource source;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun(selfrun = false, async = true)
|
@RpcMultiRun(selfrun = false, async = true)
|
||||||
public <T> void insertCache(Class<T> clazz, T... entitys) {
|
public <T> void insertCache(Class<T> clazz, T... entitys) {
|
||||||
((DataDefaultSource) source).insertCache(clazz, entitys);
|
((DataDefaultSource) source).insertCache(clazz, entitys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun(selfrun = false, async = true)
|
@RpcMultiRun(selfrun = false, async = true)
|
||||||
public <T> void updateCache(Class<T> clazz, T... entitys) {
|
public <T> void updateCache(Class<T> clazz, T... entitys) {
|
||||||
((DataDefaultSource) source).updateCache(clazz, entitys);
|
((DataDefaultSource) source).updateCache(clazz, entitys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MultiRun(selfrun = false, async = true)
|
@RpcMultiRun(selfrun = false, async = true)
|
||||||
public <T> void deleteCache(Class<T> clazz, Serializable... ids) {
|
public <T> void deleteCache(Class<T> clazz, Serializable... ids) {
|
||||||
((DataDefaultSource) source).deleteCache(clazz, ids);
|
((DataDefaultSource) source).deleteCache(clazz, ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import static java.lang.annotation.ElementType.*;
|
|||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MultiRun 只对本地模式Service有效
|
* RpcMultiRun 只对本地模式Service有效
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: http://redkale.org
|
* 详情见: http://redkale.org
|
||||||
@@ -21,7 +21,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
@Documented
|
@Documented
|
||||||
@Target({METHOD})
|
@Target({METHOD})
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface MultiRun {
|
public @interface RpcMultiRun {
|
||||||
|
|
||||||
boolean selfrun() default true; //当前本地实例是否运行指定操作;只有当指定操作的方法的返回值为void时,该值才能为true,否则忽略。
|
boolean selfrun() default true; //当前本地实例是否运行指定操作;只有当指定操作的方法的返回值为void时,该值才能为true,否则忽略。
|
||||||
|
|
||||||
Reference in New Issue
Block a user