Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

acquireInterruptibly => InterruptedException  RSS feed

 
Greenhorn
Posts: 27
Chrome IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This exception:
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1219)
at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:340)
at java.util.concurrent.ArrayBlockingQueue.put(ArrayBlockingQueue.java:321)
at faeria.world.action.WorldScheduler.schedule(WorldScheduler.java:78)
at faeria.game.core.FaeriaGame.run(FaeriaGame.java:131)
at java.lang.Thread.run(Thread.java:724)


My beautifully simple Scheduler's code:


Why? Happens very rarely... Where should I be looking for the cause?
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thread which called the schedule method gets interrupted. We don't have any information about where schedule gets called, or what might be happening in and to that thread, so it is impossible for us to say. If you aren't sure of the sequence then start peppering your code with tons of log statements so you can see exactly the flow and what happens at or around the thread being interrupted.

edit: And remember: the interrupt doesn't have to happen while the put() operation is in progress, it just has to happen some time before the operation and not be cleared (using the Thread#interrupted() method, for example).
 
Jean-Michel Vilain
Greenhorn
Posts: 27
Chrome IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your clarifications Steve.
In my mind the put is almost instant so I found it very unlikely to have the thread interrupted right at this moment.
Helps a lot!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!