directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject Re: UserLogRecord class : some questions
Date Wed, 26 Oct 2011 17:32:20 GMT
On 10/26/11 6:46 PM, Selcuk AYA wrote:
>> 2) The stored data aren't copied, which might put the code at risk, if any
>> external code modifies the byte array (as we just store a ref on it). Should
>> we copy this array, or at least warn the user about this potential issue ?
> UserlogRecord is used to communicate data to/from log manager. I dont
> know what you mean by data stored is not copied. When user log record
> is submitted to log data, it is either copied to the internal buffer
> or written to the log file directly in case data is larger than the
> internal buffer. When data is read from logs, data read is copied to
> the buffer inside the user log record.
I see now that the buffer is being copied in the internal buffer, so we 
are safe.

Usually, when you pass a byte[], it's safe to copy it immediately, in 
order to avoid a corruption of its content, as it will be potentially 
shared by more than one thread. This was my concern, but it's not a 
valid one.
>> 4) Can't we use a constructor instead of an init() method ?
> init could evolve into an interface method.

In fact, I'm just wondering if just having a constructor with the init's 
method parameters wouldn't be easier.

Thanks !

Emmanuel L├ęcharny

View raw message