ConcurrentModificationException (Java Platform SE 7 )()

  本篇文章为你整理了ConcurrentModificationException (Java Platform SE 7 )()的详细内容,包含有 ConcurrentModificationException (Java Platform SE 7 ),希望能帮助你了解 ConcurrentModificationException (Java Platform SE 7 )。

  

public class ConcurrentModificationException

 

  extends RuntimeException

 

  This exception may be thrown by methods that have detected concurrent

   modification of an object when such modification is not permissible.

   For example, it is not generally permissible for one thread to modify a Collection

   while another thread is iterating over it. In general, the results of the

   iteration are undefined under these circumstances. Some Iterator

   implementations (including those of all the general purpose collection implementations

   provided by the JRE) may choose to throw this exception if this behavior is

   detected. Iterators that do this are known as fail-fast iterators,

   as they fail quickly and cleanly, rather that risking arbitrary,

   non-deterministic behavior at an undetermined time in the future.

   Note that this exception does not always indicate that an object has

   been concurrently modified by a different thread. If a single

   thread issues a sequence of method invocations that violates the

   contract of an object, the object may throw this exception. For

   example, if a thread modifies a collection directly while it is

   iterating over the collection with a fail-fast iterator, the iterator

   will throw this exception.

   Note that fail-fast behavior cannot be guaranteed as it is, generally

   speaking, impossible to make any hard guarantees in the presence of

   unsynchronized concurrent modification. Fail-fast operations

   throw ConcurrentModificationException on a best-effort basis.

   Therefore, it would be wrong to write a program that depended on this

   exception for its correctness: ConcurrentModificationException

   should be used only to detect bugs.

  Since:

  See Also:Collection,

  Iterator,

  ListIterator,

  Vector,

  LinkedList,

  HashSet,

  Hashtable,

  TreeMap,

  AbstractList,

  Serialized Form

  
ConcurrentModificationException()

  Constructs a ConcurrentModificationException with no

   detail message.

  
ConcurrentModificationException(Throwablecause)

  Constructs a new exception with the specified cause and a detail

   message of (cause==null ? null : cause.toString()) (which

   typically contains the class and detail message of cause.

  
ConcurrentModificationException

  

publicConcurrentModificationException()

 

  Constructs a ConcurrentModificationException with no

   detail message.

  
ConcurrentModificationException

  

publicConcurrentModificationException(Stringmessage)

 

  Constructs a ConcurrentModificationException with the

   specified detail message.

  Parameters:message - the detail message pertaining to this exception.

  
ConcurrentModificationException

  

publicConcurrentModificationException(Throwablecause)

 

  Constructs a new exception with the specified cause and a detail

   message of (cause==null ? null : cause.toString()) (which

   typically contains the class and detail message of cause.

  Parameters:cause - the cause (which is saved for later retrieval by the

   Throwable.getCause() method). (A null value is

   permitted, and indicates that the cause is nonexistent or

   unknown.)Since:

  
ConcurrentModificationException

  

publicConcurrentModificationException(Stringmessage,

 

   Throwablecause)

 

  Constructs a new exception with the specified detail message and

   cause.

   Note that the detail message associated with cause is

   not automatically incorporated in this exceptions detail

   message.

  Parameters:message - the detail message (which is saved for later retrieval

   by the Throwable.getMessage() method).cause - the cause (which is saved for later retrieval by the

   Throwable.getCause() method). (A null value

   is permitted, and indicates that the cause is nonexistent or

   unknown.)Since:

  
Scripting on this page tracks web page traffic, but does not change the content in any way.

  以上就是ConcurrentModificationException (Java Platform SE 7 )()的详细内容,想要了解更多 ConcurrentModificationException (Java Platform SE 7 )的内容,请持续关注盛行IT软件开发工作室。

郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。

留言与评论(共有 条评论)
   
验证码: