Friday, February 27, 2009

Complex investigation, easy solution

Yesterday I was facing one production issue where somehow at some time the connection to a database which is located at another server will be reset. I was getting java.lang.SqlException(io exception: connection resrt). I have reused a method that will reconnect to the database. I hope it works in the next deployment and i believe it should work. Code snippet as below:



public Connection getDBConnection(String dbName) throws OracleConnException, Exception {
if (logger.isInfoEnabled()) {
logger.info("getDBConnection(String) - String dbName=" + dbName); //$NON-NLS-1$
}

Connection cachedConnection = null;
if (ocDataSource == null) {
ocDataSource = new HashMap();
this.printSQL("new HashMap");
}

OracleDataSource ds = (OracleDataSource) ocDataSource.get(dbName);

if(ds == null){
this.printSQL("creatingNewOracleDS");
ds = createNewOracleDS(dbName);
this.printSQL("createdNewOracleDS");
ocDataSource.put(dbName.trim(), ds);
}

int i = 0;
int retry = KenanAdaptorProperties.getORACLE_RETRY_NUM();

for(i = 0; i < retry; i++){
try {
this.printSQL("ds.getConnection() " + ds.getPortNumber());

cachedConnection = ds.getConnection();
this.printSQL("error in connection? ");

if(!isConnectionAlive(cachedConnection)){
this.printSQL("connection is not alive???");
try { ds.close(); } catch(Exception e){
//log.debug("Can't close DataSource object!");
}
ds = null;

ocDataSource.remove(dbName);

ds = createNewOracleDS(dbName);
ocDataSource.put(dbName, ds);
} else {
break;
}

} catch (SQLException se){
logger.error("getDBConnection(String)", se); //$NON-NLS-1$
} catch (Exception e){
this.printSQL("Exception:\r\n" + Util.getStackTraceForLog(e));
}

// sleep for a specific amount of time!
//make it configurable
try {
Thread.sleep(KenanAdaptorProperties.getORACLE_RETRY_SLEEP_TIME());
} catch (InterruptedException e) {
// log.debug("Interrupted Exception:\r\n" + Util.getStackTraceForLog(e));
}

}

if(i == retry){
throw new OracleConnException("Connection is not established. Failed after " + retry + " retries.");
}

return cachedConnection;
}

Tuesday, February 24, 2009

production rollout for Kenan Adapter running on Websphere Business Integration Adapters is successful!

Finally the production rollout for Kenan Adapter is successful!

This is the third deployment after the unsuccessful first two. Well it went well in spite of some minor issues. Most of the scenarios are catered this time. The client's testing team had done a good job this time for testing thoroughly on all kind of possible scenarios! Yeah they should have done that during the UAT time! If they would allocate some time for more scenario testing, the deployment would have gone well even before year 2009! No it's approaching March and the client only managed to use it now. Well, this project does not bring any income to my team anyway. My project manager took this project to cover up some other unit's shit. Now that the long term outsource deal has been closed.

I am studying Websphere Process Server now. It looks far more complicated. I think i need some time to digest some new terms here. I should get myself involved in at least one project related to this product so that i can gain more expertise in this product.

All in all, good news this week. I am glad especially for the successfull rollout for Kenan Adapter. I have put very much effort in making this successful. I would like to thank my project manager for the support! That is important to continue to boost my morale.

Friday, February 13, 2009

Terrible Project, Terrible Day

Bad news hit me last Thursday, i would have to help out in a Proof of Concept(POC) project for a famous Telco company in Malaysia!

I went to the meeting place in the morning. Met with new teammates. Obviously everyone was still trying to adapt to this adhoc situation.

On the first day, I was spending the whole day getting help from a few experts to set up the development and testing environment. They helped me to install IBM Websphere Portal Server, IBM Rational Software Architect for Websphere and etc. All these are resource hungry giants. They made the computer to run so slow! Also, in order to make sure i am developing on the same environment, they migrated their Virtual Machine Image to another laptop that has higher spec than my computer.

I started building simple stuff the second day. After several trials and errors, i managed to build and test run the first portlet! This is my first ever portlet that i built in my life! I was excited and i thought mission completed. Well, demand is never enough. I was assigned a few more tasks and my attendence was expected the next day.

On Friday the POC initiator expected to wrap up everything so that the sales team is able to present a nice thing to the potential client! I was thinking things were done so hurrily the quality will surely does not meet client's expectation. In the end i managed to built 4 portlets: some with static data, some queries data from the DB2 database. During the migration of my war file to the core laptop which one of the technical sales guy is going to use to present to the client, i was facing some database connection issue. Well that was easily solved. After that i was asked to enhance the UI on the portlet. Man! what is this! The scope of work will never end?! It's too much!

I kept quiet and finally completed my tasks at 2am in the morning. After that the technical sales guy was able to ping from A machine's VM to B machine's VM! Double good news! He said i stayed to help and that boost his morale and actually i did not find out the solution. It's him who found it.

I learnt a lot of things in this POC project. I learned how to use Rational Software Architect for Websphere to build portlet. I learned how to deploy a portlet using Websphere Portal Server. Also i have explored a few good features in the WPS. I also learned a lot of things on Virtual Machine. The idea of using Virtual Machine is cool. The Virtual Machine helps each developer to counter the barrier of different development & testing environment. It can reduce unexpected events especially due to environment setup when you are demoing your application to your client!

My teammates also shared some valuable stories with me. For e.g. the technical sales guy told me this is also his worst ever project in our company. Normally some other POC projects are simple. I was considered very unfortunate to get involved in this.

Anyway, i don't really like this kind of ad-hoc call up for help. I hope this is my first time and last time doing this shit. At least please tell me one week earlier, and also let me know the overall plan so that i can get ready.

I still prefer a plan. Hurry can't help win a client.