I’m struggling with `FileAlreadyExistsException` a...
# ksp
r
I’m struggling with
FileAlreadyExistsException
and I’m unsure how to approach the solution. In my processor I want combine multiple interfaces to a single interface. These interfaces can be generated by any processor including mine. The write of the combined interface could happen in
finish()
, but this combined interface must be fed to another processor that I don’t own one last time. I’m struggling to know for certain what’s the last round from my processors point of view. For example, my processor can’t know if another processor will generate more of the interfaces that need to be combined, that can happen one or two rounds later. Is it the last round for my processor to create and write the combined interface or not? That’s hard to tell. Any suggestion?
t
If the inputs your processor needs always show up within 1, 2 or any constant number of rounds after your processor generates something and sits idle, maybe try deferring the processing. Your processor might need to generate dummy outputs just to keep the rounds going though, because KSP stops the rounds and moves to finish() when there are no new outputs. Otherwise it sounds like some sort of synchronization is needed among processors in general.
r
Yes, for now I limit my processing to round 2, which feels wrong. That’s why I was asking for advice. I agree with the part that processors need to be synchronized, but that’s challenging when I try to inject myself into another processor that I don’t own. Generating dummy output is interesting. I’ll give this a try.
t
IIRC Dagger also faced a very similar issue if not exactly the same. I cannot recall or find the discussion though. Their code base may have some leads.
r
Probably Hilt, I can see that. Thanks 👍
👍 1