1. tomcat類加載機制,爲什麼要違背雙親委託機制(線程上下文類加載器)
線程上下文類加載器是指調用方法當前類隊員的類加載器。parant類加載器去請求子加載器加載某些依賴的jar
4. tomcat之valve機制
5. tomcat之容器類分析
Engine:org.apache.catalina.core.StandardEngine
Host: org.apache.catalina.core.StandardHost
Context:org.apache.catalina.core.StandardContext
Wrapper:org.apache.catalina.core.StandardWrapper
6. tomcat處理一個http請求的過程
7. tomcat對url的編解碼過程
8. tomcat8對cookie的處理
9. tomcat初始化與啓動
10. tomcat是怎麼實現的熱部署
1)Classloader重寫,通過自定義classloader加載相應的jsp編譯後的class到JVM中。
2)通過動態修改內存中的字節碼,將修改過的class再次裝載到JVM中。
web容器和servlet容器的區別是什麼;
在springMVC中的web.xml是什麼時候加載到tomcat中的;
tomcat是怎麼加載我們的web服務的;
一個http請求是怎麼被tomcat監聽到的,會有哪些處理;
爲什麼請求可以有需要通過nginx的,也可以不需要nginx的直接請求到tomcat上?
11. CopyOnWriteArrayList原理
12. 併發鎖ReentrantReadWriteLock
13. 正則
private static final Pattern PATH_PATTERN = Pattern.compile("(\".*?\")|(([^,])*)");
14 tomcat默認啓動參數
connector默認值: 10000
public LimitLatch(long limit) {
this.limit = limit;
this.count = new AtomicLong(0);
this.sync = new Sync();
}
private SynchronizedStack<PollerEvent> eventCache;
默認128
工作線程數 最小空閒10個,最大200個
public void createExecutor() {
internalExecutor = true;
TaskQueue taskqueue = new TaskQueue();
TaskThreadFactory tf = new TaskThreadFactory(getName() + "-exec-", daemon, getThreadPriority());
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), 60, TimeUnit.SECONDS,taskqueue, tf);
taskqueue.setParent( (ThreadPoolExecutor) executor);
}
TaskQueue
@Override
public boolean offer(Runnable o) {
//we can't do any checks
if (parent==null) return super.offer(o);
//we are maxed out on threads, simply queue the object
if (parent.getPoolSize() == parent.getMaximumPoolSize()) return super.offer(o);
//we have idle threads, just add it to the queue
if (parent.getSubmittedCount()<=(parent.getPoolSize())) return super.offer(o);
//if we have less threads than maximum force creation of a new thread
if (parent.getPoolSize()<parent.getMaximumPoolSize()) return false;
//if we reached here, we need to add it to the queue
return super.offer(o);
}
Poller線程
poller = new Poller();
Thread pollerThread = new Thread(poller, getName() + "-ClientPoller");
pollerThread.setPriority(threadPriority);
pollerThread.setDaemon(true);
pollerThread.start();
15. AJP協議是什麼?