Skip to main content

Posts

Showing posts with the label Pooling

Differences between Caching and Pooling in Java

Caching equals pools of objects with state, i.e. sessions & EJB. You need a specific instance however. Pooling gives any instance and no particular state is required, i.e. JDBC, threads and servlets. -------------------------------------------------------------------------------------------------------- Caching means you keep the old data but do not get new data. Pooling means you check for new ones and retrieve them at periodic intervals. -------------------------------------------------------------------------------------------------------- A pool is a collection of stateless objects. A cache is a collection of stateful objects. The main distinction between a cache and a pool is what is contained in them. In other words, when you retrieve an object from a cache or a pool, do you need a specific object, or will any object do? If you need a specific object, then each object maintains state; hence, you need to use a cache. If, on the other hand, you can use any objec...

XML Binding with JAXB 2.0 - Tutorial

Java Architecture for XML Binding (JAXB) is an API/framework that binds XML schema to Java representations. Java objects may then subsequently be used to marshal or unmarshal XML documents. Marshalling an XML document means creating an XML document from Java objects. Unmarshalling means creating creating a Java representation of an XML document (or, in effect, the reverse of marshaling). You retrieve the element and attribute values of the XML document from the Java representation. The JAXB 2.0 specification is implemented in JWSDP 2.0. JAXB 2.0 has some new features, which facilitate the marshalling and unmarshalling of an XML document. JAXB 2.0 also allows you to map a Java object to an XML document or an XML Schema. Some of the new features in JAXB 2.0 include: Smaller runtime libraries are required for JAXB 2.0, which require lesser runtime memory. Significantly, fewer Java classes are generated from a schema, compared to JAXB 1.0. For each top-level complexType, 2.0 generates a v...