stmt.close();
stmt = null;
System.out.println( "Arbiter: Second attempt to select from dual executed fine.");
} catch (SQLException e) {
System.out.println( "Arbiter: select from dual failed");
} finally {
if (stmt != null)
try {
stmt.close();
} catch (SQLException e) {
}
}
} // if con null
if (con == null) {
// we are giving up
// log error & leave, return null
message = String
.format("Arbiter: ERROR. Cannot get Connection to process Object for key [%s]. Existing object kept. \n",
collisionKey);
System.out.println( message);
return null;
}
up = DBTableWrapper.getUserProfile(con, collisionKey.toString());
//important! return connection to pool
if (con != null)
try {
con.close();
} catch (SQLException e) {}
return up;
}
/*******************************************************************************/
/* Method Name: initialize */
/* */
/*
* Description: This method gets invoked when the containers come up. It
* could be used for any purpose necessary at start up time. /* We use it to
* cache Oracle Data Source in this OG container
*/
/* */
/*******************************************************************************/
@Override
public void initialize(ObjectGrid grid) {
System.out.println(
"Arbiter: Init Collision Arbiter. Gettting Oracle Data Source ");
try {
ds = DSWrapper.getInstance();
} catch (SQLException e) {
System.out.println(
"Arbiter: Cannot initialize data source. SQLException :"
+ e.getMessage());
ds = null;
}
}
}
作者:沉默是金