Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
86a64ec8
Commit
86a64ec8
authored
Aug 03, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改RPC的超时时间
parent
b0e75229
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
RpcReferenceBean.java
...byit/rpc/remoting/invoker/reference/RpcReferenceBean.java
+11
-9
No files found.
byit-myth-rpc/src/main/java/com/byit/rpc/remoting/invoker/reference/RpcReferenceBean.java
View file @
86a64ec8
...
@@ -211,10 +211,12 @@ public class RpcReferenceBean {
...
@@ -211,10 +211,12 @@ public class RpcReferenceBean {
// future-response set
// future-response set
RpcFutureResponse
futureResponse
=
new
RpcFutureResponse
(
invokerFactory
,
rpcRequest
,
null
);
RpcFutureResponse
futureResponse
=
new
RpcFutureResponse
(
invokerFactory
,
rpcRequest
,
null
);
try
{
try
{
//TODO 改方法需要添加ip测试功能项
// do invoke
// do invoke
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
// future get
// future get
logger
.
debug
(
">>>>>>>>>>>>数据:{},请求:{},的超时时间为:{}"
,
rpcRequest
,
rpcRequest
.
getRequestId
(),
timeout
);
RpcResponse
rpcResponse
=
futureResponse
.
get
(
timeout
,
TimeUnit
.
MILLISECONDS
);
RpcResponse
rpcResponse
=
futureResponse
.
get
(
timeout
,
TimeUnit
.
MILLISECONDS
);
if
(
rpcResponse
.
getErrorMsg
()
!=
null
)
{
if
(
rpcResponse
.
getErrorMsg
()
!=
null
)
{
throw
new
RpcException
(
rpcResponse
.
getErrorMsg
());
throw
new
RpcException
(
rpcResponse
.
getErrorMsg
());
...
@@ -231,23 +233,23 @@ public class RpcReferenceBean {
...
@@ -231,23 +233,23 @@ public class RpcReferenceBean {
}
else
if
(
CallType
.
FUTURE
==
callType
)
{
}
else
if
(
CallType
.
FUTURE
==
callType
)
{
// future-response set
// future-response set
RpcFutureResponse
futureResponse
=
new
RpcFutureResponse
(
invokerFactory
,
rpcRequest
,
null
);
RpcFutureResponse
futureResponse
=
new
RpcFutureResponse
(
invokerFactory
,
rpcRequest
,
null
);
try
{
try
{
// invoke future set
// invoke future set
RpcInvokeFuture
invokeFuture
=
new
RpcInvokeFuture
(
futureResponse
);
RpcInvokeFuture
invokeFuture
=
new
RpcInvokeFuture
(
futureResponse
);
RpcInvokeFuture
.
setFuture
(
invokeFuture
);
RpcInvokeFuture
.
setFuture
(
invokeFuture
);
// do invoke
// do invoke
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
return
null
;
return
null
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
info
(
">>>>>>>>>>> myth-rpc, invoke error, address:{}, RpcRequest{}"
,
finalAddress
,
rpcRequest
);
logger
.
info
(
">>>>>>>>>>> myth-rpc, invoke error, address:{}, RpcRequest{}"
,
finalAddress
,
rpcRequest
);
// future-response remove
// future-response remove
futureResponse
.
removeInvokerFuture
();
futureResponse
.
removeInvokerFuture
();
throw
(
e
instanceof
RpcException
)?
e:
new
RpcException
(
e
);
throw
(
e
instanceof
RpcException
)?
e:
new
RpcException
(
e
);
}
}
}
else
if
(
CallType
.
CALLBACK
==
callType
)
{
}
else
if
(
CallType
.
CALLBACK
==
callType
)
{
...
@@ -276,9 +278,9 @@ return null;
...
@@ -276,9 +278,9 @@ return null;
return
null
;
return
null
;
}
else
if
(
CallType
.
ONEWAY
==
callType
)
{
}
else
if
(
CallType
.
ONEWAY
==
callType
)
{
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
client
.
asyncSend
(
finalAddress
,
rpcRequest
);
return
null
;
return
null
;
}
else
{
}
else
{
throw
new
RpcException
(
"myth-rpc callType["
+
callType
+
"] invalid"
);
throw
new
RpcException
(
"myth-rpc callType["
+
callType
+
"] invalid"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment