-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from qq254963746/develop
Develop
- Loading branch information
Showing
50 changed files
with
105 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,27 +3,85 @@ | |
import com.lts.core.constant.Constants; | ||
import org.h2.server.web.WebServlet; | ||
|
||
import javax.servlet.ServletConfig; | ||
import javax.servlet.ServletContext; | ||
import javax.servlet.ServletException; | ||
import java.util.Collections; | ||
import java.util.Enumeration; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* H2 Console 的 servlet | ||
* | ||
* @author Robert HG ([email protected]) on 9/26/15. | ||
*/ | ||
public class H2ConsoleWebServlet extends WebServlet { | ||
|
||
@Override | ||
public void init() { | ||
public void init(ServletConfig config) throws ServletException { | ||
ServletConfigFacade servletConfigFacade = new ServletConfigFacade(config); | ||
|
||
ServletContext servletContext = this.getServletConfig().getServletContext(); | ||
String monitorDBPath = AppConfigurer.getProperties("lts.admin.data.path", | ||
Constants.USER_HOME) + "/.lts/h2/lts-admin"; | ||
// http://h2database.com/html/features.html#connection_modes | ||
// http://h2database.com/html/features.html#auto_mixed_mode | ||
String url = "jdbc:h2:" + monitorDBPath+";AUTO_SERVER=TRUE"; | ||
servletContext.setInitParameter("url", url); | ||
servletContext.setInitParameter("user", "lts"); | ||
servletContext.setInitParameter("password", ""); | ||
String url = "jdbc:h2:" + monitorDBPath + ";AUTO_SERVER=TRUE"; | ||
servletConfigFacade.setInitParameter("url", url); | ||
servletConfigFacade.setInitParameter("user", "lts"); | ||
servletConfigFacade.setInitParameter("password", ""); | ||
servletConfigFacade.setInitParameter("webAllowOthers", "true"); | ||
|
||
super.init(); | ||
super.init(servletConfigFacade); | ||
} | ||
} | ||
|
||
/** | ||
* 主要为解决 jetty embedded 的问题 | ||
*/ | ||
class ServletConfigFacade implements ServletConfig { | ||
|
||
private ServletConfig servletConfig; | ||
|
||
private Map<String, String> initParams; | ||
|
||
public ServletConfigFacade(ServletConfig servletConfig) { | ||
this.servletConfig = servletConfig; | ||
this.initParams = new HashMap<String, String>(); | ||
|
||
initParams(); | ||
} | ||
|
||
private void initParams() { | ||
Enumeration<?> en = servletConfig.getInitParameterNames(); | ||
while (en.hasMoreElements()) { | ||
String name = en.nextElement().toString(); | ||
String value = servletConfig.getInitParameter(name); | ||
initParams.put(name, value); | ||
} | ||
} | ||
|
||
@Override | ||
public String getServletName() { | ||
return servletConfig.getServletName(); | ||
} | ||
|
||
@Override | ||
public ServletContext getServletContext() { | ||
return servletConfig.getServletContext(); | ||
} | ||
|
||
@Override | ||
public String getInitParameter(String name) { | ||
return initParams.get(name); | ||
} | ||
|
||
@Override | ||
public Enumeration<String> getInitParameterNames() { | ||
return Collections.enumeration(initParams.keySet()); | ||
} | ||
|
||
public void setInitParameter(String name, String value) { | ||
initParams.put(name, value); | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
import java.util.List; | ||
|
||
/** | ||
* 业务日志记录器实现 | ||
* 1. 业务日志会发送给JobTracker | ||
* 2. 也会采取Fail And Store 的方式 | ||
* @author Robert HG ([email protected]) on 3/27/15. | ||
*/ | ||
public class BizLoggerImpl implements BizLogger { | ||
|
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 |
---|---|---|
|
@@ -17,8 +17,11 @@ | |
import java.io.StringWriter; | ||
|
||
/** | ||
* Job Runner 的代理类, | ||
* 1. 做一些错误处理之类的 | ||
* 2. 监控统计 | ||
* 3. Context信息设置 | ||
* @author Robert HG ([email protected]) on 8/16/14. | ||
* Job Runner 的代理类, 要做一些错误处理之类的 | ||
*/ | ||
public class JobRunnerDelegate implements Runnable { | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
|
||
/** | ||
* 用来向JobTracker去取任务 | ||
* 1. 会订阅JobTracker的可用,不可用消息主题的订阅 | ||
* 2. 只有当JobTracker可用的时候才会去Pull任务 | ||
* 3. Pull只是会给JobTracker发送一个通知 | ||
* Robert HG ([email protected]) on 3/25/15. | ||
*/ | ||
public class JobPullMachine { | ||
|
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