mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
+6
-6
@@ -22,9 +22,9 @@ import com.alibaba.druid.util.StringUtils;
|
||||
*
|
||||
* @author sandzhang<sandzhangtoo@gmail.com>
|
||||
*/
|
||||
public class DruidStatJSONService implements DruidStatJSONServiceMBean {
|
||||
public class DruidStatService implements DruidStatServiceMBean {
|
||||
|
||||
private final static DruidStatJSONService instance = new DruidStatJSONService();
|
||||
private final static DruidStatService instance = new DruidStatService();
|
||||
|
||||
private static DruidStatManagerFacade statManagerFacade = DruidStatManagerFacade.getInstance();
|
||||
|
||||
@@ -36,10 +36,10 @@ public class DruidStatJSONService implements DruidStatJSONServiceMBean {
|
||||
private static final String DEFAULT_ORDER_TYPE = "asc";
|
||||
private static final String DEFAULT_ORDERBY = "SQL";
|
||||
|
||||
private DruidStatJSONService(){
|
||||
private DruidStatService(){
|
||||
}
|
||||
|
||||
public static DruidStatJSONService getInstance() {
|
||||
public static DruidStatService getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DruidStatJSONService implements DruidStatJSONServiceMBean {
|
||||
|
||||
if (url.startsWith("/sql-") && url.indexOf(".json") > 0) {
|
||||
Integer id = StringUtils.subStringToInteger(url, "sql-", ".json");
|
||||
return returnJSONSqlInfo(id);
|
||||
return getSqlStat(id);
|
||||
}
|
||||
|
||||
if (url.startsWith("/weburi.json")) {
|
||||
@@ -199,7 +199,7 @@ public class DruidStatJSONService implements DruidStatJSONServiceMBean {
|
||||
return comparatorOrderBy(array, parameters);
|
||||
}
|
||||
|
||||
private String returnJSONSqlInfo(Integer id) {
|
||||
private String getSqlStat(Integer id) {
|
||||
Map<String, Object> map = statManagerFacade.getSqlStatData(id);
|
||||
|
||||
if (map == null) {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.alibaba.druid.stat;
|
||||
|
||||
|
||||
public interface DruidStatJSONServiceMBean {
|
||||
public interface DruidStatServiceMBean {
|
||||
String service(String url);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.druid.stat.DruidStatJSONService;
|
||||
import com.alibaba.druid.stat.DruidStatService;
|
||||
import com.alibaba.druid.support.http.util.IPAddress;
|
||||
import com.alibaba.druid.support.http.util.IPRange;
|
||||
import com.alibaba.druid.support.logging.Log;
|
||||
@@ -34,7 +34,7 @@ public class StatViewServlet extends HttpServlet {
|
||||
private final static String RESOURCE_PATH = "support/http/resources";
|
||||
private final static String TEMPLATE_PAGE_RESOURCE_PATH = RESOURCE_PATH + "/template.html";
|
||||
|
||||
private DruidStatJSONService statService = DruidStatJSONService.getInstance();
|
||||
private DruidStatService statService = DruidStatService.getInstance();
|
||||
|
||||
public String templatePage;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user