class Semaphore {
private int count=100;
public Semaphore(int n) {
this.count = n;
}
public synchronized void acquire() {
while(count == 0) {
try {
wait();
} catch (InterruptedException e) {
}
}
count--;
}
public synchronized void release() {
count++;
notify();
}
}
I currently support 100 users. If the request comes from jsp (Client) and passes through this class, will there be Thread (request from JSP) waitand notifyautomatically?
source
share