Giter Club home page Giter Club logo

java-learn's Introduction

JavaLearning

Learning some summaries in Java

java-learn's People

Contributors

mowangblog avatar

Stargazers

 avatar

Watchers

 avatar

java-learn's Issues

idea plugins

idea实用插件

  • Key Promoter X 快捷键提示插件
  • AiXcoder Code Completer Ai代码补全
  • GenerateAllSetter 制造set假数据
  • GenerateSerialVersionUID 一键为实现 Serializable 接口的类生成 SerialVersionUID
  • GsonFormat 根据json自动生成该结构的类
  • Rainbow Brackets 颜色区分括号嵌套层级
  • CodeGlance 代码浏览缩略图
  • Translation 翻译

Java swicth tips

switch方法其实只支持int类型,其他数据类型会被语法糖转换为整型来进行判断和匹配

例如:String类型在switch方法里面实际上是调用了它的hashCode方法来转换为整型,而枚举Enum会调用ordinal序号方法转化为整型

语法糖是什么:里面的实现机制还是原来的,但是包装让你感觉使用很方便很舒服起来像一颗糖

启动springboot项目脚本

#!/bin/bash

AppName=xxxx.jar

#JVM参数
JVM_OPTS="-Dname=$AppName -Duser.timezone=Asia/Shanghai -Xms512M -Xmx512M -XX:PermSize=256M -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:NewRatio=1 -XX:SurvivorRatio=30 -XX:+UseParallelGC -XX:+UseParallelOldGC"
APP_HOME=pwd
LOG_PATH=$APP_HOME/logs/$AppName.log

if [ "$1" = "" ];
then
echo -e "\033[0;31m 未输入操作名 \033[0m \033[0;34m {start|stop|restart|status} \033[0m"
exit 1
fi

if [ "$AppName" = "" ];
then
echo -e "\033[0;31m 未输入应用名 \033[0m"
exit 1
fi

function start()
{
PID=ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'

if [ x"$PID" != x"" ]; then
    echo "$AppName is running..."
else
	nohup java -jar  $JVM_OPTS $AppName > /dev/null 2>&1 &
	echo "Start $AppName success..."
fi

}

function stop()
{
echo "Stop $AppName"

PID=""
query(){
	PID=`ps -ef |grep java|grep $AppName|grep -v grep|awk '{print $2}'`
}

query
if [ x"$PID" != x"" ]; then
	kill -9 $PID
	echo "$AppName (pid:$PID) exiting..."
	while [ x"$PID" != x"" ]
	do
		sleep 1
		query
	done
	echo "$AppName exited."
else
	echo "$AppName already stopped."
fi

}

function restart()
{
stop
sleep 2
start
}

function status()
{
PID=ps -ef |grep java|grep $AppName|grep -v grep|wc -l
if [ $PID != 0 ];then
echo "$AppName is running..."
else
echo "$AppName is not running..."
fi
}

case $1 in
start)
start;;
stop)
stop;;
restart)
restart;;
status)
status;;
*)

esac

idea tips

自动生成类doc注释模板

/**
* ${PROJECT_NAME}
* ${description}
* @author : Xuan Li
* @website : https://mowangblog.top
* @date : ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE}
**/

方法自动生成doc注释模板

/**
 * @description: 
 * @author: Xuan Li
 * @date: $DATE$ $TIME$
*/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.