Saturday, May 19, 2007
Web Servers vs. App Servers
| These are two quite different pieces of software.There are few Web servers in common use: Apache takes the lion's share, while Microsoft Internet Information Server (IIS) and iPlanet Web Server are among the others. Application servers jumped into the limelight only about two years ago and there is a proliferation of products from companies such as BEA, iPlanet, Oracle, SilverStream, HP (Bluestone), and IBM. Speaking of functionality, in differentiating the two servers we have to say "in general" because there are customized versions of both Web and application servers that have crossover functionality. The Web server, in general, sends Web pages to browsers as its primary function. Most Web servers also process input from users, format data, provide security, and perform other tasks. The majority of a Web server's work is to execute HTML or scripting such as Perl, JavaScript, or VBScript. In general, an application server prepares material for the Web server -- for example, gathering data from databases, applying business rules, processing security clearances, or storing the state of a user's session. In some respects the term application server is misleading since the functionality isn't limited to applications. Its role is more as an aggregator and manager for data and processes used by anything running on a Web server. |
Where and how can you use a private constructor?
| Private constructor is used if you do not want other classes to instantiate the object. The instantiation is done by a public static method within the same class. 1. Used in the singleton pattern. (Refer Q45 in Java section). 2. Used in the factory method pattern (Refer Q46 in Java section). 3. Used in utility classes e.g. StringUtils etc. Why there are some interfaces with no defined methods (i.e. marker interfaces) in Java? The interfaces with no defined methods act like markers. They just tell the compiler that the objects of the classes implementing the interfaces with no defined methods need to be treated differently. Example Serializable, Cloneable etc The code in a finally clause will never fail to execute, right? Well, hardly ever. But here's an example where the finally code will not execute, regardless of the value of the boolean choice: try { if (choice) { while (true) ; } else { System.exit(1); } } finally {code.to.cleanup(); } |
Saturday, May 05, 2007
What are the benefits of the Java collection framework?
| Java Collection framework provides flexibility, performance, and robustness. 1.Polymorphic algorithms – sorting, shuffling, reversing, binary search etc. 2.Set algebra - such as finding subsets, intersections, and unions between objects. 3.Performance - collections have much better performance compared to the older Vector and Hashtable classes with the elimination of synchronization overheads. 4.Thread-safety - when synchronization is required, wrapper implementations are provided for temporarily synchronizing existing collection objects. 5.Immutability - when immutability is required wrapper implementations are provided for making a collection immutable. 6.Extensibility - interfaces and abstract classes provide an excellent starting point for adding functionality and features to create specialized object collections. |