一、前言
关于apache的jasper-runtime源码包org.apache.jasper.util.Queue队列,依赖java.util.Vector实现主要功能,详情见源码说明部分。
二、源码说明
package org.apache.jasper.util;@b@@b@import java.util.Vector;@b@@b@public class Queue@b@{@b@ private Vector vector;@b@@b@ public Queue()@b@ {@b@ this.vector = new Vector();@b@ }@b@@b@ public synchronized void put(Object object)@b@ {@b@ this.vector.addElement(object);@b@ super.notify();@b@ }@b@@b@ public synchronized Object pull()@b@ {@b@ if (isEmpty())@b@ try {@b@ super.wait();@b@ } catch (InterruptedException ex) {@b@ }@b@ return get();@b@ }@b@@b@ public synchronized Object get()@b@ {@b@ Object object = peek();@b@ if (object != null)@b@ this.vector.removeElementAt(0);@b@ return object;@b@ }@b@@b@ public Object peek()@b@ {@b@ if (isEmpty())@b@ return null;@b@ return this.vector.elementAt(0);@b@ }@b@@b@ public boolean isEmpty()@b@ {@b@ return this.vector.isEmpty();@b@ }@b@@b@ public int size()@b@ {@b@ return this.vector.size();@b@ }@b@}