ConcurrentModificationException, please help

S

shoa

Hello
In my application, I have a button. When I click on this button, it will be
log off. However, there is a ConcurrentModificationException:
----------------------------------------------------------------------------
-------------
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:448)
at java.util.AbstractList$Itr.next(AbstractList.java:419)
at
com.crseducation.kokiridatabase.hauoraclient.currentuser.CurrentUser._$9098(
CurrentUser.java:308)
at
com.crseducation.kokiridatabase.hauoraclient.currentuser.CurrentUser.logoff(
CurrentUser.java:242)
at
com.crseducation.kokiridatabase.hauoraclient.guiapplication.MainWindow.login
(MainWindow.java:265)
at
com.crseducation.kokiridatabase.hauoraclient.guiapplication.MainWindow.login
_actionPerformed(MainWindow.java:257)
at
com.crseducation.kokiridatabase.hauoraclient.guiapplication.MainWindow_tbBut
tonLogin_actionAdapter.actionPerformed(MainWindow.java:355)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)

This was happend in this code
--------------------------------------------
private void signalLogoff(){
Iterator iterator = myListeners.iterator();
while(iterator.hasNext()){
CurrentUserListener listener = (CurrentUserListener) iterator.next();
//The error here
listener.userLoggedOff();
}
}
-----------------------------------------------
I know this is hard question. However, if you have any clue for this error,
please help
Many thanks

S.Hoa
 
S

shoa

Thanks for your help. I already read the site. Howerver, in my application,
I do not have any Collection.remove function. Could you please explain more
details about this sentence.
 
R

Roedy Green

You tried to delete or add to a Collection while you were in the middle of
running an Iterator over it. To get around this, you must remove elements
via the Iterator object using Iterator.remove rather than the usual
Collection.remove.

the basic idea is that collections are single thread. Further you
can't update them while an iterator is running, even on the same
thread, unless you update indirectly via the iterator.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

java.jdk and java.jre system properties 5
extending enum 18
Cloneable 7
sleep or beep 10
AccessControlException 11
Splitting a class 5
ColorChooser for AWT 3
missing system properties 1

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top