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
fa323143
Commit
fa323143
authored
Apr 01, 2020
by
guo_minglei@163.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
4d4ebfde
dd74a46b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
17 deletions
+22
-17
AdminRegisterConfig.java
...in/src/main/java/com/byit/config/AdminRegisterConfig.java
+8
-0
RpcSpringInvokerFactory.java
...it/rpc/remoting/invoker/impl/RpcSpringInvokerFactory.java
+1
-1
RpcReferenceBean.java
...byit/rpc/remoting/invoker/reference/RpcReferenceBean.java
+10
-13
ConnectClient.java
.../java/com/byit/rpc/remoting/net/common/ConnectClient.java
+1
-1
AddComplexPy.java
...-demo-client/src/main/java/com/byit/job/AddComplexPy.java
+1
-1
AddComplexPy1.java
...demo-client/src/main/java/com/byit/job/AddComplexPy1.java
+1
-1
No files found.
byit-myth-admin/src/main/java/com/byit/config/AdminRegisterConfig.java
View file @
fa323143
...
@@ -25,6 +25,10 @@ public class AdminRegisterConfig {
...
@@ -25,6 +25,10 @@ public class AdminRegisterConfig {
// @Value("${myth-rpc.registry.port}")
// @Value("${myth-rpc.registry.port}")
// private int port;
// private int port;
/**
* 初始化 rpc客户端 属于消费者
* @return
*/
@Bean
@Bean
public
RpcSpringInvokerFactory
invokerFactory
(){
public
RpcSpringInvokerFactory
invokerFactory
(){
RpcSpringInvokerFactory
invokerFactory
=
new
RpcSpringInvokerFactory
();
RpcSpringInvokerFactory
invokerFactory
=
new
RpcSpringInvokerFactory
();
...
@@ -39,6 +43,10 @@ public class AdminRegisterConfig {
...
@@ -39,6 +43,10 @@ public class AdminRegisterConfig {
return
invokerFactory
;
return
invokerFactory
;
}
}
/**
* 设置对外提供服务的接口 这个其实是配合网关调用的方式 属于生产者
* @return
*/
@Bean
@Bean
public
RpcSpringProviderFactory
rpcSpringProviderFactory
()
{
public
RpcSpringProviderFactory
rpcSpringProviderFactory
()
{
RpcSpringProviderFactory
providerFactory
=
new
RpcSpringProviderFactory
();
RpcSpringProviderFactory
providerFactory
=
new
RpcSpringProviderFactory
();
...
...
byit-myth-rpc/src/main/java/com/byit/rpc/remoting/invoker/impl/RpcSpringInvokerFactory.java
View file @
fa323143
...
@@ -87,7 +87,7 @@ public class RpcSpringInvokerFactory extends InstantiationAwareBeanPostProcessor
...
@@ -87,7 +87,7 @@ public class RpcSpringInvokerFactory extends InstantiationAwareBeanPostProcessor
null
,
null
,
rpcInvokerFactory
rpcInvokerFactory
);
);
//获取一个代理对象
Object
serviceProxy
=
referenceBean
.
getObject
();
Object
serviceProxy
=
referenceBean
.
getObject
();
// set bean
// set bean
...
...
byit-myth-rpc/src/main/java/com/byit/rpc/remoting/invoker/reference/RpcReferenceBean.java
View file @
fa323143
...
@@ -136,9 +136,7 @@ public class RpcReferenceBean {
...
@@ -136,9 +136,7 @@ public class RpcReferenceBean {
public
Object
getObject
()
{
public
Object
getObject
()
{
return
Proxy
.
newProxyInstance
(
Thread
.
currentThread
()
return
Proxy
.
newProxyInstance
(
Thread
.
currentThread
()
.
getContextClassLoader
(),
new
Class
[]
{
iface
},
.
getContextClassLoader
(),
new
Class
[]
{
iface
},
new
InvocationHandler
()
{
(
proxy
,
method
,
args
)
->
{
@Override
public
Object
invoke
(
Object
proxy
,
Method
method
,
Object
[]
args
)
throws
Throwable
{
// method param
// method param
String
className
=
method
.
getDeclaringClass
().
getName
();
// iface.getName()
String
className
=
method
.
getDeclaringClass
().
getName
();
// iface.getName()
...
@@ -232,23 +230,23 @@ public class RpcReferenceBean {
...
@@ -232,23 +230,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
)
{
...
@@ -277,13 +275,12 @@ public class RpcReferenceBean {
...
@@ -277,13 +275,12 @@ public class RpcReferenceBean {
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"
);
}
}
}
});
});
}
}
...
...
byit-myth-rpc/src/main/java/com/byit/rpc/remoting/net/common/ConnectClient.java
View file @
fa323143
...
@@ -82,7 +82,7 @@ public abstract class ConnectClient {
...
@@ -82,7 +82,7 @@ public abstract class ConnectClient {
if
(
connectClient
!=
null
&&
connectClient
.
isValidate
())
{
if
(
connectClient
!=
null
&&
connectClient
.
isValidate
())
{
return
connectClient
;
return
connectClient
;
}
}
//获取对应地址的锁对象
// lock
// lock
Object
clientLock
=
connectClientLockMap
.
get
(
address
);
Object
clientLock
=
connectClientLockMap
.
get
(
address
);
if
(
clientLock
==
null
)
{
if
(
clientLock
==
null
)
{
...
...
demo-client/byit-demo-client/src/main/java/com/byit/job/AddComplexPy.java
View file @
fa323143
...
@@ -19,7 +19,7 @@ public class AddComplexPy {
...
@@ -19,7 +19,7 @@ public class AddComplexPy {
runNode
.
setNodeId
(
"2"
);
runNode
.
setNodeId
(
"2"
);
runNode
.
setNodeName
(
"lijkki"
);
runNode
.
setNodeName
(
"lijkki"
);
runNode
.
setRunCmd
(
"python ${biz_file}"
);
runNode
.
setRunCmd
(
"python ${biz_file}"
);
JobUtils
.
setRequestUrl
(
"http://1
27.0.0.1:8081/myth-job-admin
"
);
JobUtils
.
setRequestUrl
(
"http://1
0.0.120.208:8081/myth-job-admin/
"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
realExectNode
(
runNode
);
JobUtils
.
realExectNode
(
runNode
);
/* PluginPackage pluginPackage = new PluginPackage();
/* PluginPackage pluginPackage = new PluginPackage();
...
...
demo-client/byit-demo-client/src/main/java/com/byit/job/AddComplexPy1.java
View file @
fa323143
...
@@ -16,7 +16,7 @@ public class AddComplexPy1 {
...
@@ -16,7 +16,7 @@ public class AddComplexPy1 {
PluginPackage
pluginPackage
=
new
PluginPackage
();
PluginPackage
pluginPackage
=
new
PluginPackage
();
pluginPackage
.
setWorkspaceName
(
"test"
);
pluginPackage
.
setWorkspaceName
(
"test"
);
pluginPackage
.
setFlow
(
createFlow
());
pluginPackage
.
setFlow
(
createFlow
());
JobUtils
.
setRequestUrl
(
"http://1
27.0.0.1
:8081/myth-job-admin"
);
JobUtils
.
setRequestUrl
(
"http://1
0.0.120.208
:8081/myth-job-admin"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
setTOKEN
(
"test"
);
JobUtils
.
publish
(
pluginPackage
);
JobUtils
.
publish
(
pluginPackage
);
}
}
...
...
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