Wednesday, April 30, 2008

A quik IPL

1. IPL is fun.
2. Royal Bangalore team needs a Captain.
3. Mumbai Indians? Who are they?
4. Only Rajasthan Royals look like one team.
5. Deccan Chargers need to kick Laxman out.
6. Daredevils is a balanced team.
7. And why is Chennai Super Kings winning? They wear Yellow ;)

Thursday, April 24, 2008

Sorry, I could not find India

India as we assume sitting in US is of a nation of mild mannered, Cricket crazy, Helmet wearing IT savvy bunch, busy with the mantra of development. Sorry! I did not find that India. What I found instead was a morning newspaper filled with sickening news. A pregnant woman dying on the streets denied Hospital services, a sitting MLA injured by a crude bomb attack, corruption, Poisonous measles shots killing infants, Irrelevant political raking and Channels filled with only and only "Sansanikhej" negativities. The colors we see on TV are mostly confined to Bollywood dramas. What I met instead were social chauvinists, poor service providers, crippled human values and power hungry goons. I thought of seeing roaring Tigers instead I found opportunistic hyenas. Or may be its just that my India is different from your India.

Tuesday, April 15, 2008

Direct line to God

Sen. Obama, I do have a direct line to God too but its always "Leave me a voice mail after the weep."

Friday, April 11, 2008

Is it possible in MapListener? Yes, But...

It is interesting to find how Oracle Coherence is evolving and is being used to address some of the most critical problems of early 2000. The speed and areas it is being adopted I am not sure how long "It is not a database, It is not an Application server..." statement will hold true in future. The issues of Transaction integrity, multi-Table operations and off-loaded processing of yesteryears are now being done on Grid with operations spanning across multiple Caches with event driven architecture.
One common problem we deal with is when the Grid is being used by multiple independent applications but actions are to be performed based on events inside the Cache. Something like data needs to be put in Cache(2) based on an entry inserted in another Cache(1) by a different application. Similar to database events Coherence supports Map Listeners that listen to Cache events like Entry Inserted, updated or removed events. Following is a sample code:



NamedCache nCache = CacheFactory.getCache ("Cache1");
nCache.addMapListener (new MyListener ());

...
public class MyListener implements MapListener {
private NamedCache nCache = CacheFactory.getCache ("Cache2");

public void entryInserted (MapEvent m_event) {
Object key = ...;
Object value = ...;
nCache.put (key, value);
}
....
}



Now the fun part - Letting the Grid do it. What if Grid itself takes an action when an Entry is inserted, updated or deleted? Making Coherence Grid from an infrastructural resource to a self-contained processing unit. A "data oracle" that knows what it needs to do with data besides efficiently managing it. Now lets take a little detour here...
Who can listen to events? Someone who has "access" to where the events are happening, right? MapListeners that listen to Cache events can be added programatically to a Cache as shown above and can also be configured to listen to Backing Maps. Backing Maps are the components that manage data on each individual nodes of the cluster (one for each). In general mentioning a MapListener means the ones added to the NamedCache object. Listeners configured to listen to local events of Backing Maps are called Backing Map Listeners even though the same Listener instance can be used in either of the two. Backing Map Listeners can be configured in the coherence-cache-config.xml as shown below:


<read-write-backing-map-scheme>
<scheme-name>my-rw-bm</scheme-name>
<!-- unlimited capacity internal cache -->
<internal-cache-scheme>
<local-scheme>
</local-scheme>
</internal-cache-scheme>
<cachestore-scheme>
...
</cachestore-scheme>
<listener>
<class-scheme>
<class-name>MyListener</class-name>
</class-scheme>
</listener>
</read-write-backing-map-scheme>


With the above configuration MyListener instance on that node will listen to the local events generated by the backing map. The problem is now that the above implementation of MyListener will not work due to Thread issues. Multiple cache access can not be performed with in the same Thread which for BackingMap listener is an issue. To make this happen a separate Thread needs to be spawned from with in the MyListener to be able to access another Cache while listening to events from another.
So Yes, it is possible to do "that" what you want to do But, be a little careful.

Tuesday, April 01, 2008

Shoab has decided to take Indian Citizenship

After being banned for 5years by Pakistani Cricket Board, Speedster Shoab Akhtar has decided to take Indian citizenship and call Bombay (Mumbai) his new home. In an exclusive interview he said he does not care about PCB anyway as he will make ample of amount of money in ICL. Welcome home Shoab!