Skip to Main Content
Hack Proofing Your Web Applications
book

Hack Proofing Your Web Applications

by Syngress
June 2001
Intermediate to advanced content levelIntermediate to advanced
512 pages
18h 49m
English
Syngress
Content preview from Hack Proofing Your Web Applications
288 Chapter 7 • Securing Your Java Code
private static int totalClients = 0;
public static ClientThread getInstance(Socket client) {
System.gc();
if(totalClients <= 100) {
++totalClients;
return new ClientThread(client);
}
return null;
}
private ClientThread(Socket client) {
// Constructor code here
}
public finalize() {
—totalClients;
}
}
As you can see, the constructor method has been made private, so
only this class can call the constructor. A private static integer keeps
track of the number of instances for this class. Of course, every time an
object is destroyed the class must keep track.This is a very effective
means of limiting the number of threads that a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Developer's Guide to Web Application Security

Developer's Guide to Web Application Security

Michael Cross
The CERT® Oracle® Secure Coding Standard for Java™

The CERT® Oracle® Secure Coding Standard for Java™

Fred Long, Dhruv Mohindra, Robert C. Seacord, Dean F. Sutherland, David Svoboda
Troubleshooting CentOS

Troubleshooting CentOS

Jonathan Hobson

Publisher Resources

ISBN: 9781928994312