widerules / skylight1

Automatically exported from code.google.com/p/skylight1
1 stars 0 forks source link

fix NPE reported in market #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
java.lang.NullPointerException
at 
net.nycjava.skylight1.service.impl.BalancedObjectPublicationServiceImpl.notifyOb
servers(BalancedObjectPublicationServiceImpl.java:91)
at 
net.nycjava.skylight1.service.impl.BalancedObjectPublicationServiceImpl.access$8
(BalancedObjectPublicationServiceImpl.java:84)
at 
net.nycjava.skylight1.service.impl.BalancedObjectPublicationServiceImpl$1.run(Ba
lancedObjectPublicationServiceImpl.java:64)
at java.util.Timer$TimerImpl.run(Timer.java:289)

Original issue reported on code.google.com by dario.nycjava@gmail.com on 21 Oct 2010 at 2:25

GoogleCodeExporter commented 9 years ago

Original comment by dario.nycjava@gmail.com on 21 Oct 2010 at 4:55

GoogleCodeExporter commented 9 years ago

Original comment by lna...@gmail.com on 12 Nov 2010 at 12:17

GoogleCodeExporter commented 9 years ago
I don't see anywhere where we could be adding null to this collection. I do see 
multiple threads, one due to the Timer, accessing it, though. So I guess this 
is a thread safety issue. I guess I could wrap the list using 
Collections.synchronizedList, but then there's the same issue with the 
calculations anyway...

Original comment by lna...@gmail.com on 16 Nov 2010 at 1:07

GoogleCodeExporter commented 9 years ago
Quick fix by making methods synchronized in r779 . Might be better to remove 
all this unneeded threading in the future. What the timer is doing can be done 
on the main thread via the Android Handler class. With synchronized we have to 
make sure we don't introduce any deadlocks.

Original comment by lna...@gmail.com on 16 Nov 2010 at 8:01