Merge remote-tracking branch 'origin/develop' into develop

pull/1529/head
LqxHxy 6 months ago
commit 6c56773fd9

@ -5,7 +5,7 @@ title: 采用公司
## 谁在使用 Hippo4j
共计 45+ 家公司生产接入 Hippo4j按照公司登记时间排序。
共计 46+ 家公司生产接入 Hippo4j按照公司登记时间排序。
- [身边云](https://serviceshare.com)
- [思派健康科技](https://www.medbanks.cn)
@ -52,6 +52,7 @@ title: 采用公司
- [智慧芽信息科技(苏州)有限公司](https://www.zhihuiya.com)
- [滴滴出行](https://www.didiglobal.com)
- [杭州源诚科技有限公司](http://www.yckjdata.com)
- [汉克时代](https://www.hunktimes.com/)
## 登记

@ -24,7 +24,6 @@ import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.core.config.ApplicationContextHolder;
import cn.hippo4j.threadpool.dynamic.mode.config.properties.BootstrapConfigProperties;
import cn.hippo4j.threadpool.dynamic.mode.config.properties.MonitorProperties;
import cn.hippo4j.threadpool.monitor.api.DynamicThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.api.ThreadPoolMonitor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -53,6 +52,10 @@ public class ThreadPoolMonitorExecutor implements ApplicationRunner, DisposableB
private List<ThreadPoolMonitor> threadPoolMonitors;
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@Override
public void run(ApplicationArguments args) throws Exception {
MonitorProperties monitor = properties.getMonitor();
@ -70,8 +73,8 @@ public class ThreadPoolMonitorExecutor implements ApplicationRunner, DisposableB
// Get dynamic thread pool monitoring component.
List<String> collectTypes = Arrays.asList(monitor.getCollectTypes().split(","));
ApplicationContextHolder.getBeansOfType(ThreadPoolMonitor.class).forEach((beanName, bean) -> threadPoolMonitors.add(bean));
Collection<DynamicThreadPoolMonitor> dynamicThreadPoolMonitors =
ServiceLoaderRegistry.getSingletonServiceInstances(DynamicThreadPoolMonitor.class);
Collection<ThreadPoolMonitor> dynamicThreadPoolMonitors =
ServiceLoaderRegistry.getSingletonServiceInstances(ThreadPoolMonitor.class);
dynamicThreadPoolMonitors.stream().filter(each -> collectTypes.contains(each.getType())).forEach(each -> threadPoolMonitors.add(each));
// Execute dynamic thread pool monitoring component.
collectScheduledExecutor.scheduleWithFixedDelay(

@ -166,7 +166,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
private void checkNotifyConsistencyAndReplace(ExecutorProperties executorProperties) {
boolean checkNotifyConfig = false;
boolean checkNotifyAlarm = false;
List<String> changeKeys = new ArrayList<>();
Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap =
configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties);
Map<String, List<NotifyConfigDTO>> notifyConfigs = threadPoolBaseSendMessageService.getNotifyConfigs();
@ -179,7 +178,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
for (NotifyConfigDTO notifyConfig : each.getValue()) {
if (!notifyConfigDTOS.contains(notifyConfig)) {
checkNotifyConfig = true;
changeKeys.add(each.getKey());
break;
}
}
@ -194,10 +192,9 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
Boolean isAlarm = executorProperties.getAlarm();
Integer activeAlarm = executorProperties.getActiveAlarm();
Integer capacityAlarm = executorProperties.getCapacityAlarm();
// FIXME Compare using Objects.equals
if ((isAlarm != null && isAlarm != threadPoolNotifyAlarm.getAlarm())
|| (activeAlarm != null && activeAlarm != threadPoolNotifyAlarm.getActiveAlarm())
|| (capacityAlarm != null && capacityAlarm != threadPoolNotifyAlarm.getCapacityAlarm())) {
if ((isAlarm != null && !Objects.equals(isAlarm, threadPoolNotifyAlarm.getAlarm()))
|| (activeAlarm != null && !Objects.equals(activeAlarm, threadPoolNotifyAlarm.getActiveAlarm()))
|| (capacityAlarm != null && !Objects.equals(capacityAlarm, threadPoolNotifyAlarm.getCapacityAlarm()))) {
checkNotifyAlarm = true;
threadPoolNotifyAlarm.setAlarm(Optional.ofNullable(isAlarm).orElse(threadPoolNotifyAlarm.getAlarm()));
threadPoolNotifyAlarm.setActiveAlarm(Optional.ofNullable(activeAlarm).orElse(threadPoolNotifyAlarm.getActiveAlarm()));

@ -87,6 +87,10 @@ public class ReportingEventExecutor implements Runnable, CommandLineRunner, Disp
*/
private ScheduledThreadPoolExecutor collectVesselExecutor;
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@SneakyThrows
@Override
public void run() {

@ -1,12 +1,12 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container"
@toggleClick="toggleSideBar"/>
@toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
<div class="right-menu">
<template v-if="device!=='mobile'">
<template v-if="device !== 'mobile'">
<!-- <search id="header-search" class="right-menu-item" />-->
<!-- <error-log class="errLog-container right-menu-item hover-effect"/> -->
@ -16,26 +16,19 @@
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">-->
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
</template>
<el-select class="select-tenant" v-model="tenant.index" filterable @change="changeTenant">
<el-option
v-for="(item, index) in tenantList"
:key="index"
:label="item.resource"
:value="item.index">
<el-select v-model="currentTenant" class="select-tenant" @change="changeTenant">
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.resource" :value="item.tenantId">
</el-option>
</el-select>
<langChange />
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img src="../../../public/hippo4j.gif" class="user-avatar">
<i class="el-icon-caret-bottom"/>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<!--<router-link to="/profile/index">
<el-dropdown-item>Profile</el-dropdown-item>
</router-link>-->
<router-link to="/">
<el-dropdown-item>{{ this.$t('menu.dashboard') }}</el-dropdown-item>
</router-link>
@ -49,211 +42,185 @@
</template>
<script>
import * as jobProjectApi from '@/api/hippo4j-tenant';
import * as user from '@/api/hippo4j-user';
import { mapGetters, mapState } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import ErrorLog from '@/components/ErrorLog'
import langChange from '@/locale/langChange'
import { i18nConfig } from '@/locale/config'
export default {
data() {
return {
tenant: {
action: '',
resource: '',
username: ''
},
}
},
components: {
Breadcrumb,
Hamburger,
ErrorLog,
langChange
import * as user from '@/api/hippo4j-user';
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import langChange from '@/locale/langChange'
export default {
components: {
Breadcrumb,
Hamburger,
langChange
},
data() {
return {
tenant: {
action: '',
resource: '',
username: ''
},
currentTenant: undefined
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device',
'tenantList',
'tenantInfo'
])
},
mounted() {
this.getTenantList()
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device',
'tenantList',
'tenantInfo'
])
async logout() {
this.$cookie.delete('userName')
this.$cookie.delete('tenantInfo')
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
},
watch: {
tenantInfo(newVal) {
this.tenant.tenantId = newVal.tenantId
this.tenant.resource = newVal.resource
console.log("ischangLang", newVal, this.tenantList)
}
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
this.$cookie.delete('userName')
this.$cookie.delete('tenantInfo')
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
},
async getTenantList() {
const userName = this.$cookie.get('userName')
await user
async getTenantList() {
const userName = this.$cookie.get('userName')
await user
.getCurrentUser(userName)
.then((response) => {
const { resources } = response;
console.log("isTenList1", resources, this.tenantList)
let resourcesRes = resources.map((item) => {
let query = {
...item,
tenantId: item.resource,
}
return query
})
if (response.role == 'ROLE_ADMIN') {
resources.unshift({
resourcesRes = [{
action: "rw",
resource: this.$t('common.allTenant'),
username: userName,
tenantId: this.$t('common.allTenant'),
index: 0,
})
}, ...resourcesRes]
}
console.log("isTenList1111111", this.$t('common.allTenant'), resources, this.tenantList)
const resourcesRes = resources.map((item, index) => {
let query = {
...item,
tenantId: item.resource,
index: index,
}
console.log("=============", index, query, item)
return query
})
console.log("isTenList22222", resourcesRes, this.tenantList)
this.$store.dispatch('tenant/setTenantList', resourcesRes)
this.tenant = JSON.parse(this.$cookie.get('tenantInfo')) || resourcesRes[0]
this.$store.dispatch('tenant/setTenantInfo', this.tenant || resourcesRes[0])
this.$store.dispatch('tenant/setTenantInfo', resourcesRes[0])
this.$cookie.set('tenantInfo', JSON.stringify(this.tenant));
console.log("isTenList2", this.tenantList)
this.currentTenant = resourcesRes[0]?.tenantId
// console.log('resourceRes:::', this.tenantInfo, this.tenantList)
})
.catch(() => {});
},
async changeTenant(index) {
console.log("isTenList", this.tenantList)
let tenant = {
tenantId: this.tenantList[index].resource,
resource: this.tenantList[index].resource,
index: this.tenantList[index].index,
current: 1,
desc: true,
size: 10,
}
this.$store.dispatch('tenant/setTenantInfo', tenant)
this.$cookie.set('tenantInfo', JSON.stringify(tenant));
let isAllTenant = tenant.tenantId == i18nConfig.messages.zh.common.allTenant || tenant.tenantId == i18nConfig.messages.en.common.allTenant
tenant.tenantId = isAllTenant ? '' : tenant.tenantId
await jobProjectApi.list(tenant).then((response) => {
console.log("isRes", response)
// this.$store.dispatch('tenant/setTenantList', resources)
});
}
},
async mounted() {
this.getTenantList()
.catch(() => { });
},
}
changeTenant(id) {
const tenant = this.tenantList.find(item => item.tenantId === id)
this.currentTenant = id
this.$store.dispatch('tenant/setTenantInfo', tenant)
}
},
}
</script>
<style lang="scss" scoped>
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
.breadcrumb-container {
float: left;
}
&:hover {
background: rgba(0, 0, 0, 0.025);
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
display: flex;
&:focus {
outline: none;
}
.breadcrumb-container {
float: left;
::v-deep .el-input__inner {
border: none;
box-shadow: none;
}
.errLog-container {
display: inline-block;
vertical-align: top;
.select-tenant {
margin-right: 20px;
border: 0;
width: 150px;
}
.right-menu {
float: right;
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
line-height: 50px;
display: flex;
&:focus {
outline: none;
}
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
::v-deep .el-input__inner {
border: none;
box-shadow: none;
}
&.hover-effect {
cursor: pointer;
transition: background 0.3s;
.select-tenant {
margin-right: 20px;
border: 0;
width: 150px;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
}
}
.avatar-container {
margin-right: 30px;
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
.avatar-wrapper {
margin-top: 5px;
position: relative;
&.hover-effect {
.user-avatar {
cursor: pointer;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
}
width: 40px;
height: 40px;
border-radius: 10px;
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
</style>
}
</style>

@ -46,7 +46,7 @@ public class BeforeCheckConfiguration {
// TODO test
boolean checkFlag = properties != null && properties.getEnable();
if (checkFlag) {
String propertiesClassName = properties.getClass().getName();
String propertiesClassName = properties.getClass().getSuperclass() == Object.class ? properties.getClass().getName() : properties.getClass().getSuperclass().getName();
switch (propertiesClassName) {
case bootstrapPropertiesClassName: {
String namespace = properties.getNamespace();

@ -17,12 +17,14 @@
package cn.hippo4j.monitor.micrometer;
import cn.hippo4j.common.extension.spi.ServiceLoaderRegistry;
import cn.hippo4j.core.config.ApplicationContextHolder;
import cn.hippo4j.common.model.ThreadPoolRunStateInfo;
import cn.hippo4j.common.toolkit.BeanUtil;
import cn.hippo4j.common.toolkit.CollectionUtil;
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import cn.hippo4j.monitor.base.AbstractDynamicThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.api.ThreadPoolMonitor;
import cn.hippo4j.threadpool.monitor.support.MonitorTypeEnum;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
@ -48,6 +50,10 @@ public class DynamicThreadPoolMicrometerMonitorHandler extends AbstractDynamicTh
super(handler);
}
static {
ServiceLoaderRegistry.register(ThreadPoolMonitor.class);
}
@Override
protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {
ThreadPoolRunStateInfo stateInfo = runStateCache.get(poolRunStateInfo.getTpId());

Loading…
Cancel
Save