/** *CreateanewStandardEnginecomponentwiththedefaultbasicValve.
*/ public StandardEngine() {
pipeline.setBasic(new StandardEngineValve()); // By default, the engine will hold the reloading thread
backgroundProcessorDelay = 10;
}
/** *ObtaintheconfiguredRealmandprovideadefaultRealmimplementationwhennoexplicitconfigurationisset. * *@returnconfiguredrealm,ora{@linkNullRealm}bydefault
*/
@Override public Realm getRealm() {
Realm configured = super.getRealm(); // If no set realm has been called - default to NullRealm // This can be overridden at engine, context and host level if (configured == null) {
configured = new NullRealm(); this.setRealm(configured);
} return configured;
}
@Override protectedvoid initInternal() throws LifecycleException { // Ensure that a Realm is present before any attempt is made to start // one. This will create the default NullRealm if necessary.
getRealm(); super.initInternal();
}
if (!logged && useDefault) {
AccessLog newDefaultAccessLog = defaultAccessLog.get(); if (newDefaultAccessLog == null) { // If we reached this point, this Engine can't have an AccessLog // Look in the defaultHost
Host host = (Host) findChild(getDefaultHost());
Context context = null; if (host != null && host.getState().isAvailable()) {
newDefaultAccessLog = host.getAccessLog();
if (newDefaultAccessLog != null) { if (defaultAccessLog.compareAndSet(null, newDefaultAccessLog)) {
AccessLogListener l = new AccessLogListener(this, host, null);
l.install();
}
} else { // Try the ROOT context of default host
context = (Context) host.findChild(""); if (context != null && context.getState().isAvailable()) {
newDefaultAccessLog = context.getAccessLog(); if (newDefaultAccessLog != null) { if (defaultAccessLog.compareAndSet(null, newDefaultAccessLog)) {
AccessLogListener l = new AccessLogListener(this, null, context);
l.install();
}
}
}
}
}
if (newDefaultAccessLog == null) {
newDefaultAccessLog = new NoopAccessLog(); if (defaultAccessLog.compareAndSet(null, newDefaultAccessLog)) {
AccessLogListener l = new AccessLogListener(this, host, context);
l.install();
}
}
}
/** *Returntheparentclassloaderforthiscomponent.
*/
@Override public ClassLoader getParentClassLoader() { if (parentClassLoader != null) { return parentClassLoader;
} if (service != null) { return service.getParentClassLoader();
} return ClassLoader.getSystemClassLoader();
}
@Override public File getCatalinaBase() { if (service != null) {
Server s = service.getServer(); if (s != null) {
File base = s.getCatalinaBase(); if (base != null) { return base;
}
}
} // Fall-back returnsuper.getCatalinaBase();
}
@Override public File getCatalinaHome() { if (service != null) {
Server s = service.getServer(); if (s != null) {
File base = s.getCatalinaHome(); if (base != null) { return base;
}
}
} // Fall-back returnsuper.getCatalinaHome();
}
@Override publicvoid lifecycleEvent(LifecycleEvent event) { if (disabled) { return;
}
String type = event.getType(); if (AFTER_START_EVENT.equals(type) || BEFORE_STOP_EVENT.equals(type) || BEFORE_DESTROY_EVENT.equals(type)) { // Container is being started/stopped/removed // Force re-calculation and disable listener since it won't // be re-used
engine.defaultAccessLog.set(null);
uninstall();
}
}
@Override publicvoid propertyChange(PropertyChangeEvent evt) { if (disabled) { return;
} if ("defaultHost".equals(evt.getPropertyName())) { // Force re-calculation and disable listener since it won't // be re-used
engine.defaultAccessLog.set(null);
uninstall();
}
}
@Override publicvoid containerEvent(ContainerEvent event) { // Only useful for hosts if (disabled) { return;
} if (ADD_CHILD_EVENT.equals(event.getType())) {
Context context = (Context) event.getData(); if (context.getPath().isEmpty()) { // Force re-calculation and disable listener since it won't // be re-used
engine.defaultAccessLog.set(null);
uninstall();
}
}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.