之前在 Windows 里用 vmware workstation 搭了个黑裙,然后硬盘直通,硬盘跑着倒还好,但是宿主机 Windows 隔一段时间就会重启,就去搜索了下,发现其实 Windows 里的事件查看器就有点像是 Linux 系统里的 dmesg 或者 journal 日志,然后根据重启的时间排查事件查看器里,Windows 日志 –> 系统,
// Process the request in the adapter if (getErrorState().isIoAllowed()) { try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); getAdapter().service(request, response);
然后到 coyoteAdapter 的 service org.apache.catalina.connector.CoyoteAdapter#service
1 2 3 4 5 6 7 8 9 10 11 12 13
try { // Parse and set Catalina and configuration specific // request parameters postParseSuccess = postParseRequest(req, request, res, response); if (postParseSuccess) { //check valves if we support async request.setAsyncSupported( connector.getService().getContainer().getPipeline().isAsyncSupported()); // Calling the container // ----------> 到这就是调用 pipeline 去处理了,我们要关注上面的 postParseRequest connector.getService().getContainer().getPipeline().getFirst().invoke( request, response); }
while (mapRequired) { // This will map the the latest version by default connector.getService().getMapper().map(serverName, decodedURI, version, request.getMappingData());
// If there is no context at this point, either this is a 404 // because no ROOT context has been deployed or the URI was invalid // so no context could be mapped. if (request.getContext() == null) { // Allow processing to continue.
if (contextVersion == null) { // Return the latest version // The versions array is known to contain at least one element contextVersion = contextVersions[versionCount - 1]; } mappingData.context = contextVersion.object;
然后是 wrapper
1 2 3 4
// Wrapper mapping if (!contextVersion.isPaused()) { internalMapWrapper(contextVersion, uri, mappingData); }
Engineengine= service.getContainer(); if (engine == null) { return; }
findDefaultHost();
addListeners(engine);
Container[] conHosts = engine.findChildren(); for (Container conHost : conHosts) { Hosthost= (Host) conHost; if (!LifecycleState.NEW.equals(host.getState())) { // Registering the host will register the context and wrappers registerHost(host); } } }
/** * The ContainerEvent event type sent when a valve is added * by <code>addValve()</code>, if this Container supports pipelines. */ publicstaticfinalStringADD_VALVE_EVENT="addValve";
/** * The ContainerEvent event type sent when a child container is removed * by <code>removeChild()</code>. */ publicstaticfinalStringREMOVE_CHILD_EVENT="removeChild";
/** * The ContainerEvent event type sent when a valve is removed * by <code>removeValve()</code>, if this Container supports pipelines. */ publicstaticfinalStringREMOVE_VALVE_EVENT="removeValve";
// Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle && ((Lifecycle) pipeline).getState().isAvailable()) { ((Lifecycle) pipeline).stop(); }
// Stop our child containers, if any Container children[] = findChildren(); List<Future<Void>> results = newArrayList<>(); for (Container child : children) { results.add(startStopExecutor.submit(newStopChild(child))); }
booleanfail=false; for (Future<Void> result : results) { try { result.get(); } catch (Exception e) { log.error(sm.getString("containerBase.threadedStopFailed"), e); fail = true; } } if (fail) { thrownewLifecycleException( sm.getString("containerBase.threadedStopFailed")); }
// Stop our subordinate components, if any Realmrealm= getRealmInternal(); if (realm instanceof Lifecycle) { ((Lifecycle) realm).stop(); } Clustercluster= getClusterInternal(); if (cluster instanceof Lifecycle) { ((Lifecycle) cluster).stop(); } }