return null;
}
synchronized( this )
{
DefaultConfiguration state = new DefaultConfiguration( "sample", "-" );
state.setAttribute( "type",
InstrumentSampleUtils.getInstrumentSampleTypeName( getType() ) );
state.setAttribute( "interval", Long.toString( m_interval ) );
state.setAttribute( "size", Integer.toString( m_size ) );
state.setAttribute( "time", Long.toString( m_time ) );
if( getLeaseExpirationTime() > 0 )
{
state.setAttribute( "lease-expiration", Long.toString( getLeaseExpirationTime() ) );
state.setAttribute( "description", m_description );
}
// Save the history samples so that the newest is first.
DefaultConfiguration samples = new DefaultConfiguration( "history", "-" );
int[] history = getHistorySnapshot();
// Build up a string of the sample points.
StringBuffer sb = new StringBuffer();
// Store the first value outside the loop to simplify the loop.
sb.append( history[ history.length - 1 ] );
for( int i = history.length - 2; i >= 0; i-- )
{
sb.append( ',' );
sb.append( history[ i ] );
}
samples.setValue( sb.toString() );
state.addChild( samples );
saveState( state );
return state;