This commit is contained in:
@@ -70,7 +70,14 @@ public class SncpTest {
|
|||||||
// }
|
// }
|
||||||
// bean.setContent(sb.toString());
|
// bean.setContent(sb.toString());
|
||||||
// bean.setContent("hello sncp");
|
// bean.setContent("hello sncp");
|
||||||
final int count = 500;
|
SncpTestBean callbean = new SncpTestBean();
|
||||||
|
callbean.setId(1);
|
||||||
|
callbean.setContent("数据X");
|
||||||
|
|
||||||
|
service.updateBean(callbean);
|
||||||
|
System.out.println("bean.id应该会被修改: " + callbean);
|
||||||
|
System.out.println("---------------------------------------------------");
|
||||||
|
final int count = 10;
|
||||||
final CountDownLatch cld = new CountDownLatch(count);
|
final CountDownLatch cld = new CountDownLatch(count);
|
||||||
final AtomicInteger ai = new AtomicInteger();
|
final AtomicInteger ai = new AtomicInteger();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
@@ -90,8 +97,8 @@ public class SncpTest {
|
|||||||
}
|
}
|
||||||
bean.setContent(sb.toString());
|
bean.setContent(sb.toString());
|
||||||
|
|
||||||
//service.queryResult(bean);
|
service.queryResult(bean);
|
||||||
service.updateBean(bean);
|
//service.updateBean(bean);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.wentch.redkale.test.sncp;
|
package com.wentch.redkale.test.sncp;
|
||||||
|
|
||||||
|
import com.wentch.redkale.net.sncp.*;
|
||||||
import com.wentch.redkale.service.*;
|
import com.wentch.redkale.service.*;
|
||||||
|
import com.wentch.redkale.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -13,13 +15,43 @@ import com.wentch.redkale.service.*;
|
|||||||
*/
|
*/
|
||||||
public class SncpTestService implements Service {
|
public class SncpTestService implements Service {
|
||||||
|
|
||||||
|
public static class CallAttribute implements Attribute<SncpTestBean, Long> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Long> type() {
|
||||||
|
return long.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<SncpTestBean> declaringClass() {
|
||||||
|
return SncpTestBean.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String field() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long get(SncpTestBean obj) {
|
||||||
|
return obj.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(SncpTestBean obj, Long value) {
|
||||||
|
obj.setId(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String queryResult(SncpTestBean bean) {
|
public String queryResult(SncpTestBean bean) {
|
||||||
System.out.println(Thread.currentThread().getName() + " 运行了queryResult方法");
|
System.out.println(Thread.currentThread().getName() + " 运行了queryResult方法");
|
||||||
return "result: " + bean;
|
return "result: " + bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@MultiRun
|
@MultiRun
|
||||||
public String updateBean(SncpTestBean bean) {
|
public String updateBean(@SncpCall(CallAttribute.class) SncpTestBean bean) {
|
||||||
|
bean.setId(System.currentTimeMillis());
|
||||||
System.out.println(Thread.currentThread().getName() + " 运行了updateBean方法");
|
System.out.println(Thread.currentThread().getName() + " 运行了updateBean方法");
|
||||||
return "result: " + bean;
|
return "result: " + bean;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user