本文整理汇总了Java中org.apache.catalina.Executor类的典型用法代码示例。如果您正苦于以下问题:Java Executor类的具体用法?Java Executor怎么用?Java Executor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Executor类属于org.apache.catalina包,在下文中一共展示了Executor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroyInternal
import org.apache.catalina.Executor; //导入依赖的package包/类
@Override
protected void destroyInternal() throws LifecycleException {
// Destroy our defined Connectors
synchronized (connectorsLock) {
for (Connector connector : connectors) {
try {
connector.destroy();
} catch (Exception e) {
log.error(sm.getString(
"standardService.connector.destroyFailed",
connector), e);
}
}
}
// Destroy any Executors
for (Executor executor : findExecutors()) {
executor.destroy();
}
if (container != null) {
container.destroy();
}
super.destroyInternal();
}
示例2: destroyInternal
import org.apache.catalina.Executor; //导入依赖的package包/类
@Override
protected void destroyInternal() throws LifecycleException {
// Destroy our defined Connectors
synchronized (connectorsLock) {
for (Connector connector : connectors) {
try {
connector.destroy();
} catch (Exception e) {
log.error(sm.getString("standardService.connector.destroyFailed", connector), e);
}
}
}
// Destroy any Executors
for (Executor executor : findExecutors()) {
executor.destroy();
}
if (container != null) {
container.destroy();
}
super.destroyInternal();
}
示例3: initExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
protected void initExecutor() {
final TypeReference<ExecutorConf> type = new TypeReference<ExecutorConf>() {
};
final ExecutorConf conf = new ExecutorConf(JSON.parseObject(context.getProperty(TOMCAT_EXECUTOR), type));
LOGGER.debug("{}", conf.toString());
final Executor executor = conf.init();
getService().addExecutor(executor);
}
示例4: destroyInternal
import org.apache.catalina.Executor; //导入依赖的package包/类
@Override
protected void destroyInternal() throws LifecycleException {
// Destroy our defined Connectors
synchronized (connectors) {
for (Connector connector : connectors) {
try {
connector.destroy();
} catch (Exception e) {
log.error(sm.getString(
"standardService.connector.destroyfailed",
connector), e);
}
}
}
// Destroy any Executors
for (Executor executor : findExecutors()) {
executor.destroy();
}
if (container != null) {
container.destroy();
}
super.destroyInternal();
}
示例5: begin
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Process the beginning of this element.
*
* @param namespace the namespace URI of the matching element, or an
* empty string if the parser is not namespace aware or the element has
* no namespace
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
* @param attributes The attribute list for this element
*/
@Override
public void begin(String namespace, String name, Attributes attributes)
throws Exception {
Service svc = (Service)digester.peek();
Executor ex = null;
if ( attributes.getValue("executor")!=null ) {
ex = svc.getExecutor(attributes.getValue("executor"));
}
Connector con = new Connector(attributes.getValue("protocol"));
if ( ex != null ) _setExecutor(con,ex);
digester.push(con);
}
示例6: _setExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
public void _setExecutor(Connector con, Executor ex) throws Exception {
Method m = IntrospectionUtils.findMethod(con.getProtocolHandler().getClass(),"setExecutor",new Class[] {java.util.concurrent.Executor.class});
if (m!=null) {
m.invoke(con.getProtocolHandler(), new Object[] {ex});
}else {
log.warn("Connector ["+con+"] does not support external executors. Method setExecutor(java.util.concurrent.Executor) not found.");
}
}
示例7: addExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Adds a named executor to the service
* @param ex Executor
*/
@Override
public void addExecutor(Executor ex) {
synchronized (executors) {
if (!executors.contains(ex)) {
executors.add(ex);
if (getState().isAvailable())
try {
ex.start();
} catch (LifecycleException x) {
log.error("Executor.start", x);
}
}
}
}
示例8: findExecutors
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* 查询所有的Executor,设置共享的线程池
* Retrieves all executors
* @return Executor[]
*/
@Override
public Executor[] findExecutors() {
synchronized (executors) {
Executor[] arr = new Executor[executors.size()];
executors.toArray(arr);
return arr;
}
}
示例9: getExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Retrieves executor by name, null if not found
* @param executorName String
* @return Executor
*/
@Override
public Executor getExecutor(String executorName) {
synchronized (executors) {
for (Executor executor: executors) {
if (executorName.equals(executor.getName()))
return executor;
}
}
return null;
}
示例10: removeExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Removes an executor from the service
* @param ex Executor
*/
@Override
public void removeExecutor(Executor ex) {
synchronized (executors) {
if ( executors.remove(ex) && getState().isAvailable() ) {
try {
ex.stop();
} catch (LifecycleException e) {
log.error("Executor.stop", e);
}
}
}
}
示例11: startInternal
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Start nested components ({@link Executor}s, {@link Connector}s and
* {@link Container}s) and implement the requirements of
* {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected void startInternal() throws LifecycleException {
if(log.isInfoEnabled())
log.info(sm.getString("standardService.start.name", this.name));
setState(LifecycleState.STARTING);
// Start our defined Container first
if (container != null) {
synchronized (container) {
container.start();
}
}
synchronized (executors) {
for (Executor executor: executors) {
executor.start();
}
}
// Start our defined Connectors second
synchronized (connectorsLock) {
for (Connector connector: connectors) {
try {
// If it has already failed, don't try and start it
if (connector.getState() != LifecycleState.FAILED) {
connector.start();
}
} catch (Exception e) {
log.error(sm.getString(
"standardService.connector.startFailed",
connector), e);
}
}
}
}
示例12: initInternal
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Invoke a pre-startup initialization. This is used to allow connectors
* to bind to restricted ports under Unix operating environments.
*/
@Override
protected void initInternal() throws LifecycleException {
super.initInternal();
if (container != null) {
container.init();
}
// Initialize any Executors
for (Executor executor : findExecutors()) {
if (executor instanceof LifecycleMBeanBase) {
((LifecycleMBeanBase) executor).setDomain(getDomain());
}
executor.init(); // StandardThreadExecutor#initInternal
}
// Initialize our defined Connectors
synchronized (connectorsLock) {
for (Connector connector : connectors) {
try {
connector.init();
} catch (Exception e) {
String message = sm.getString(
"standardService.connector.initFailed", connector);
log.error(message, e);
if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
throw new LifecycleException(message);
}
}
}
}
示例13: begin
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Process the beginning of this element.
*
* @param attributes The attribute list of this element
*/
public void begin(Attributes attributes) throws Exception {
Service svc = (Service)digester.peek();
Executor ex = null;
if ( attributes.getValue("executor")!=null ) {
ex = svc.getExecutor(attributes.getValue("executor"));
}
Connector con = new Connector(attributes.getValue("protocol"));
if ( ex != null ) setExecutor(con,ex);
digester.push(con);
}
示例14: addExecutor
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Adds a named executor to the service
* @param ex Executor
*/
public void addExecutor(Executor ex) {
synchronized (executors) {
if (!executors.contains(ex)) {
executors.add(ex);
if (started)
try {
ex.start();
} catch (LifecycleException x) {
log.error("Executor.start", x);
}
}
}
}
示例15: findExecutors
import org.apache.catalina.Executor; //导入依赖的package包/类
/**
* Retrieves all executors
* @return Executor[]
*/
public Executor[] findExecutors() {
synchronized (executors) {
Executor[] arr = new Executor[executors.size()];
executors.toArray(arr);
return arr;
}
}