Skip to content

Commit

Permalink
Merge pull request #123 from qq254963746/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
qq254963746 committed Oct 10, 2015
2 parents 86b7b35 + 107c911 commit 0ecbd7a
Show file tree
Hide file tree
Showing 50 changed files with 105 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ start mvn clean install -DskipTests
echo "LTS: mvn clean install -DskipTests"
echo "LTS: After sub window finished, close it , and press any key to continue" & pause>nul

set VERSION=1.6.0-SNAPSHOT
set VERSION=1.6.0-beta2
set BASE_HOME=%~dp0%
set DIST_BIN_DIR=lts-%VERSION%-bin

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION="1.6.0-SNAPSHOT"
VERSION="1.6.0-beta2"

LTS_BIN="${BASH_SOURCE-$0}"
LTS_BIN="$(dirname "${LTS_BIN}")"
Expand Down
2 changes: 1 addition & 1 deletion lts-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.lts.web.support;

import com.lts.core.commons.utils.StringUtils;
import com.lts.core.constant.Constants;
import com.lts.core.domain.Job;
import com.lts.jobclient.JobClient;
import com.lts.jobclient.domain.Response;
Expand All @@ -27,6 +28,7 @@ public void afterPropertiesSet() throws Exception {
if (StringUtils.isEmpty(clusterName)) {
throw new IllegalArgumentException("clusterName in lts-admin.cfg can not be null.");
}
jobClient.setFailStorePath(AppConfigurer.getProperties("lts.admin.data.path", Constants.USER_HOME));
jobClient.setClusterName(clusterName);
jobClient.setRegistryAddress(AppConfigurer.getProperties("registryAddress"));

Expand Down
2 changes: 1 addition & 1 deletion lts-admin/src/main/resources/spring-web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="configLocation">
<value>/views/velocity.properties</value>
<value>/WEB-INF/views/velocity.properties</value>
</property>
</bean>
<bean id="viewResolver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ resource.loader=webapp, class
class.resource.loader.description=Velocity Classpath Resource Loader
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader
webapp.resource.loader.path=/views/
webapp.resource.loader.path=/WEB-INF/views/
webapp.resource.loader.cache=false
2 changes: 1 addition & 1 deletion lts-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion lts-core/src/main/java/com/lts/core/support/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private Version() {}

private static final Logger LOGGER = LoggerFactory.getLogger(Version.class);

private static final String VERSION = getVersion(Version.class, "1.6.0-SNAPSHOT");
private static final String VERSION = getVersion(Version.class, "1.6.0-beta2");

static {
// 检查是否存在重复的jar包
Expand Down
2 changes: 1 addition & 1 deletion lts-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lts-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion lts-jobclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-jobtracker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-logger/lts-logger-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-logger</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-logger/lts-logger-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-logger</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-logger/lts-logger-mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-logger</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-logger/lts-logger-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-logger</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-logger/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-queue/lts-queue-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-queue</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-queue/lts-queue-mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-queue</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion lts-queue/lts-queue-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-queue</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-queue/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion lts-startup/lts-startup-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-startup</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) {
server.setStopAtShutdown(true);
server.start();

System.out.println("LTS-Admin started. http://" + NetUtils.getLocalHost() + ":" + port + "/main.html");
System.out.println("LTS-Admin started. http://" + NetUtils.getLocalHost() + ":" + port + "/index.htm");

} catch (Exception e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion lts-startup/lts-startup-jobtracker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-startup</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-startup/lts-startup-tasktracker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-startup</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-startup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion lts-tasktracker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>lts-parent</artifactId>
<groupId>com.lts</groupId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void stopWorking() {
threadPoolExecutor.shutdownNow();
Thread.sleep(1000);
threadPoolExecutor = initThreadPoolExecutor();
LOGGER.error("stop working succeed ");
LOGGER.info("stop working succeed ");
} catch (Throwable t) {
LOGGER.error("stop working failed ", t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

/**
* 用来向JobTracker去取任务
* 1. 会订阅JobTracker的可用,不可用消息主题的订阅
* 2. 只有当JobTracker可用的时候才会去Pull任务
* 3. Pull只是会给JobTracker发送一个通知
* Robert HG ([email protected]) on 3/25/15.
*/
public class JobPullMachine {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.lts</groupId>
<artifactId>lts-parent</artifactId>
<packaging>pom</packaging>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0-beta2</version>
<modules>
<module>lts-core</module>
<module>lts-jobtracker</module>
Expand Down

0 comments on commit 0ecbd7a

Please sign in to comment.