Caching facilitates faster access to data that is repeatedly being asked for. The data might have to be fetched from a database or have to be accessed over a network call or have to be calculated by an expensive computation. We can avoid multiple calls for these repeated data-asks by storing the data closer to the application (Generally, in memory or local disc). Of course, all of this comes at a cost. Continue reading
As we know, locks are generally used to monitor and control access to shared resources by multiple threads at the same time. They basically protect data integrity and atomicity in concurrent applications i.e. Only one thread at a time can acquire a lock on shared resource which otherwise is not accessible. But a lock in distributed environment is more than just a mutex in multi-threaded application. It is more complicated due to the fact that the lock has to be now acquired across all the nodes where as any of the nodes in the cluster or the network can fail.
In Relational Data Models, we model relation/table for every object in the domain. In case of Cassandra, this is not exactly the case.This post would elaborate more on what all aspects we need to consider while doing data modelling in Cassandra. Following is the rough overview of Cassandra Data Modeling. Continue reading
Here is how I started writing this article. I have read this statement so many times: “Cloning becomes difficult when the object has references to mutable final fields.” And every time I google about it, understand what exactly this means and as part of the process forget about it too. So thought I would blog this so that this will serve as my immediate reference.
Cloning an object, what I could recall from my OOP course in my graduate studies, is creating a similar copy of an object which basically should conform to the following rules:
(1) x.clone() != x
(2) x.clone().getClass() == x.getClass()
(3) x.clone().equals(x) Continue reading
Security tasks such as authentication of user and authorization of a user to view application resources are usually handled by the application server. These tasks can be delegated to Spring security flow relieving application server from handling these tasks. Spring security basically handles these tasks by implementing standard javax.servlet.Filter. Continue reading
As seen in the earlier article, using Constructor pattern and Prototype chaining on their own have got few problems. We resolved those problems by defining a new pattern which amalgamates both the patterns. If we look at the way we have been creating objects so far, it is very much similar to Java. In fact using new keyword sometimes makes the code more complex which we could have avoided using alternatives like Prototypal Inheritance. So the rest of article deals with how to achieve a better form of inheritance without using any new keyword. Also it addresses the issue of redundant properties(masked by the instance properties) on Prototype we have seen in Combination Inheritance. Continue reading
JMX defines an architecture for management and monitoring of long running Java applications. Simply put, it provides an interface for interacting with a running application. So through JMX, we can check/change the state of variables or to invoke a method in a (remote) running application via a management GUI such as JConsole. Continue reading