public final AbstractItem getItem ( ) throws SevereMessageStoreException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getItem" ) ; AbstractItem item = _getItemNoRestore ( ) ; synchronized ( this ) { if ( isExpired ( ) ) { item = null ; } else { // if we did not have a reference to the item then we try to recreate if ( null == item ) { try { item = _restoreItem ( ) ; } catch ( SevereMessageStoreException e ) { // No FFDC Code Needed. // PK54812 Ensure we dump a suitable FFDC containing all of the message store // information required in order to identify the rows etc. related to this entry. try { StringWriter stringWriter = new StringWriter ( ) ; FormattedWriter writer = new FormattedWriter ( stringWriter ) ; this . xmlWriteOn ( writer ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.msgstore.cache.links.AbstractItemLink.getItem" , "1:2252:1.241" , this , new Object [ ] { stringWriter } ) ; writer . close ( ) ; } catch ( IOException ioe ) { FFDCFilter . processException ( ioe , "com.ibm.ws.sib.msgstore.cache.links.AbstractItemLink.getItem" , "1:2257:1.241" , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "RuntimeException caught restoring Item!" , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getItem" ) ; throw e ; } catch ( RuntimeException re ) { // No FFDC Code Needed. // PK54812 Ensure we dump a suitable FFDC containing all of the message store // information required in order to identify the rows etc. related to this entry. try { StringWriter stringWriter = new StringWriter ( ) ; FormattedWriter writer = new FormattedWriter ( stringWriter ) ; this . xmlWriteOn ( writer ) ; FFDCFilter . processException ( re , "com.ibm.ws.sib.msgstore.cache.links.AbstractItemLink.getItem" , "1:2274:1.241" , this , new Object [ ] { stringWriter } ) ; writer . close ( ) ; } catch ( IOException ioe ) { FFDCFilter . processException ( ioe , "com.ibm.ws.sib.msgstore.cache.links.AbstractItemLink.getItem" , "1:2279:1.241" , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . event ( this , tc , "RuntimeException caught restoring Item!" , re ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getItem" ) ; throw re ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getItem" , item ) ; } return item ; }
When the item is required the hard and soft references are examined to detect an existing item in memory . If there is one then this item is used . If the item does not have a hard or soft reference but does have a persistent representation then we attempt to restore the item from its persistent representation . If we have no persistent representation or fail to recreate from the persistent representation then we unlink the link .