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协议是什么?