You are currently browsing the daily archive for October 17, 2006.

1. To cache Java application, you have to solve all or some of those problems:

  • When should we cache?
  • How do we manage updated data?
  • How do we manage old data?
  • How do we manage concurrent access to our cache?

2. Antipattern
     a. Remove stale elements from cache.
     b. Capping the size doing something for garbage collection if memory becomes constrained.
     c.  Synchronized read/write bottleneck such as collision between readers, lockers allow shared access

package com.mth.cache;     

import java.uitl.*; 
import com.mth.cache.ShowBoardCommand;     

public class BoardCommandCache { 
   protected String cacheKey = null; 
   public boolean cached = false; 
   private ShowBoardCommand boardCommand = null; 
   private static Hashtable boardCache = null;     

   public initialize throws IOException, DataException { 
		   if(boardCache == null) { 
			   new Hashtable(); 

   public void invalidate(String key) { 

   public void execute() throws IOException, DataException { 
			   cached = true; 
			   Hashtable cache = getBoardCache(); 
			   if (cache == null) 
			      throw new Exception(); 
			   boardCommand = (ShowBoardCommand) cache.get(getBoard()); 
			   if(boardCommand == null){ 
				   boardCommand = new ShowBoardCommand(); 
				   cache.put(getBoard(), boardCommand); 
				   cached = false; 
		   }catch(Throwable theException){ 

   public String getBoard() { 
	   return cacheKey; 

   protected static Hashtable getBoardCahce(){ 
	   return boardCache; 
   //skip code... 

1. Java Practices
Concise presentations of java programming practices, tasks, and conventions, amply illustrated with syntax highlighted code examples.
2. Java API By Example, From Geeks To Geeks.
3. Java Examples in open source code. We search the java code of open source products to find the Java API examples you want to see. We also let you rate the examples so the best ones will come first in the search results.
4. Java Examples from The Java Developers Almanac 1.4 Code Examples from the Java Developers Almanac 1.4
5. [Real’s JAVA JAVASCRIPT PB and WSH How-to] Real’s JAVA JAVASCRIPT WSH and PowerBuilder How-to pages with useful code snippets
6. developerWorks : Java technology : Technical library view Browse the Java technology technical library view for technical articles and tips, tutorials, standards, and IBM Redbooks. View the list by product, title, topic, or keyword and sort your results.
7. codefetch{ A search engine lets you search computer books for source code in many languages, such as Java, C#, Python, HTML and CSS.
8. Hibernate Collection Mapping Map Java examples (example source code) Hibernate Collection Mapping Map : Java examples (example source code) » Hibernate » Map Map
9. Developer Fusion , Developer Fusion : The developer community for the UK. Thousands of free tutorials, articles, source code, components and source code for Visual Basic, ASP, .NET, C++, C#, XML, PHP, Web and Java programmers.
10. Google Code Search
11. Code Search – O’Reilly Labs
12. :: Quick API Search Quick API search for HTML, CSS, JavaScript, DOM, XSL, XPath, Schema, PHP, Ruby, Rails, MySQL, ActionScript, ColdFusion, Java and more.
13. Free Computer Books, Tutorials & Lecture Notes 
14. Docjar
15. Enterprsie Integration Patterns
16. Patterns of Enterprise Application Architecture (P of EAA)
17. Java and Software Engineering

  • Client-side networking
    • Socket
    • InetAddress
    • Port
  • Server-side networking
    • Internet protocals
    • ServerSocket
    • singlethreaded server
    • nonblocking server
    • multithreaded server
  • Web server (HTTP sever)
    • HTTP requests
    • HTTP responses
  • to be continue…

Most useful stream list

Bytes steam class:

  • InputStream/OutputStream 
  • FileInputStream/FileOutputStream
  • FilterInputStream/FilterOutputStream
  • DataInputStream/DataOutputStream
  • BufferedInputStream/BufferedOutputStream
  • PrintSteam

Memory I/O stream class:

  • ByteArrayInputStream/ByteArrayOutputStream
  • PipedInputStream/PipedOutputStream

Charactrt stream class:

  • Reader/Writer
  • InputStreamReader/OutputStreamWriter
  • FileReader/FileWriter
  • FilterReader/FilterWriter
  • BufferedReader/BufferedWriter
  • PrintWriter
  • PushbackReader

Object stream class:

  • ObjectInputStream/ObjectOutputStream
  • Interface Serializable
  • Interface Externalizable
  • Interface ObjectInputValidation
  • Class versioning