Coding Best Practices
The following tips will help achieve the best performance, the best security, and the easiest maintenance...
These are from the experts:
- At most, obtain a single connection from the database connection pool; multiple connections can result in a deadlock
- Instead of using servletContext.getRealPath("/"), use servletContext.getResource("/"); This avoids errors when containers return null
- Assume that no data can be written to the deployed webapp directory; instead use the fileLibrary and write servlet actions to stream data to and from the location
- Avoid thread locking in loops -- make the variable that the loop depends upon "volatile"; additionally add a sleep in the waiting loop
Sign in to add your comment.