Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Cubic
Commits
aaaf0177
Commit
aaaf0177
authored
4 years ago
by
haozi
Browse files
Options
Download
Email Patches
Plain Diff
纠正命名、加线程池命令下发
parent
566d19fb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
cubic-proxy-common/src/main/java/com/cubic/proxy/common/handler/MessageHandler.java
+5
-5
...n/java/com/cubic/proxy/common/handler/MessageHandler.java
cubic-proxy/src/main/java/com/matrix/proxy/config/ServerConfig.java
+2
-2
...y/src/main/java/com/matrix/proxy/config/ServerConfig.java
cubic-proxy/src/main/java/com/matrix/proxy/controller/JvmController.java
+30
-2
.../main/java/com/matrix/proxy/controller/JvmController.java
cubic-proxy/src/main/java/com/matrix/proxy/mapper/ThreadPoolMapper.java
+2
-2
...c/main/java/com/matrix/proxy/mapper/ThreadPoolMapper.java
cubic-proxy/src/main/java/com/matrix/proxy/service/JvmDataService.java
+2
-2
...rc/main/java/com/matrix/proxy/service/JvmDataService.java
cubic-proxy/src/main/java/com/matrix/proxy/service/JvmDataServiceImpl.java
+2
-2
...ain/java/com/matrix/proxy/service/JvmDataServiceImpl.java
cubic-proxy/src/main/java/com/matrix/proxy/vo/ThreadPoolCommandVo.java
+18
-0
...rc/main/java/com/matrix/proxy/vo/ThreadPoolCommandVo.java
cubic-proxy/src/main/java/com/matrix/proxy/vo/ThreadPoolQueryVo.java
+1
-1
.../src/main/java/com/matrix/proxy/vo/ThreadPoolQueryVo.java
with
62 additions
and
16 deletions
+62
-16
cubic-proxy-common/src/main/java/com/cubic/proxy/common/handler/MessageHandler.java
+
5
-
5
View file @
aaaf0177
...
...
@@ -26,11 +26,11 @@ public class MessageHandler extends SimpleChannelInboundHandler<String> {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MessageHandler
.
class
);
private
final
Map
<
Integer
,
ServerMess
g
aeProcess
>
processorMap
;
private
final
Map
<
Integer
,
ServerMessa
g
eProcess
>
processorMap
;
public
MessageHandler
(
List
<
ServerMess
g
aeProcess
>
processors
)
{
ImmutableMap
.
Builder
<
Integer
,
ServerMess
g
aeProcess
>
builder
=
new
ImmutableMap
.
Builder
<>();
for
(
ServerMess
g
aeProcess
processor
:
processors
)
{
public
MessageHandler
(
List
<
ServerMessa
g
eProcess
>
processors
)
{
ImmutableMap
.
Builder
<
Integer
,
ServerMessa
g
eProcess
>
builder
=
new
ImmutableMap
.
Builder
<>();
for
(
ServerMessa
g
eProcess
processor
:
processors
)
{
builder
.
put
(
processor
.
code
(),
processor
);
}
processorMap
=
builder
.
build
();
...
...
@@ -44,7 +44,7 @@ public class MessageHandler extends SimpleChannelInboundHandler<String> {
if
(
code
!=
CommandCode
.
HEARTBEAT
.
getCode
())
{
logger
.
debug
(
"接收到 id:{}, code:{} 数据请求 ctx:{},message size:{}"
,
instanceUuid
,
code
,
ctx
.
channel
(),
message
.
length
());
}
ServerMess
g
aeProcess
messageProcessor
=
processorMap
.
get
(
code
);
ServerMessa
g
eProcess
messageProcessor
=
processorMap
.
get
(
code
);
if
(
messageProcessor
==
null
)
{
logger
.
warn
(
"can not process message code [{}], {}"
,
code
,
ctx
.
channel
());
return
;
...
...
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/config/ServerConfig.java
+
2
-
2
View file @
aaaf0177
...
...
@@ -9,7 +9,7 @@ import com.cubic.proxy.websocket.WebRequestHandler;
import
com.cubic.proxy.websocket.process.SearchWebProcess
;
import
com.matrix.proxy.server.MatrixNettyServer
;
import
com.cubic.proxy.common.handler.MessageHandler
;
import
com.cubic.proxy.common.handler.ServerMess
g
aeProcess
;
import
com.cubic.proxy.common.handler.ServerMessa
g
eProcess
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -31,7 +31,7 @@ public class ServerConfig {
private
List
<
WebProcess
>
webProcesses
;
@Bean
(
initMethod
=
"start"
)
public
MatrixNettyServer
nettyServerForAgent
(
ServerProperties
serverProperties
,
List
<
ServerMess
g
aeProcess
>
processors
)
{
public
MatrixNettyServer
nettyServerForAgent
(
ServerProperties
serverProperties
,
List
<
ServerMessa
g
eProcess
>
processors
)
{
MessageHandler
messageHandler
=
new
MessageHandler
(
processors
);
return
new
MatrixNettyServer
(
serverProperties
.
getAgentPort
(),
messageHandler
);
}
...
...
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/controller/JvmController.java
+
30
-
2
View file @
aaaf0177
package
com.matrix.proxy.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cubic.proxy.common.constant.CommandCode
;
import
com.matrix.proxy.service.JdkCommandService
;
import
com.matrix.proxy.service.JvmDataService
;
import
com.matrix.proxy.vo.ThreadPoolQuery
;
import
com.matrix.proxy.vo.ThreadPoolCommandVo
;
import
com.matrix.proxy.vo.ThreadPoolQueryVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -20,9 +24,33 @@ import org.springframework.web.bind.annotation.RestController;
public
class
JvmController
{
@Autowired
private
JvmDataService
jvmDataService
;
@Autowired
private
JdkCommandService
jdkCommandService
;
/**
* 线程池列表
*
* @param query
* @return
*/
@RequestMapping
(
"/threadpool/page"
)
public
Object
threadPoolPage
(
@RequestBody
ThreadPoolQuery
query
)
{
public
Object
threadPoolPage
(
@RequestBody
ThreadPoolQuery
Vo
query
)
{
return
jvmDataService
.
threadPoolDataPage
(
query
);
}
/**
* 线程池命令下发
*
* @param commandVo
* @return
*/
@RequestMapping
(
"/threadpool/command"
)
public
Object
threadPoolCMD
(
@RequestBody
ThreadPoolCommandVo
commandVo
)
{
JSONObject
command
=
new
JSONObject
();
command
.
put
(
"key"
,
commandVo
.
getKey
());
command
.
put
(
"name"
,
commandVo
.
getName
());
command
.
put
(
"arg"
,
commandVo
.
getArg
());
return
jdkCommandService
.
exeCommand
(
commandVo
.
getInstanceUuid
(),
CommandCode
.
JVM_THREAD_POOL
.
getCode
(),
command
.
toJSONString
());
}
}
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/mapper/ThreadPoolMapper.java
+
2
-
2
View file @
aaaf0177
...
...
@@ -2,7 +2,7 @@ package com.matrix.proxy.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.matrix.proxy.entity.ThreadPoolEntity
;
import
com.matrix.proxy.vo.ThreadPoolQuery
;
import
com.matrix.proxy.vo.ThreadPoolQuery
Vo
;
import
java.util.List
;
...
...
@@ -19,5 +19,5 @@ public interface ThreadPoolMapper extends BaseMapper<ThreadPoolEntity> {
* @param query
* @return
*/
List
<
ThreadPoolEntity
>
selectByQuery
(
ThreadPoolQuery
query
);
List
<
ThreadPoolEntity
>
selectByQuery
(
ThreadPoolQuery
Vo
query
);
}
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/service/JvmDataService.java
+
2
-
2
View file @
aaaf0177
...
...
@@ -2,7 +2,7 @@ package com.matrix.proxy.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.matrix.proxy.entity.ThreadPoolEntity
;
import
com.matrix.proxy.vo.ThreadPoolQuery
;
import
com.matrix.proxy.vo.ThreadPoolQuery
Vo
;
/**
* JVM数据采集服务
...
...
@@ -17,5 +17,5 @@ public interface JvmDataService {
* @param query
* @return
*/
IPage
<
ThreadPoolEntity
>
threadPoolDataPage
(
ThreadPoolQuery
query
);
IPage
<
ThreadPoolEntity
>
threadPoolDataPage
(
ThreadPoolQuery
Vo
query
);
}
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/service/JvmDataServiceImpl.java
+
2
-
2
View file @
aaaf0177
...
...
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.matrix.proxy.entity.ThreadPoolEntity
;
import
com.matrix.proxy.mapper.ThreadPoolMapper
;
import
com.matrix.proxy.vo.ThreadPoolQuery
;
import
com.matrix.proxy.vo.ThreadPoolQuery
Vo
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -28,7 +28,7 @@ public class JvmDataServiceImpl implements JvmDataService {
* @return
*/
@Override
public
IPage
<
ThreadPoolEntity
>
threadPoolDataPage
(
ThreadPoolQuery
query
)
{
public
IPage
<
ThreadPoolEntity
>
threadPoolDataPage
(
ThreadPoolQuery
Vo
query
)
{
Page
<
ThreadPoolEntity
>
page
=
new
Page
<>(
query
.
getPageNo
(),
query
.
getPageSize
());
IPage
<
ThreadPoolEntity
>
iPages
=
threadPoolMapper
.
selectPage
(
page
,
new
QueryWrapper
<>());
...
...
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/vo/ThreadPoolCommandVo.java
0 → 100644
+
18
-
0
View file @
aaaf0177
package
com.matrix.proxy.vo
;
import
lombok.Data
;
/**
* 线程池下发命名
*
* @author zhanghao
* @date 2021/4/75:56 下午
*/
@Data
public
class
ThreadPoolCommandVo
{
private
String
instanceUuid
;
private
String
key
;
private
String
name
;
private
Object
arg
;
}
This diff is collapsed.
Click to expand it.
cubic-proxy/src/main/java/com/matrix/proxy/vo/ThreadPoolQuery.java
→
cubic-proxy/src/main/java/com/matrix/proxy/vo/ThreadPoolQuery
Vo
.java
+
1
-
1
View file @
aaaf0177
...
...
@@ -11,7 +11,7 @@ import java.util.Date;
* @date 2021/4/75:56 下午
*/
@Data
public
class
ThreadPoolQuery
{
public
class
ThreadPoolQuery
Vo
{
int
pageNo
=
1
;
int
pageSize
=
20
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help