Category: The BlockingDeque Interface

Concurrent Collections and Maps 2 – Concurrency: Part II

Some collections allow the null value, and others do not. All concurrent collections, blocking queues, and concurrent maps do not allow the null value as elements, whereas the copy-on-write collections do. All collections that embody the concept of a set do not allow duplicates—for example, a CopyOnWriteArraySet. All maps (e.g., a ConcurrentHashMap) do not allow

The ConcurrentLinkedQueue Class – Concurrency: Part II

The ConcurrentLinkedQueue<E> Class The ConcurrentLinkedQueue class implements the Queue interface, as shown in Figure 23.6. No new methods are defined, and existing methods of the Queue interface (§15.6, p. 814) are implemented as shown in Table 23.7. Note that since it is an unbounded queue, the insert operations will always succeed. The ConcurrentLinkedDeque<E> Class The

Blocking Queues – Concurrency: Part II

Blocking Queues Queues (and deques) are the indisputable choice when choosing a collection to manage shared data in producer-consumer problems. The interfaces for thread-unsafe queues (Queue, Deque) in the java.util package have been enhanced in the java.util.concurrent package to provide a wide variety of blocking queues that are thread-safe (Figure 23.6). These thread-safe queues are

The BlockingDeque Interface – Concurrency: Part II

The BlockingDeque<E> Interface The java.util.concurrent.BlockingDeque interface extends both the java.util.Deque interface and the BlockingQueue interface, as shown in Figure 23.6. Compared to the operations shown for the ConcurrentLinkedDeque interface in Table 23.8, the Blocking-Deque interface provides new insert and remove operations, both at the head and tail of a deque, that can block or can

Copy-on-Write Collections – Concurrency: Part II

Copy-on-Write Collections The copy-on-write collections comprise special-purpose concurrent lists and sets that are recommended when read operations vastly outnumber mutative operations on the collection. The classes CopyOnWriteArrayList and CopyOnWriteArraySet implement the List and the Set interfaces in the java.util package (Figure 23.7). A summary of the copy-on-write classes in the java.util.concurrent package is given in

Introduction to Relational Databases – Database Connectivity

24.1 Introduction to Relational Databases Relational databases are based on the relational model that provides a standardized way to represent and query data. The data is stored in tables and queried using a query language. Relational Tables Relational databases store information in tables. Each table is designed to represent a business entity that applications need

Basic SQL Statements – Database Connectivity

Basic SQL Statements Structured Query Language (SQL) is used to perform relational database operations. Despite the existence of an ANSI (American National Standards Institute) SQL standard, different database providers may provide SQL implementations that are not exactly the same and may contain nuanced differences and proprietary additions. SQL statements can be logically grouped into a

Basic SQL Statements 2 – Database Connectivity

The UPDATE Statement The UPDATE statement can be used to update specific rows in a table. In other words, this statement modifies zero or more rows in the table: Click here to view code image UPDATEtable_name SETcolumn_name_value_pairs WHERErow_filter; where column_name_value_pairs in the SET clause is a comma-delimited list of pairs of column names and values: Click here

Creating and Executing SQL Statements – Database Connectivity

24.4 Creating and Executing SQL Statements The JDBC API defines three interfaces that represent SQL statements: The result of executing a SELECT statement is a table of rows represented by the following interface: All statements are created using a previously initialized JDBC connection object. A statement is created using one of the methods of the

Callable Statement – Database Connectivity

Callable Statement The Callable interface is a subinterface of the PreparedStatement interface. Callable statements are very similar to prepared statements because both use marker parameters. The main difference is that callable statements are used to invoke named stored procedures and stored functions that reside on the database side. The difference between a function and a