Open axiak opened 5 months ago
@axiak Hi Michael,
Thank you for this contribution. When you say that File.length()
is called for each event, on which execution path do you think this occurs?
@axiak Hi Michael,
Thank you for this contribution. When you say that
File.length()
is called for each event, on which execution path do you think this occurs?
From my read through the file length check occurs only when the rollover check interval is passed. For all standard TriggeringPolicy
implementations it is not on every append.
This would be an optimization when checking for rollover if someone has a low rollover check interval. Depending on the triggering policy this can vary, for SizeBased
it is by default 60 seconds in DefaultInvocationGate
, but configurable, TimeBased
are derived from the filename pattern provided. If someone has a filename date pattern which causes the policy to use a very low periodicity, e.g. MILLISECONDS or SECONDS, or someone configures the InvocationGate
for SizeBased
with a very low value.
In these limited cases this could be an improvement, in exchange for extra state and complexity.
This change introduces a way for the ResiliantFileOutputStream to track its own position in the file. This means that instead of calling File.length() (which ends up being a syscall) for each event, we only call it when we're recovering a stream.