Commit 668ac901 by Jason Song

adjust accept-count property name

parent 33c4df42
...@@ -3,6 +3,8 @@ package com.ctrip.apollo.biz.customize; ...@@ -3,6 +3,8 @@ package com.ctrip.apollo.biz.customize;
import org.apache.catalina.connector.Connector; import org.apache.catalina.connector.Connector;
import org.apache.coyote.ProtocolHandler; import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.http11.Http11NioProtocol; import org.apache.coyote.http11.Http11NioProtocol;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
...@@ -16,7 +18,8 @@ import org.springframework.stereotype.Component; ...@@ -16,7 +18,8 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
public class TomcatContainerCustomizer implements EmbeddedServletContainerCustomizer { public class TomcatContainerCustomizer implements EmbeddedServletContainerCustomizer {
private static final String TOMCAT_ACCEPTOR_COUNT = "server.tomcat.acceptor-count"; private static final Logger logger = LoggerFactory.getLogger(TomcatContainerCustomizer.class);
private static final String TOMCAT_ACCEPTOR_COUNT = "server.tomcat.accept-count";
@Autowired @Autowired
private Environment environment; private Environment environment;
...@@ -36,7 +39,9 @@ public class TomcatContainerCustomizer implements EmbeddedServletContainerCustom ...@@ -36,7 +39,9 @@ public class TomcatContainerCustomizer implements EmbeddedServletContainerCustom
ProtocolHandler handler = connector.getProtocolHandler(); ProtocolHandler handler = connector.getProtocolHandler();
if (handler instanceof Http11NioProtocol) { if (handler instanceof Http11NioProtocol) {
Http11NioProtocol http = (Http11NioProtocol) handler; Http11NioProtocol http = (Http11NioProtocol) handler;
http.setBacklog(Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT))); int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
http.setBacklog(acceptCount);
logger.info("Setting tomcat accept count to {}", acceptCount);
} }
} }
......
package com.ctrip.apollo.biz.utils; package com.ctrip.apollo.biz.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.jpa.EntityManagerFactoryAccessor; import org.springframework.orm.jpa.EntityManagerFactoryAccessor;
import org.springframework.orm.jpa.EntityManagerFactoryUtils; import org.springframework.orm.jpa.EntityManagerFactoryUtils;
import org.springframework.orm.jpa.EntityManagerHolder; import org.springframework.orm.jpa.EntityManagerHolder;
...@@ -11,6 +13,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager ...@@ -11,6 +13,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
*/ */
@Component @Component
public class EntityManagerUtil extends EntityManagerFactoryAccessor { public class EntityManagerUtil extends EntityManagerFactoryAccessor {
private static final Logger logger = LoggerFactory.getLogger(EntityManagerUtil.class);
/** /**
* close the entity manager. * close the entity manager.
* Use it with caution! This is only intended for use with async request, which Spring won't * Use it with caution! This is only intended for use with async request, which Spring won't
......
...@@ -9,4 +9,4 @@ spring.jpa.hibernate.globally_quoted_identifiers=true ...@@ -9,4 +9,4 @@ spring.jpa.hibernate.globally_quoted_identifiers=true
spring.jpa.properties.hibernate.globally_quoted_identifiers=true spring.jpa.properties.hibernate.globally_quoted_identifiers=true
# Tomcat configuration # Tomcat configuration
server.tomcat.acceptor-count=1024 server.tomcat.accept-count=1024
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