我创建了一个API,允许用户使用树构建查询.树是从SearchOperationRequest班级建造的.
@Data
@ApiModel(value = "SearchOperationRequest", description = "Condition for the query")
public class SearchOperationRequest {
@ApiModelProperty(value = "Conditional statement for the where clause", allowableValues = "EQUALS, NOT_EQUALS, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS")
private SearchConditionOperation condition;
@ApiModelProperty(value = "Column name to be searched on")
private String column;
@ApiModelProperty(value = "Value of column")
private Object value;
@ApiModelProperty(value = "Value of OR / AND")
private SearchComparator comparator;
@ApiModelProperty(value = "Left node of comparator condition")
private SearchOperationRequest left;
@ApiModelProperty(value = "Right …Run Code Online (Sandbox Code Playgroud) 我有一个 java jar 程序,我试图在我的机器启动时运行它。理想情况下,shell 脚本将每 60 秒检查一次以确保 jar 正在运行。如何检查 jar 是否在 centos 上运行,这似乎不起作用?
我当前的 .sh 文件:
#!/bin/bash
while [ true ]
do
cnt=`ps -eaflc --sort stime | grep /home/Portal.jar |grep -v grep | wc -l`
if(test $cnt -eq 3);
then
echo "Service already running..."
else
echo "Starting Service"
java -jar /home/Portal.jar >> /dev/null &
fi
sleep 1m
done
Run Code Online (Sandbox Code Playgroud)
到目前为止,我使用它作为参考。
在string.replaceall上找到了很多例子,但我无法弄清楚如何使用正则表达式来解决我的问题.我期待在我的消息中找到并替换所有出现的字符串[reset_token].
我到目前为止的代码:
String message = "Your new token is [reset_token]";
String newbody = replaceDelimiter("^[reset_token]", "mynewtoken");
public String replaceDelimiter(String delimiter, String message) {
return message.replaceAll(delimiter, message);
}
Run Code Online (Sandbox Code Playgroud)
我希望结果是"你的新令牌是我的新闻"