Here are the examples of the java api org.apache.catalina.LifecycleState.STARTING taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
66 Examples
18
Source : LazySessionIdGenerator.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@Override
protected void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : ValveBase.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : SemaphoreValve.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
semapreplaced = new Semapreplaced(concurrency, fairness);
setState(LifecycleState.STARTING);
}
18
Source : JDBCAccessLogValve.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
try {
open();
} catch (SQLException e) {
throw new LifecycleException(e);
}
setState(LifecycleState.STARTING);
}
18
Source : CometConnectionManagerValve.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
if (container instanceof Context) {
container.addLifecycleListener(this);
}
setState(LifecycleState.STARTING);
}
18
Source : SessionIdGeneratorBase.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
@Override
protected void startInternal() throws LifecycleException {
// Ensure SecureRandom has been initialised
generateSessionId();
setState(LifecycleState.STARTING);
}
18
Source : StoreBase.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component and implement the requirements
* of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : PersistentManagerBase.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
super.startInternal();
if (store == null)
log.error("No Store configured, persistence disabled");
else if (store instanceof Lifecycle)
((Lifecycle) store).start();
setState(LifecycleState.STARTING);
}
18
Source : NamingResources.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
@Override
protected void startInternal() throws LifecycleException {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
}
18
Source : StandardServer.java
with Apache License 2.0
from tryandcatch
with Apache License 2.0
from tryandcatch
/**
* Start nested components ({@link Service}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 {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
globalNamingResources.start();
// Start our defined Services
synchronized (services) {
for (int i = 0; i < services.length; i++) {
services[i].start();
}
}
}
18
Source : 1403.java
with MIT License
from masud-technope
with MIT License
from masud-technope
/**
* Start nested components ({@link Service}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 {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
globalNamingResources.start();
// Start our defined Services
synchronized (servicesLock) {
for (int i = 0; i < services.length; i++) {
services[i].start();
}
}
}
18
Source : ValveBase.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : SemaphoreValve.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
semapreplaced = new Semapreplaced(concurrency, fairness);
setState(LifecycleState.STARTING);
}
18
Source : JDBCAccessLogValve.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
try {
open();
} catch (SQLException e) {
throw new LifecycleException(e);
}
setState(LifecycleState.STARTING);
}
18
Source : CometConnectionManagerValve.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
if (container instanceof Context) {
container.addLifecycleListener(this);
}
setState(LifecycleState.STARTING);
}
18
Source : StoreBase.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component and implement the requirements of
* {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException
* if this component detects a fatal error that prevents this
* component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : PersistentManagerBase.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
super.startInternal();
if (store == null)
log.error("No Store configured, persistence disabled");
else if (store instanceof Lifecycle)
((Lifecycle) store).start();
setState(LifecycleState.STARTING);
}
18
Source : RealmBase.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Prepare for the beginning of active use of the public methods of this
* component 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 {
// Create a MessageDigest instance for credentials, if desired
if (digest != null) {
try {
md = MessageDigest.getInstance(digest);
} catch (NoSuchAlgorithmException e) {
throw new LifecycleException(sm.getString("realmBase.algorithm", digest), e);
}
}
setState(LifecycleState.STARTING);
}
18
Source : StandardServer.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start nested components ({@link Service}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 {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
globalNamingResources.start();
// Start our defined Services
synchronized (servicesLock) {
for (int i = 0; i < services.length; i++) {
services[i].start();
}
}
}
18
Source : TesterWebResourceRoot.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
@Override
public void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : AbstractResourceSet.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
// -------------------------------------------------------- Lifecycle methods
@Override
protected final void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
}
18
Source : NamingResourcesImpl.java
with MIT License
from chenmudu
with MIT License
from chenmudu
/**
* 命名解析的启动方法。
* @throws LifecycleException
*/
@Override
protected void startInternal() throws LifecycleException {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
}
18
Source : ProvidedLoader.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Override
protected void startInternal() throws LifecycleException {
// check StandardContext.startInternal, while there is no warnings in the log and tests preplaced we are good
mockReturns = 4;
setState(LifecycleState.STARTING);
}
17
Source : StandardManager.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
super.startInternal();
// Load unloaded sessions, if any
try {
load();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardManager.managerLoad"), t);
}
setState(LifecycleState.STARTING);
}
17
Source : Connector.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Begin processing requests via this Connector.
*
* @exception LifecycleException if a fatal startup error occurs
*/
@Override
protected void startInternal() throws LifecycleException {
// Validate settings before starting
if (getPort() < 0) {
throw new LifecycleException(sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPort())));
}
setState(LifecycleState.STARTING);
try {
// 调用 protocolHandler 的start方法 Connector的生命周期都调用了protocolHandler的相关方法
protocolHandler.start();
} catch (Exception e) {
String errPrefix = "";
if (this.service != null) {
errPrefix += "service.getName(): \"" + this.service.getName() + "\"; ";
}
throw new LifecycleException(errPrefix + " " + sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
}
mapperListener.start();
}
17
Source : StandardPipeline.java
with Apache License 2.0
from tryandcatch
with Apache License 2.0
from tryandcatch
/**
* Start {@link Valve}s) in this pipeline and implement the requirements
* of {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
// Start the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).start();
current = current.getNext();
}
setState(LifecycleState.STARTING);
}
17
Source : Connector.java
with Apache License 2.0
from tryandcatch
with Apache License 2.0
from tryandcatch
/**
* Begin processing requests via this Connector.
*
* @exception LifecycleException if a fatal startup error occurs
*/
@Override
protected void startInternal() throws LifecycleException {
// Validate settings before starting
if (getPort() < 0) {
throw new LifecycleException(sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPort())));
}
setState(LifecycleState.STARTING);
try {
protocolHandler.start();
} catch (Exception e) {
String errPrefix = "";
if (this.service != null) {
errPrefix += "service.getName(): \"" + this.service.getName() + "\"; ";
}
throw new LifecycleException(errPrefix + " " + sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
}
mapperListener.start();
}
17
Source : StandardManager.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
super.startInternal();
// Load unloaded sessions, if any
try {
load();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("standardManager.managerLoad"), t);
}
setState(LifecycleState.STARTING);
}
17
Source : DeltaManager.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component 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 synchronized void startInternal() throws LifecycleException {
super.startInternal();
// Load unloaded sessions, if any
try {
if (cluster == null) {
log.error(sm.getString("deltaManager.noCluster", getName()));
return;
} else {
if (log.isInfoEnabled()) {
String type = "unknown";
if (cluster.getContainer() instanceof Host) {
type = "Host";
} else if (cluster.getContainer() instanceof Engine) {
type = "Engine";
}
log.info(sm.getString("deltaManager.registerCluster", getName(), type, cluster.getClusterName()));
}
}
if (log.isInfoEnabled())
log.info(sm.getString("deltaManager.startClustering", getName()));
getAllClusterSessions();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error(sm.getString("deltaManager.managerLoad"), t);
}
setState(LifecycleState.STARTING);
}
17
Source : StandardPipeline.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start {@link Valve}s) in this pipeline and implement the requirements of
* {@link LifecycleBase#startInternal()}.
*
* @exception LifecycleException
* if this component detects a fatal error that prevents this
* component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
// Start the Valves in our pipeline (including the basic), if any
Valve current = first;
if (current == null) {
current = basic;
}
while (current != null) {
if (current instanceof Lifecycle)
((Lifecycle) current).start();
current = current.getNext();
}
setState(LifecycleState.STARTING);
}
17
Source : Connector.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Begin processing requests via this Connector.
*
* @exception LifecycleException
* if a fatal startup error occurs
*/
@Override
protected void startInternal() throws LifecycleException {
// Validate settings before starting
if (getPort() < 0) {
throw new LifecycleException(sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPort())));
}
setState(LifecycleState.STARTING);
try {
protocolHandler.start();
} catch (Exception e) {
String errPrefix = "";
if (this.service != null) {
errPrefix += "service.getName(): \"" + this.service.getName() + "\"; ";
}
throw new LifecycleException(errPrefix + " " + sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
}
mapperListener.start();
}
17
Source : StandardServer.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
/**
* Start nested components ({@link Service}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 {
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
setState(LifecycleState.STARTING);
globalNamingResources.start();
// Start our defined Services
synchronized (servicesLock) {
for (int i = 0; i < services.length; i++) {
services[i].start();
}
}
if (periodicEventDelay > 0) {
monitorFuture = getUtilityExecutor().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
startPeriodicLifecycleEvent();
}
}, 0, 60, TimeUnit.SECONDS);
}
}
17
Source : Connector.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
/**
* Begin processing requests via this Connector.
*
* @exception LifecycleException if a fatal startup error occurs
*/
@Override
protected void startInternal() throws LifecycleException {
// Validate settings before starting
if (getPortWithOffset() < 0) {
throw new LifecycleException(sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPortWithOffset())));
}
setState(LifecycleState.STARTING);
try {
protocolHandler.start();
} catch (Exception e) {
throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
}
}
17
Source : StandardServer.java
with MIT License
from chenmudu
with MIT License
from chenmudu
/**
* 1.BootStrap反射调用Catalina的start。
* 2.Catalina去调用了StandardServer的start方法。
* 此方法就是Catalina的start方法。他会去调用StandardService的方法。
* {@link StandardService#startInternal()}
* Start nested components ({@link Service}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 {
/**
* 注册生命周期事件给当前所有监听器。
*/
fireLifecycleEvent(CONFIGURE_START_EVENT, null);
/**
* 设置自身对应状态
*/
setState(LifecycleState.STARTING);
/**
* NamingResourcesImpl
* {@link NamingResourcesImpl#startInternal()}
*/
globalNamingResources.start();
// Start our defined Services
/**
* 注册所有的服务。
* 1.{@link StandardService#startInternal()}
*/
synchronized (servicesLock) {
for (int i = 0; i < services.length; i++) {
services[i].start();
}
}
}
17
Source : Connector.java
with MIT License
from chenmudu
with MIT License
from chenmudu
/**
* Begin processing requests via this Connector.
*
* 开始通过此连接器处理请求。
*
* @exception LifecycleException if a fatal startup error occurs
*/
@Override
protected void startInternal() throws LifecycleException {
// Validate settings before starting
if (getPort() < 0) {
throw new LifecycleException(sm.getString("coyoteConnector.invalidPort", Integer.valueOf(getPort())));
}
setState(LifecycleState.STARTING);
try {
/**
* {Http11NioProtocol}
* {@link AbstractProtocol#start()}
*/
protocolHandler.start();
} catch (Exception e) {
throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
}
}
16
Source : Embedded.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
// ------------------------------------------------------ Lifecycle Methods
/**
* Start nested components ({@link Connector}s and {@link Engine}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("Starting tomcat server");
// Validate the setup of our required system properties
initDirs();
// Initialize some naming specific properties
initNaming();
setState(LifecycleState.STARTING);
// Start our defined Engines first
for (int i = 0; i < engines.length; i++) {
engines[i].start();
}
// Start our defined Connectors second
for (int i = 0; i < connectors.length; i++) {
((Lifecycle) connectors[i]).start();
}
}
16
Source : BackupManager.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* Starts the cluster communication channel, this will connect with the
* other nodes in the cluster, and request the current session state to be
* transferred to this node.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
try {
if (cluster == null)
throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
LazyReplicatedMap<String, Session> map = new LazyReplicatedMap<String, Session>(this, cluster.getChannel(), rpcTimeout, getMapName(), getClreplacedLoaders(), terminateOnStartFailure);
map.setChannelSendOptions(mapSendOptions);
this.sessions = map;
} catch (Exception x) {
log.error(sm.getString("backupManager.startUnable", getName()), x);
throw new LifecycleException(sm.getString("backupManager.startFailed", getName()), x);
}
setState(LifecycleState.STARTING);
}
16
Source : StandardThreadExecutor.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start the component 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 {
taskqueue = new TaskQueue(maxQueueSize);
TaskThreadFactory tf = new TaskThreadFactory(namePrefix, daemon, getThreadPriority());
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS, taskqueue, tf);
executor.setThreadRenewalDelay(threadRenewalDelay);
if (prestartminSpareThreads) {
executor.prestartAllCoreThreads();
}
taskqueue.setParent(executor);
setState(LifecycleState.STARTING);
}
16
Source : Embedded.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
// ------------------------------------------------------ Lifecycle Methods
/**
* Start nested components ({@link Connector}s and {@link Engine}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("Starting tomcat server");
// Validate the setup of our required system properties
initDirs();
// Initialize some naming specific properties
initNaming();
setState(LifecycleState.STARTING);
// Start our defined Engines first
for (int i = 0; i < engines.length; i++) {
engines[i].start();
}
// Start our defined Connectors second
for (int i = 0; i < connectors.length; i++) {
((Lifecycle) connectors[i]).start();
}
}
16
Source : StandardThreadExecutor.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start the component 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 {
taskqueue = new TaskQueue(maxQueueSize);
TaskThreadFactory tf = new TaskThreadFactory(namePrefix, daemon, getThreadPriority());
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS, taskqueue, tf);
executor.setThreadRenewalDelay(threadRenewalDelay);
if (prestartminSpareThreads) {
executor.prestartAllCoreThreads();
}
taskqueue.setParent(executor);
setState(LifecycleState.STARTING);
}
16
Source : StandardThreadExecutor.java
with MIT License
from chenmudu
with MIT License
from chenmudu
/**
* Start the component 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 {
// 重写了LinkedBlockingQueue的offer方法。
taskqueue = new TaskQueue(maxQueueSize);
TaskThreadFactory tf = new TaskThreadFactory(namePrefix, daemon, getThreadPriority());
// 此ThreadPoolExecutor非彼ThreadPoolExecutor。
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS, taskqueue, tf);
executor.setThreadRenewalDelay(threadRenewalDelay);
if (prestartminSpareThreads) {
executor.prestartAllCoreThreads();
}
taskqueue.setParent(executor);
setState(LifecycleState.STARTING);
}
15
Source : MapperListener.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
// ------------------------------------------------------- Lifecycle Methods
@Override
public void startInternal() throws LifecycleException {
setState(LifecycleState.STARTING);
// Find any components that have already been initialized since the
// MBean listener won't be notified as those components will have
// already registered their MBeans
findDefaultHost();
Engine engine = (Engine) connector.getService().getContainer();
addListeners(engine);
Container[] conHosts = engine.findChildren();
for (Container conHost : conHosts) {
Host host = (Host) conHost;
if (!LifecycleState.NEW.equals(host.getState())) {
// Registering the host will register the context and wrappers
registerHost(host);
}
}
}
15
Source : BackupManager.java
with Apache License 2.0
from how2j
with Apache License 2.0
from how2j
/**
* Start this component and implement the requirements of
* {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* Starts the cluster communication channel, this will connect with the
* other nodes in the cluster, and request the current session state to be
* transferred to this node.
*
* @exception LifecycleException
* if this component detects a fatal error that prevents this
* component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
try {
if (cluster == null)
throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
LazyReplicatedMap<String, Session> map = new LazyReplicatedMap<String, Session>(this, cluster.getChannel(), rpcTimeout, getMapName(), getClreplacedLoaders(), terminateOnStartFailure);
map.setChannelSendOptions(mapSendOptions);
map.setAccessTimeout(accessTimeout);
this.sessions = map;
} catch (Exception x) {
log.error(sm.getString("backupManager.startUnable", getName()), x);
throw new LifecycleException(sm.getString("backupManager.startFailed", getName()), x);
}
setState(LifecycleState.STARTING);
}
15
Source : WebappLoader.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
/**
* Start replacedociated {@link ClreplacedLoader} 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.isDebugEnabled())
log.debug(sm.getString("webappLoader.starting"));
if (context.getResources() == null) {
log.info(sm.getString("webappLoader.noResources", context));
setState(LifecycleState.STARTING);
return;
}
// Construct a clreplaced loader based on our current repositories list
try {
clreplacedLoader = createClreplacedLoader();
clreplacedLoader.setResources(context.getResources());
clreplacedLoader.setDelegate(this.delegate);
// Configure our repositories
setClreplacedPath();
setPermissions();
clreplacedLoader.start();
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" + clreplacedLoader.getClreplaced().getSimpleName() + ",host=" + context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null).registerComponent(clreplacedLoader, cloname, null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
throw new LifecycleException(sm.getString("webappLoader.startError"), t);
}
setState(LifecycleState.STARTING);
}
15
Source : BackupManager.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
/**
* Start this component and implement the requirements
* of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
*
* Starts the cluster communication channel, this will connect with the
* other nodes in the cluster, and request the current session state to be
* transferred to this node.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
try {
if (cluster == null)
throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
LazyReplicatedMap<String, Session> map = new LazyReplicatedMap<>(this, cluster.getChannel(), rpcTimeout, getMapName(), getClreplacedLoaders(), terminateOnStartFailure);
map.setChannelSendOptions(mapSendOptions);
map.setAccessTimeout(accessTimeout);
this.sessions = map;
} catch (Exception x) {
log.error(sm.getString("backupManager.startUnable", getName()), x);
throw new LifecycleException(sm.getString("backupManager.startFailed", getName()), x);
}
setState(LifecycleState.STARTING);
}
15
Source : WebappLoader.java
with MIT License
from chenmudu
with MIT License
from chenmudu
/**
* Start replacedociated {@link ClreplacedLoader} 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.isDebugEnabled())
log.debug(sm.getString("webappLoader.starting"));
if (context.getResources() == null) {
log.info("No resources for " + context);
setState(LifecycleState.STARTING);
return;
}
// Construct a clreplaced loader based on our current repositories list
try {
clreplacedLoader = createClreplacedLoader();
clreplacedLoader.setResources(context.getResources());
clreplacedLoader.setDelegate(this.delegate);
// Configure our repositories
setClreplacedPath();
setPermissions();
((Lifecycle) clreplacedLoader).start();
String contextName = context.getName();
if (!contextName.startsWith("/")) {
contextName = "/" + contextName;
}
ObjectName cloname = new ObjectName(context.getDomain() + ":type=" + clreplacedLoader.getClreplaced().getSimpleName() + ",host=" + context.getParent().getName() + ",context=" + contextName);
Registry.getRegistry(null, null).registerComponent(clreplacedLoader, cloname, null);
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
log.error("LifecycleException ", t);
throw new LifecycleException("start: ", t);
}
setState(LifecycleState.STARTING);
}
14
Source : SimpleTcpCluster.java
with Apache License 2.0
from wangyingjie
with Apache License 2.0
from wangyingjie
/**
* Start Cluster 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("Cluster is about to start");
try {
checkDefaults();
registerClusterValve();
channel.addMembershipListener(this);
channel.addChannelListener(this);
if (channel instanceof GroupChannel)
((GroupChannel) channel).setName(getClusterName() + "-Channel");
channel.start(channelStartOptions);
if (clusterDeployer != null)
clusterDeployer.start();
registerMember(channel.getLocalMember(false));
} catch (Exception x) {
log.error("Unable to start cluster.", x);
throw new LifecycleException(x);
}
setState(LifecycleState.STARTING);
}
14
Source : SimpleTcpCluster.java
with Apache License 2.0
from tryandcatch
with Apache License 2.0
from tryandcatch
/**
* Start Cluster 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("Cluster is about to start");
try {
checkDefaults();
registerClusterValve();
channel.addMembershipListener(this);
channel.addChannelListener(this);
channel.start(channelStartOptions);
if (clusterDeployer != null)
clusterDeployer.start();
registerMember(channel.getLocalMember(false));
} catch (Exception x) {
log.error("Unable to start cluster.", x);
throw new LifecycleException(x);
}
setState(LifecycleState.STARTING);
}
14
Source : StandardService.java
with Apache License 2.0
from tryandcatch
with Apache License 2.0
from tryandcatch
/**
* 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 (connectors) {
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);
}
}
}
}
14
Source : 1359.java
with MIT License
from masud-technope
with MIT License
from masud-technope
/**
* 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);
}
}
}
}
See More Examples