I'm actually seeing the handler code show up in my profiler. And I'm passing
a lot of small data many times. As the code was initially built for parsing
while loading from the network with xml. And not the download then parse
json code.
In terms of synchronization issues, I use an interface
If you're sure that all users of the data are within the same process
(the
same app), then using Java synchronized is the best way to go.
However,
you will need to be very careful to understand your semaphore
dependencies,
or deadlock will occur. Not responding is almost as bad as Data
corrupted
Thank you! I wasn't sure what was the cleanest way of doing it. And I'm very
familiar with threading, just not how java does it (and the synchronized
isn't something I'm familiar with from other platforms).
I'll try to push some of the sorting/filtering into the threads as well, to
reduce amount
I tend to prefer the handler approach over synchronized methods just because
it's less easy to shoot yourself in the foot if only a single thread touches
your data structures.
Performance wise there shouldn't be any fundamental difference between the
handler approach and the synchronized
4 matches
Mail list logo