Showing posts from February, 2014

Basic Introduction to Apache Hadoop

Introduction to NoSQL by Martin Fowler

JMockit by Example

public class DBManager { public String retrieveAccountHolderName(int accountId) { String accountHolderName = null; // connect to db // retrieve the Account Holder Name return accountHolderName; } public static String getConnectionString() { return "ORIGINAL"; } } public class Bank { DBManager dbManager = new DBManager(); public String processAccount(int accountID) { // Some other code goes here String accountHolderName = dbManager .retrieveAccountHolderName(accountID); // some more processing code return accountHolderName; } public String getConnection() throws Exception { return "Connection"; // some thing here might throw an exception } public String makeConnection() { // some connection related code // goes here // call to static method String conStr = DBManager.getConnectionString(); // If the connection String // is anything other than // ORIGINAL return FAIL if (conStr.equals("ORIGINAL&quo…

The Internal Architecture of JVM

Excerpted from:  Java Virtual Machine components are depicted in below diagram. Each time we run java_application/java_class, an instance of JVM gets created. Class Loader Subsystem Class loader subsystem loads classes and interfaces with fully qualified names into the JVM. Execution Engine Execution Engine executes all instructions contained by methods of a loaded class. While executing a Java program, JVM requires memory for storing objects ,local variables, method arguments, return values, and intermediate computational results and JVM does that memory management on several runtime data areas. The specification of runtime data areas is quite abstract. This abstract nature of JVM specification helps different designers to provide implementation on wide variety of OS and as per choice of the designers. Some implementations may have a lot of memory in which to work, others may have very little. Some implementation…

Understanding Priority Inversion

Excerpted from:

Priority inversions The real trouble arises at run-time, when a medium-priority task preempts a lower-priority task using a shared resource on which the higher-priority task is pending. If the higher-priority task is otherwise ready to run, but a medium-priority task is currently running instead, a priority inversion is said to occur.
Figure 1 Priority inversion timeline This dangerous sequence of events is illustrated in Figure 1. Low-priority Task L and high-priority Task H share a resource. Shortly after Task L takes the resource, Task H becomes ready to run. However, Task H must wait for Task L to finish with the resource, so it pends. Before Task L finishes with the resource, Task M becomes ready to run, preempting Task L. While Task M (and perhaps additional intermediate-priority tasks) runs, Task H, the highest-priority task in the system, remains in a pending sta…

Java development IRC channel

I have joined the ##java on IRC server recently. I am using XChat IRC client with nick name rwatsh. We first need to register our nick name as follows (words in italics are the ones you need to change):

/msg NickServ REGISTER

Then you get a verification email on the above mentioned email address with the verification command which looks like:

/msg NickServ VERIFY REGISTER usernameabcdxxxx
After that, you can join the ##java channel on freenode. Its also the only channel for all things Java (so it includes SE, ME, EE).