On persistent storage

A next good skill to learn would be how to add persistence to the data used by a service. For example, in the case study we implemented here, a persistent storage service would allow us to keep the Book data entries between platform restarts. It would also allow us to significantly improve search performance.

Generally, there are a few available choices for storage; the selection of the one to use depends a lot on the application's requirements.

For example, in scenarios where fast and frequent reads are needed with relatively infrequent writes that are allowed to be slower, then a good choice would be a Java Naming and Directory Interface (JNDI) service connection to a naming directory provider (LDAP, DNS, and so on). This choice is especially useful when this data needs to be read by distributed remote parties (for example, user authentication services).

In scenarios where complex searches and frequent updates are required, a relational database could be a better choice, using a Java Database Connectivity (JDBC) service connected to relational database (Oracle, MySQL, or HSQLDB, to name a few), or using a persistence framework (like Hibernate).

While looking at implementing persistence, you must also keep an eye on the potential need for transactionality of persistence operations. Transactional operations are a set of operations that are considered as a group, whereby the changes in the group are committed if all the operations in the group succeed, but they are all rolled back if one of them fails. A good place to start with this is by reading about the Java Transaction API (JTA).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.251.128