1 12 package org.eclipse.equinox.http.servlet.internal; 13 14 import java.io.IOException ; 15 import javax.servlet.ServletException ; 16 import javax.servlet.http.HttpServletRequest ; 17 import javax.servlet.http.HttpServletResponse ; 18 19 public abstract class Registration { 20 21 protected int referenceCount; 22 23 public synchronized void addReference() { 24 ++referenceCount; 25 } 26 27 public synchronized void removeReference() { 28 --referenceCount; 29 if (referenceCount == 0) { 30 notifyAll(); 31 } 32 } 33 34 public synchronized void destroy() { 35 boolean interrupted = false; 36 try { 37 while (referenceCount != 0) { 38 try { 39 wait(); 40 } catch (InterruptedException e) { 41 interrupted = true; 43 } 44 } 45 } finally { 46 if (interrupted) 47 Thread.currentThread().interrupt(); } 49 } 50 51 public abstract boolean handleRequest(HttpServletRequest req, HttpServletResponse resp, String alias) throws IOException , ServletException ; 52 53 public void close() { 54 } 56 57 } 58 | Popular Tags |