Sie sind auf Seite 1von 2

To Avoid ConcurrentModificationException in multi-threaded environment: 1. You can convert the list to an array and then iterate on the array.

This approach works well for small or medium size list but if the list is large then it will affect the performance a lot. 2. You can lock the list while iterating by putting it in a synchronized block. This approach is not recommended because it will cease the benefits of multithreading. 3. If you are using JDK1.5 or higher then you can use ConcurrentHashMap and CopyOnWriteArrayList classes. It is the recommended approach. To Avoid ConcurrentModificationException in single-threaded environment: You can use the iterator remove() function to remove the object from underlying collection object. But in this case you can remove the same object and not any other object from the list.
The Java Virtual machine included in the Java package.

(JVM) is the application that executes a Java program and it is

PATH is nothing but setting up an environment for operating system. Operating System will look in this PATH for executables. Class path is nothing but setting up the environment for Java. Java will use to find compiled classes (i.e. .class files).

MVC is a design pattern. It contains two models. MVC Model 1, MVC Model 2.Struts framework implements MVC Design Pattern. Struts can implement Model 1 and Model 2. Model 2 most properly describes the application of MVC in a Web-Application context.Following are the important feature of MVC1 architecture: (1) HTML or JSP files are used to code the presentation. JSP files use java beans to retrieve data if required.(2)MVC1 architecture is page-centric design all the business and processing logic means any JSP page can either present in the JSP or may be called directly from the JSP page.(3)Data access is usually done using Custom tag or through java bean call.Therefore we can say that in MVC1 there is tight coupling between page and model.Following are the important feature of MVC2 architecture(1)This architecture removes the page-centric property of MVC1 architecture by separating Presentation, Control logic and Application state(2)In MVC2 architecture there is one Controller which receive all request for the application and is responsible for taking appropriate action in response to each request. Second one is Model which is represented by JavaBeans, business object, and database. Third one is View or is JSP page it takes the information provided by Controller and Module and presents it to user.

To make your servlets compile, you only need the servlet-api.jar, but runtime you need a servlet container actually implementing the api.

thread safe in servlets SingleThreadModel Interface or Synchronization

Das könnte Ihnen auch gefallen