public void addData(byte[] data) throws InternalLogException
  {
    if (tc.isEntryEnabled()) Tr.entry(tc, "addData",new java.lang.Object[] {RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES), this});

    // If the parent recovery log instance has experienced a serious internal error then prevent
    // this operation from executing.
    if (_recLog.failed())
    {
      if (tc.isEntryEnabled()) Tr.exit(tc, "addData",this);
      throw new InternalLogException(null);
    }

    // Get the shared lock since we are going to modify the internal data structures.
    _controlLock.getSharedLock(LOCK_REQUEST_ID_RUSI_ADDDATA);

    if (_singleData)
    {
        // This recoverable unit section can hold only a single data item.
        if (tc.isDebugEnabled()) Tr.debug(tc, "Section can hold only a single data item.");

        if (_writtenData.size() > 0)
        { 
            // It already contains written data. This must be replaced.
            if (tc.isDebugEnabled()) Tr.debug(tc, "There is existing WRITTEN data. Updating data wrapper.");

            // Retrieve the first, and only written data item.
            SingleDataItem dataItem = (SingleDataItem)_writtenData.get(0);

            // Replace the data content with the new data.
            dataItem.setData(data);

            // Clear out the written data array and move this into the unwritten data array
            _writtenData.clear();
            _unwrittenData.add(0, dataItem);

            // Ensure that the last data reference is accurate.
            _lastDataItem = dataItem;
        }
        else if (_unwrittenData.size() > 0)
        { 
            // It already contains unwritten data. This must be replaced.
            if (tc.isDebugEnabled()) Tr.debug(tc, "There is existing UNWRITTEN data. Updating data wrapper.");

            // Retrieve the first, and only unwritten data item.
            SingleDataItem dataItem = (SingleDataItem)_unwrittenData.get(0);

            // Replace the data content with the new data.
            dataItem.setData(data);

            // Ensure that the last data reference is accurate.
            _lastDataItem = dataItem;
        }
        else
        {
            // It contains no existing data. Create a new DataItem wrapper
            if (tc.isDebugEnabled()) Tr.debug(tc, "There is no existing data. Creating data wrapper");

            // There is no existing data item, so create one and add it to the
            // list of unwritten data items. In practice, this will be the only
            // data item added to this list. Subsequent addData calls will replace
            // the data stored within it (see above).
            SingleDataItem dataItem = new SingleDataItem(_storageMode, data, this);
            _unwrittenData.add(0, dataItem);
            _lastDataItem = dataItem; 
        }
    }
    else
    {
        // This recoverable unit section can hold multiple data item.
        if (tc.isDebugEnabled()) Tr.debug(tc, "Section holds multiple data items");

        // This recoverable unit section can hold an arbitrary number of data items.
        // Create a new data item to hold 'data' and add it to the list of unwritten
        // data items.
        DataItem dataItem = new DataItem(_storageMode, data, this);
        _unwrittenData.add(dataItem);
        _lastDataItem = dataItem;
    } 
  
    try
    {
      _controlLock.releaseSharedLock(LOCK_REQUEST_ID_RUSI_ADDDATA);
    }
    catch(NoSharedLockException exc)
    {
      FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoverableUnitSectionImpl.addData", "382", this);
      if (tc.isEntryEnabled()) Tr.exit(tc, "addData", "InternalLogException");
      throw new InternalLogException(exc);
    }

    if (tc.isEntryEnabled()) Tr.exit(tc, "addData");
  }
public void addData ( byte [ ] data ) throws InternalLogException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "addData" , new java . lang . Object [ ] { RLSUtils . toHexString ( data , RLSUtils . MAX_DISPLAY_BYTES ) , this } ) ; if ( _recLog . failed ( ) ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" , this ) ; throw new InternalLogException ( null ) ; } _controlLock . getSharedLock ( LOCK_REQUEST_ID_RUSI_ADDDATA ) ; if ( _singleData ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Section can hold only a single data item." ) ; if ( _writtenData . size ( ) > 0 ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "There is existing WRITTEN data. Updating data wrapper." ) ; SingleDataItem dataItem = ( SingleDataItem ) _writtenData . get ( 0 ) ; dataItem . setData ( data ) ; _writtenData . clear ( ) ; _unwrittenData . add ( 0 , dataItem ) ; _lastDataItem = dataItem ; } else if ( _unwrittenData . size ( ) > 0 ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "There is existing UNWRITTEN data. Updating data wrapper." ) ; SingleDataItem dataItem = ( SingleDataItem ) _unwrittenData . get ( 0 ) ; dataItem . setData ( data ) ; _lastDataItem = dataItem ; } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "There is no existing data. Creating data wrapper" ) ; SingleDataItem dataItem = new SingleDataItem ( _storageMode , data , this ) ; _unwrittenData . add ( 0 , dataItem ) ; _lastDataItem = dataItem ; } } else { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Section holds multiple data items" ) ; DataItem dataItem = new DataItem ( _storageMode , data , this ) ; _unwrittenData . add ( dataItem ) ; _lastDataItem = dataItem ; } try { _controlLock . releaseSharedLock ( LOCK_REQUEST_ID_RUSI_ADDDATA ) ; } catch ( NoSharedLockException exc ) { FFDCFilter . processException ( exc , "com.ibm.ws.recoverylog.spi.RecoverableUnitSectionImpl.addData" , "382" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" , "InternalLogException" ) ; throw new InternalLogException ( exc ) ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "addData" ) ; }
<p>
Adds new data to the recoverable unit section. Initially, the data is
'unwritten' and cachjed inside the '_unwrittenData' array. Once the data has
been passed to the underlying recovery log, its considered 'written' and cached
inside the '_writtenData' array.
</p>

<p>
Data added to a recoverable unit section is wrapped inside a DataItem object. This
allows the access to the data to be independant of the physical location of the
data (which can be cached in memory but may only be held on disk)
</p>

<p>
Data items will be accumulated on successive addData calls, unless the recoverable
unit section can hold only a single data item. If this is the case, the old data
will be disgarded and replaced with new data.
</p>

<p>
Only non-null and non-empty byte arrays may be passed to this method.
</p>

@param data The new data item to be stored.

@exception InternalLogException An unxpected error has occured