Open qianzhiheilv opened 7 years ago
您好,请问下你是怎么测试的?我用github上面最新的版本,运行成功,没有出现卡死。 能不能给出代码和测试用例?附上我的测试步骤: 1、加载maven依赖:
2、测试服务代码: import com.newlandframework.rpc.services.PersonManage; import com.newlandframework.rpc.services.pojo.Person; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
@Service public class PersonManageImpl implements PersonManage { @Transactional public int save(Person p) { //your business logic code here! System.out.println("Transactional person data[" + p + "] has save!!!"); return 0; }
public void query(Person p) {
//your business logic code here!
System.out.println("person data[" + p + "] has query!");
}
}
3、RPC服务端运行结果:
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!--驱动类-->
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<!--数据库地址,指向库 -->
<property name="url" value="jdbc:mysql://127.0.0.1:3306/134"/>
<!--用户名 -->
<property name="username" value="1111"/>
<!--密码 -->
<property name="password" value="1111"/>
</bean>
<!-- 定义JdbcTemplate的Bean -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg name="dataSource" ref="dataSource"/>
</bean>
<bean id="sqlTxManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:annotation-driven transaction-manager="sqlTxManager"/>
我就加了这个配置,然后其余和你一样,加了tx,jdbc包,加了注解事务的xml,然后测试的
这个应该和NettyRPC没有太大关系。我手头没有mysql运行环境,所以测试样例以oracle来替代,参考你提供的配置。可以看这里:JDBC服务参考代码链接。oracle测试是没有问题的,你更新一下最新NettyRPC版本试一下。
当想整个远程服务使用spring原生事务的时候
就会出现server假死的问题,在下面这个方法假死住