background preloader

Java SE Technical Documentation

Java SE Technical Documentation

Java DB Technical Documentation Java DB 10.10.1.2 Technical Documentation This documentation accompanies the version of Java DB that is included with Java Development Kit (JDK) 8. Getting Started with Java DB Java DB Reference Manual Java DB Developer's Guide Tuning Java DB Java DB Server and Administration Guide Java DB Tools and Utilities Guide Java DB 10.10.1.2 API Documentation Java DB 10.8.3.0 Technical Documentation This documentation accompanies the version of Java DB that is included with Java Development Kit (JDK) 7. Java DB 10.8.3.0 API Documentation Previous Java DB Releases Java DB 10.6.2.1 Documentation Java DB 10.6.2.1 API Documentation Java DB 10.6.1.0 Documentation Java DB 10.6.1.0 API Documentation Java DB 10.5.3.0 Documentation Java DB 10.5.3.0 API Documentation Java DB 10.5.1.1 Documentation Java DB 10.5.1.1 API Documentation Java DB 10.4.2.1 Documentation Java DB 10.4.2.1 API Documentation Java DB 10.4.1.3 Documentation Java DB 10.4.1.3 API Documentation Java DB 10.3.3.0 Documentation Java DB 10.3.3.0 API Documentation

BNF Index of JAVA language grammar BNF Index of JAVA language grammar index on key wordsindex on special charactersrules of JAVA startrule nice to start [other languages BNF] for developper java developper java developper island java and mac index of rules Using JavaCC options { UNICODE_INPUT = true; STATIC = false;} PARSER_BEGIN(Parser) package edu.lmu.cs.xlg.iki.syntax; import java.util.List;import java.util.ArrayList;import java.io.Reader;import edu.lmu.cs.xlg.util.Log;import edu.lmu.cs.xlg.iki.entities.Number;import edu.lmu.cs.xlg.iki.entities public class Parser { /** * Returns the result of parsing the Iki program on the given Reader. */ public Program parse(Log log) { try { return PROGRAM(); } catch (TokenMgrError e) { log.exception(e); return null; } catch (ParseException e) { log.exception(e); return null; } }} PARSER_END(Parser) // Whitespace and comments SKIP: { " " | "\t" | "\n" | "\r" | <"--" (~["\n","\r"])* ("\n"|"\r")>} // Reserved Words and symbols // Literals // Identifiers. Program PROGRAM(): { Block b;}{ "begin" b = BLOCK() "end" <EOF> {return new Program(b);}} Declaration DEC(): { Token i;}{ "var" i = <ID> {return new Variable(i.image);}}

Java theory and practice: Introduction to nonblocking algorithms When more than one thread accesses a mutable variable, all threads must use synchronization, or else some very bad things can happen. The primary means of synchronization in the Java language is the synchronized keyword (also known as intrinsic locking), which enforces mutual exclusion and ensures that the actions of one thread executing a synchronized block are visible to other threads that later execute a synchronized block protected by the same lock. When used properly, intrinsic locking can make our programs thread-safe, but locking can be a relatively heavyweight operation when used to protect short code paths when threads frequently contend for the lock. In "Going atomic,"we looked at atomic variables, which provide atomic read-modify-write operations for safely updating shared variables without locks. A nonblocking counter Counter in Listing 1 is thread-safe, but the need to use a lock irks some developers because of the performance cost involved. Listing 1. Listing 2. Back to top

Java theory and practice: Stick a fork in it, Part 1 Hardware trends drive programming idioms Languages, libraries, and frameworks shape the way we write programs. Even though Alonzo Church showed in 1934 that all the known computational frameworks were equivalent in the set of programs they could represent, the set of programs that real programmers actually write is shaped by the idioms that the programming model — driven by languages, libraries, and frameworks — makes easy to express. In turn, the dominant hardware platforms of the day shape the way we create languages, libraries, and frameworks. The Java language has had support for threads and concurrency from day 1; the language includes synchronization primitives such as synchronized and volatile, and the class library includes classes such as Thread. Going forward, the hardware trend is clear; Moore's Law will not be delivering higher clock rates, but instead delivering more cores per chip. Exposing finer-grained parallelism Divide and conquer Listing 1. Fork-join Listing 2. Table 1.

Java theory and practice: Thread pools and work queues Why thread pools? Many server applications, such as Web servers, database servers, file servers, or mail servers, are oriented around processing a large number of short tasks that arrive from some remote source. A request arrives at the server in some manner, which might be through a network protocol (such as HTTP, FTP, or POP), through a JMS queue, or perhaps by polling a database. One simplistic model for building a server application would be to create a new thread each time a request arrives and service the request in the new thread. In addition to the overhead of creating and destroying threads, active threads consume system resources. A thread pool offers a solution to both the problem of thread life-cycle overhead and the problem of resource thrashing. Back to top Alternatives to thread pools Thread pools are far from the only way to use multiple threads within a server application. Work queues The example work queue in Listing 1 meets the requirements for safely using notify().

Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine Introduction The Java TM 2 Platform Standard Edition (J2SE TM platform) is used for a wide variety of applications from small applets on desktops to web services on large servers. In the J2SE platform version 1.4.2 there were four garbage collectors from which to choose but without an explicit choice by the user the serial garbage collector was always chosen. In version 5.0 the choice of the collector is based on the class of the machine on which the application is started. This “smarter choice” of the garbage collector is generally better but is not always the best. When does the choice of a garbage collector matter to the user? Amdahl observed that most workloads cannot be perfectly parallelized; some portion is always sequential and does not benefit from parallelism. The graph below models an ideal system that is perfectly scalable with the exception of garbage collection. The serial collector will be adequate for the majority of applications. Ergonomics for an application. Generations

java - the Java application launcher -client Select the Java HotSpot Client VM. A 64-bit capable jdk currently ignores this option and instead uses the Java HotSpot Server VM. For default VM selection, see Server-Class Machine Detection -server Select the Java HotSpot Server VM. -agentlib:libname[=options] Load native agent library libname, e.g. -agentlib:hprof -agentlib:jdwp=help -agentlib:hprof=help For more information, see JVMTI Agent Command Line Options. -agentpath:pathname[=options] Load a native agent library by full pathname. -classpath classpath -cp classpath Specify a list of directories, JAR archives, and ZIP archives to search for class files. If -classpath and -cp are not used and CLASSPATH is not set, the user class path consists of the current directory (.). As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR (a java program cannot tell the difference between the two invocations). -jar -?

Related: