J
Jimmie Tyrrell
Got a Java-y question:
I have a loop that executes periodically. The loop iterates over an
Array List, and processes each item.
Randomly, a UDP socket will receive some data, which is then appended
to the Array List.
The problem, naturally, is that my Iterator will throw an exception if
data is received while I'm Iterating over the ArrayList.
Catching the exception is okay - but it occurs while Iterating. I'd
prefer the Iteration process to go untouched, and instead maybe
receive the Exception while _writing_ the data. I could then cache
it, or simply ignore it, whatever.
Any suggestions on how to achieve this? Need to see some code to
understand the problem?
I have a loop that executes periodically. The loop iterates over an
Array List, and processes each item.
Randomly, a UDP socket will receive some data, which is then appended
to the Array List.
The problem, naturally, is that my Iterator will throw an exception if
data is received while I'm Iterating over the ArrayList.
Catching the exception is okay - but it occurs while Iterating. I'd
prefer the Iteration process to go untouched, and instead maybe
receive the Exception while _writing_ the data. I could then cache
it, or simply ignore it, whatever.
Any suggestions on how to achieve this? Need to see some code to
understand the problem?