{
private static final int MAX_RETRIES = 10 ;
public InputObjectState read_state (Uid objUid, String tName, int ft, String tableName) throws ObjectStoreException
{
InputObjectState newImage = null;
if (!storeValid())
return newImage;
if (tName != null)
{
if ((ft == ObjectStore.OS_COMMITTED) || (ft == ObjectStore.OS_UNCOMMITTED))
{
int pool = getPool();
ResultSet rs = null;
try
{
for(int count = 0 ; count < MAX_RETRIES ; count++)
{
try
{
PreparedStatement pstmt = _preparedStatements[pool][READ_STATE];
if (pstmt == null)
{
pstmt = _theConnection[pool].prepareStatement("SELECT ObjectState FROM "+tableName+" WHERE UidString = ? AND TypeName = ? AND StateType = ?");
_preparedStatements[pool][READ_STATE] = pstmt;
}
pstmt.setString(1, objUid.stringForm());
pstmt.setString(2, tName);
pstmt.setInt(3, ft);
rs = pstmt.executeQuery();
if(! rs.next()) {
return null; // no matching state in db
}
Blob myBlob = (Blob)rs.getBlob(1);
byte[] buffer = myBlob.getBytes(1, (int)myBlob.length());
if (buffer != null)
{
newImage = new InputObjectState(objUid, tName, buffer);
}
else {
if (tsLogger.arjLoggerI18N.isWarnEnabled())
tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.objectstore.jdbc.oracle_1");
}