The IEEE 754 standard permits additional precision to be used when calculating the result of function. For example, the Intel x86 and the IBM PowerPC do this by default. Numeric programs written in Java and run on different computers might get slightly different results depending of the choice of precision when calculating intermediate results. The keyword strictfp in Java permits the programmer to obtain control over the numeric calculations of the underlying machine. It says to use standard precision and not extended precision.
Within an expression that is not FP-strict, some leeway is granted for an implementation to use an extended exponent range to represent intermediate results; the net effect, roughly speaking, is that a calculation might produce "the correct answer" in situations where exclusive use of the float value set or double value set might result in overflow or underflow.Improving Java for Numerical Computation, 1998.
How Java's Floating-Point Hurts Everyone Everywhere by Kahn and Darcy, 1998.
void method () { Image big = new Image (); // use big big = null; /* pointless; will be reclaimed by collector anyway }On the other hand, be sure to set references to null in long-lived data structures.
public class Stack { private Object stk[] = new Object[100]; private int top = 0; public void push(Object p) { stk[top++] = p; } public Object pop() { Object p = stk[top-1]; stk[top-1] = null; top-- return p; } }
java -agentlib:hprof,cpu=samples java -agentlib:hprof=help > java -Xrunhprof:help Hprof usage: -Xrunhprof[:help]|[<option>=<value>, ...] Option Name and Value Description Default --------------------- ----------- ------- heap=dump|sites|all heap profiling all cpu=samples|times|old CPU usage off monitor=y|n monitor contention n format=a|b ascii or binary output a file=<file> write data to file java.hprof(.txt for ascii) net=<host>:<port> send data over a socket write to file depth=<size> stack trace depth 4 cutoff=<value> output cutoff point 0.0001 lineno=y|n line number in traces? y thread=y|n thread in traces? n doe=y|n dump on exit? y Example: java -Xrunhprof:cpu=samples,file=log.txt,depth=3 FooClass
Like RMI it has stubs and skeletons.
Servlets are modules of Java code that run in a server application (hence the name "Servlets", similar to "Applets" on the client side) to answer client requests. Servlets are not tied to a specific client-server protocol but they are most commonly used with HTTP and the word "Servlet" is often used in the meaning of "HTTP Servlet".
Servlets make use of the Java standard extension classes in the packages javax.servlet (the basic Servlet framework) and javax.servlet.http (extensions of the Servlet framework for Servlets that answer HTTP requests).
Not part of the JDK
Since Servlets are written in the highly portable Java language and follow a standard framework, they provide a means to create sophisticated server extensions in a way that independent of the server and of the operating system.
Typical uses for HTTP Servlets include:
Servlet lifecyle: init(), service(), destroy().
java -cp $JDK_HOME/lib/tools.jar:lib/com.sun.net.ssl.jar:lib/com.mortbay.jetty.jar:lib/javax.servlet.jar:lib/org.apache.jasper.jar:lib/com.microstar.xml.jar com.mortbay.Jetty.Demo
Canvas3D is a subclass of java.awt.Canvas and hence the display of Java 3D is in a "heavyweight" component that does not mix well with Java Swing "lightweight" components.
JavaSpaces technology is tool for coordinating processes into a distributed application. It does rely on passing message between processes or invoking methods on remote objects like most forms of distributed programming. Instead an application is viewed as a collection of processes cooperating via the flow of objects into and out of one or more spaces. This space-based model of distributed computing has its roots in the Linda coordination language developed by Dr. David Gelernter at Yale University. A space is a shared, network-accessible repository for objects. Processes use the repository as a persistent object storage and exchange mechanism; instead of communicating directly, they coordinate by exchanging objects through spaces. Processes perform simple operations to write new objects into a space, take objects from a space, or read (make a copy of) objects in a space. When taking or reading objects, processes use a simple value-matching lookup to find the objects that matter to them. If a matching object isn't found immediately, then a process can wait until one arrives. Unlike conventional object stores, processes don't modify objects in the space or invoke their methods directly--while there, objects are just passive data. To modify an object, a process must explicitly remove it, update it, and reinsert it into the space.