Skip to content

Commit

Permalink
Update RPCFuture and test service
Browse files Browse the repository at this point in the history
  • Loading branch information
luxiaoxun committed Jul 27, 2020
1 parent 4df3b20 commit 5c6e637
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public boolean isDone() {

@Override
public Object get() {
sync.acquire(-1);
sync.acquire(1);
if (this.response != null) {
return this.response.getResult();
} else {
Expand All @@ -53,7 +53,7 @@ public Object get() {

@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException {
boolean success = sync.tryAcquireNanos(-1, unit.toNanos(timeout));
boolean success = sync.tryAcquireNanos(1, unit.toNanos(timeout));
if (success) {
if (this.response != null) {
return this.response.getResult();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.app.test.server;

import com.app.test.service.HelloServiceImpl;
import com.app.test.service.PersonService;
import com.app.test.service.PersonServiceImpl;
import com.netty.rpc.server.ServiceRegistry;
import com.netty.rpc.server.RpcServer;
import com.app.test.service.HelloService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.app.test.server;
package com.app.test.service;

import com.netty.rpc.server.RpcService;
import com.app.test.service.HelloService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.app.test.server;
package com.app.test.service;

import com.netty.rpc.server.RpcService;
import com.app.test.service.Person;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.netty.rpc.protocol.RpcRequest;
import com.netty.rpc.protocol.RpcResponse;
import com.app.test.service.Person;
import com.app.test.server.HelloServiceImpl;
import com.app.test.service.HelloServiceImpl;
import com.netty.rpc.util.JsonUtil;
import com.netty.rpc.util.SerializationUtil;

Expand Down
3 changes: 2 additions & 1 deletion netty-rpc-test/src/main/resources/server-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">

<context:component-scan base-package="com.app.test.server"/>
<!--scan service package-->
<context:component-scan base-package="com.app.test.service"/>

<context:property-placeholder location="classpath:rpc.properties"/>

Expand Down

0 comments on commit 5c6e637

Please sign in to comment.