Commit b8de6d75 by lepdou

Merge pull request #221 from nobodyiam/misc-change-merge

Misc changes.
parents a0308f8d 90c85d3e
......@@ -22,6 +22,9 @@ public class EntityManagerUtil extends EntityManagerFactoryAccessor {
public void closeEntityManager() {
EntityManagerHolder emHolder = (EntityManagerHolder)
TransactionSynchronizationManager.getResource(getEntityManagerFactory());
if (emHolder == null) {
return;
}
logger.debug("Closing JPA EntityManager in EntityManagerUtil");
EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
}
......
......@@ -100,7 +100,7 @@ public interface Config {
* exist.
*
* @param key the property name
* @param delimiter
* @param delimiter the delimiter regex
* @param defaultValue the default value when key is not found
* @return
*/
......
......@@ -114,9 +114,14 @@ public class ConfigServiceLocator implements Initializable {
transaction.addData("Url", url);
try {
HttpResponse<List<ServiceDTO>> response = m_httpUtil.doGet(request, m_responseType);
m_configServices.set(response.getBody());
logConfigServicesToCat(response.getBody());
transaction.setStatus(Message.SUCCESS);
List<ServiceDTO> services = response.getBody();
if (services == null || services.isEmpty()) {
logConfigServiceToCat("Empty response!");
continue;
}
m_configServices.set(services);
logConfigServicesToCat(services);
return;
} catch (Throwable ex) {
Cat.logError(ex);
......@@ -151,7 +156,11 @@ public class ConfigServiceLocator implements Initializable {
private void logConfigServicesToCat(List<ServiceDTO> serviceDtos) {
for (ServiceDTO serviceDto : serviceDtos) {
Cat.logEvent("Apollo.Config.Services", serviceDto.getHomepageUrl());
logConfigServiceToCat(serviceDto.getHomepageUrl());
}
}
private void logConfigServiceToCat(String serviceUrl) {
Cat.logEvent("Apollo.Config.Services", serviceUrl);
}
}
......@@ -30,6 +30,9 @@ public class TitanSettings {
public String getTitanUrl() {
Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
if (env == null) {
return "";
}
switch (env) {
case FAT:
case FWS:
......@@ -46,6 +49,9 @@ public class TitanSettings {
public String getTitanDbname() {
Env env = EnvUtils.transformEnv(Foundation.server().getEnvType());
if (env == null) {
return "";
}
switch (env) {
case FAT:
case FWS:
......
import com.google.common.base.Strings;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigChangeListener;
import com.ctrip.framework.apollo.ConfigService;
......@@ -39,7 +36,7 @@ public class ApolloConfigDemo implements ConfigChangeListener {
while (true) {
System.out.print("> ");
String input = new BufferedReader(new InputStreamReader(System.in)).readLine();
if (Strings.isNullOrEmpty(input)) {
if (input == null || input.length() == 0) {
continue;
}
input = input.trim();
......
......@@ -2,7 +2,7 @@
SERVICE_NAME=apollo-portal
PATH_TO_JAR=$SERVICE_NAME".jar"
export JAVA_OPTS="-server -Xms4096m -Xmx4096m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=22 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8"
export JAVA_OPTS="-server -Xms8192m -Xmx8192m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=3072m -XX:MaxNewSize=3072m -XX:SurvivorRatio=22 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8"
export JAVA_OPTS="$JAVA_OPTS -Xloggc:/opt/logs/100003173/heap_trace.txt -XX:HeapDumpPath=/opt/logs/100003173/HeapDumpOnOutOfMemoryError/"
if [[ -z "$JAVA_HOME" && -d /usr/java/latest/ ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment