Hashtable
is synchronized.
Vector
is synchronized.
Note that this implementation is not synchronized. If multiple threads access a tree set concurrently, and at least one of the threads modifies the set, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the set. If no such object exists, the set should be "wrapped" using the Collections.synchronizedSortedSet
method. This is best done at creation time, to prevent accidental unsynchronized access to the set:
SortedSet s = Collections.synchronizedSortedSet(new TreeSet(...));
LinkedList:
Note that this implementation is not synchronized. If multiple threads access a linked list concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList
method. This is best done at creation time, to prevent accidental unsynchronized access to the list:
List list = Collections.synchronizedList(new LinkedList(...));
注:Vector和Hashtable是两个古老的集合类,Vector实现了List接口,Hashtable实现了Map接口,只有这两个(Vector和Hashtable)是同步的,其他都使非同步的。Hashtable不允许null作为key或者value。Vector底层由动态数组实现。
3. JDBC Transaction Isolation Levels
con.setTransactionIsolation(TRANSACTION_READ_UNCOMMITTED);
The higher the transaction isolation level, the more care is taken to avoid conflicts. The Connection interface defines five levels, with the lowest specifying that transactions are not supported at all and the highest specifying that while one transaction is operating on a database, no other transactions may make any changes to the data read by that transaction. TRANSACTION_READ_UNCOMMITTED, used in the previous example, is one level up from the lowest level. Typically, the higher the level of isolation, the slower the application executes (due to increased locking overhead and decreased concurrency between users). The developer must balance the need for performance with the need for data consistency when making a decision about what isolation level to use. Of course, the level that can actually be supported depends on the capabilities of the underlying DBMS.
History
-
The Apache Software Foundation got its start in 1995 with its first project, the Apache Hypertext Transfer Protocol (HTTP) Server, also known as Apache Web Server. The project evolved from the httpd software developed by the National Center for Super Computing (NCSA), which was the most popular web server on the Internet at the time. The first Apache Web Server was released in December 1995.
The Tomcat server got its start at Sun Microsystems, the creators of the Java programming language, as a server implementing the Java Servlets and JavaServer Pages (JSP) specification. Sun Microsystems donated the code to the Apache Software Foundation in 1999. Apache's first Tomcat server release was version 3.0 in 1999.
Function
-
Apache Web Server is software that resides on a network-connected computer, accepts requests from web browsers and other clients on remote computers, and responds by sending back the content requested. The content can be static files, such as web pages and images, or the results of executable files, such as PHP and Perl scripts.
Tomcat Server is a specialized web server called a "servlet container." It features a basic web server customized to execute Java servlets and JSP pages.
Benefits
-
Apache Web Server offers flexibility, both natively and through add-ons called "modules" or simply "mods." It can be configured to handle requests for dynamic content driven by a wide range of languages and technologies, including Perl, Python, PHP, Ruby, ASP and binary executables. Apache can also be configured to use the Tomcat server as a back-end handler for servlets and JSP pages. Other modules for Apache Web Server provide added functionality, such as generating formatted directory views, serving web content from user directories, authentication, SSL, WebDAV and response content compression. The popularity of the Apache Web Server has led to extensive third-party development for the package.
Tomcat, as a stand-alone web server, offers optimization for servlets and JSP pages. Tomcat can be configured to serve dynamic content generated by Common Gateway Interface (CGI), PHP, Ruby and other technologies.
Considerations
-
Websites serving only static content, servlets and JSP pages often choose to use the Tomcat as the primary web server because it offers enhanced performance over the Apache Web Server. Tomcat can also serve as back-end servlet container for the Apache Web Server. While this configuration can affect overall performance, it provides the additional flexibility that Apache offers for configuring complex, multi-user environments.
Warnings
-
Results may vary. There is some debate over whether Tomcat Server or Apache Web Server is the faster web server. Server performance is dependent on the configuration of the server software. Start-up options, optimizations, performance tuning, and other settings all affect performance. As a result, performance comparisons don't always illustrate a clear winner. Ultimately, the choice to use one, the other, or a combination of both is dependent not on performance, but on requirements and preference.
5. 如下哪些可以被继承
java.lang.Thread 普通类
Thread类是可以被继承的,一个线程的的一种方式就是继承Thread类
The abstract class Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short.
Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short.