-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE #5141] update eventmesh-admin-server module
- Loading branch information
Showing
49 changed files
with
2,894 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
# | ||
# Licensed to Apache Software Foundation (ASF) under one or more contributor | ||
# license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright | ||
# ownership. Apache Software Foundation (ASF) licenses this file to you under | ||
# the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Detect operating system | ||
OS=$(uname) | ||
|
||
EVENTMESH_ADMIN_HOME=`cd $(dirname $0)/.. && pwd` | ||
|
||
export EVENTMESH_ADMIN_HOME | ||
|
||
function get_pid { | ||
local ppid="" | ||
if [ -f ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file ]; then | ||
ppid=$(cat ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file) | ||
# If the process does not exist, it indicates that the previous process terminated abnormally. | ||
if [ ! -d /proc/$ppid ]; then | ||
# Remove the residual file and return an error status. | ||
rm ${EVENTMESH_ADMIN_HOME}/bin/pid-admin.file | ||
echo -e "ERROR\t EventMesh admin process had already terminated unexpectedly before, please check log output." | ||
ppid="" | ||
fi | ||
else | ||
if [[ $OS =~ Msys ]]; then | ||
# There is a Bug on Msys that may not be able to kill the identified process | ||
ppid=`jps -v | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep java | grep -v grep | awk -F ' ' {'print $1'}` | ||
elif [[ $OS =~ Darwin ]]; then | ||
# Known problem: grep Java may not be able to accurately identify Java processes | ||
ppid=$(/bin/ps -o user,pid,command | grep "java" | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'}) | ||
else | ||
# It is required to identify the process as accurately as possible on Linux | ||
ppid=$(ps -C java -o user,pid,command --cols 99999 | grep -w $EVENTMESH_ADMIN_HOME | grep -i "org.apache.eventmesh.admin.server.ExampleAdminServer" | grep -Ev "^root" |awk -F ' ' {'print $2'}) | ||
fi | ||
fi | ||
echo "$ppid"; | ||
} | ||
|
||
pid=$(get_pid) | ||
if [[ $pid == "ERROR"* ]]; then | ||
echo -e "${pid}" | ||
exit 9 | ||
fi | ||
if [ -z "$pid" ];then | ||
echo -e "ERROR\t No EventMesh admin server running." | ||
exit 9 | ||
fi | ||
|
||
kill ${pid} | ||
echo "Send shutdown request to EventMesh admin(${pid}) OK" | ||
|
||
[[ $OS =~ Msys ]] && PS_PARAM=" -W " | ||
stop_timeout=60 | ||
for no in $(seq 1 $stop_timeout); do | ||
if ps $PS_PARAM -p "$pid" 2>&1 > /dev/null; then | ||
if [ $no -lt $stop_timeout ]; then | ||
echo "[$no] server shutting down ..." | ||
sleep 1 | ||
continue | ||
fi | ||
|
||
echo "shutdown server timeout, kill process: $pid" | ||
kill -9 $pid; sleep 1; break; | ||
echo "`date +'%Y-%m-%-d %H:%M:%S'` , pid : [$pid] , error message : abnormal shutdown which can not be closed within 60s" > ../logs/shutdown.error | ||
else | ||
echo "shutdown server ok!"; break; | ||
fi | ||
done | ||
|
||
if [ -f "pid-admin.file" ]; then | ||
rm pid-admin.file | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
eventmesh-admin-server/conf/mapper/EventMeshMonitorMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
--> | ||
|
||
<!DOCTYPE mapper | ||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
<mapper namespace="org.apache.eventmesh.admin.server.web.db.mapper.EventMeshMonitorMapper"> | ||
|
||
<resultMap id="BaseResultMap" type="org.apache.eventmesh.admin.server.web.db.entity.EventMeshMonitor"> | ||
<id property="id" column="id" jdbcType="INTEGER"/> | ||
<result property="taskID" column="taskID" jdbcType="VARCHAR"/> | ||
<result property="jobID" column="jobID" jdbcType="VARCHAR"/> | ||
<result property="address" column="address" jdbcType="VARCHAR"/> | ||
<result property="transportType" column="transportType" jdbcType="VARCHAR"/> | ||
<result property="connectorStage" column="connectorStage" jdbcType="VARCHAR"/> | ||
<result property="totalReqNum" column="totalReqNum" jdbcType="BIGINT"/> | ||
<result property="totalTimeCost" column="totalTimeCost" jdbcType="BIGINT"/> | ||
<result property="maxTimeCost" column="maxTimeCost" jdbcType="BIGINT"/> | ||
<result property="avgTimeCost" column="avgTimeCost" jdbcType="BIGINT"/> | ||
<result property="tps" column="tps" jdbcType="DOUBLE"/> | ||
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/> | ||
</resultMap> | ||
|
||
<sql id="Base_Column_List"> | ||
id,taskID,jobID,address,transportType,connectorStage, | ||
totalReqNum,totalTimeCost,maxTimeCost,avgTimeCost, | ||
tps,createTime | ||
</sql> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.