This link has been bookmarked by 106 people . It was first bookmarked on 03 Nov 2006, by CK Lee.
-
17 Dec 08
-
02 Oct 08
-
24 Sep 08
-
25 Aug 08
-
22 Aug 08
-
- You cannot obtain an exit status from an external process until it has exited
- You must immediately handle the input, output, and error streams from your spawned external process
- You must use
Runtime.exec()to execute programs - You cannot use
Runtime.exec()like a command line
-
-
31 Jul 08
-
30 Jul 08
-
24 Jul 08
-
11 Jul 08
-
07 Jul 08
-
05 Jul 08
Mert NuhogluTips for structuring, maintaining, and promoting your 'part-time hobby'
-
30 Jun 08
-
02 May 08
-
27 Apr 08
-
22 Apr 08
-
17 Apr 08
-
31 Mar 08
-
25 Mar 08
-
13 Feb 08
-
Accelerate your RMI programming
-
PTT 2: Disable servlet and JSP auto-reloading
Servlet/JSP auto-reloading proves useful during the development phase because it reduces development time, as you do not have to restart the server after every change in the servlet/JSP. However, it is expensive in the production phase; servlet/JSP auto-reloading gives poor performance because of unnecessary loading and burdening on the classloader. Also, it may put your application in strange conflicts when classes loaded by a certain classloader cannot cooperate with classes loaded by the current classloader. So turn off auto-reloading for servlet/JSP in a production environment to receive better performance.
-
PTT 4: Use gzip compression
Compression is the act of removing redundant information, representing what you want in as little possible space. Using gzip (GNU zip) to compress the document can dramatically reduce download times for HTML files. The smaller your information's size, the faster it can all be sent. Therefore, if you compress the content your Web application generates, it will get to a user faster and appear to display on the user's screen faster. Not every browser supports gzip compression, but you can easily check whether a browser supports it and then send gzip-compressed content to only those browsers that do.
-
-
05 Feb 08
-
02 Feb 08
-
24 Jan 08
-
19 Jan 08
-
16 Jan 08
-
28 Dec 07
-
05 Dec 07
-
26 Oct 07
-
25 Oct 07
danielgianniSockets programming in Java: A tutorial
Writing your own client/server applications can be done seamlessly using Javajava socket code development programming for:arnold_lane for:filipegallo for:tigrela
-
17 Oct 07
Hendy IrawanSession Initiation Protocol (SIP) is a control (signaling) protocol developed by the Internet Engineering Task Force (IETF) to manage interactive multimedia IP sessions including IP telephony, presence, and instant messaging. The SIP Servlet Specification
-
12 Sep 07
-
15 Aug 07
-
02 Aug 07
-
23 Jul 07
-
22 Jul 07
aj... support for the Model/View/Controller architecture with two classes:
* Observer -- any object that wishes to be notified when the state of another object changes
* Observable -- any object whose state may be of interest, and in whom another object -
08 Jul 07
-
03 Jul 07
-
02 Jul 07
-
As part of the Java language, the java.lang package is implicitly imported into every Java program. This package's pitfalls surface often, affecting most programmers. This month, I'll discuss the traps lurking in the Runtime.exec() method.
-
-
25 Jun 07
-
19 Jun 07
-
31 May 07
-
30 May 07
-
The JVM's heap stores all objects created by an executing Java program.
-
Garbage collection is the process of automatically freeing objects that are no longer referenced by the program.
-
"memory recycling."
-
The garbage collector must somehow determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.
-
In addition to freeing unreferenced objects, a garbage collector may also combat heap fragmentation.
-
New objects are allocated, and unreferenced objects are freed such that free blocks of heap memory are left in between blocks occupied by live objects.
-
This article does not describe an official Java garbage-collected heap, because none exists. The JVM specification says only that the heap of the Java virtual machine must be garbage collected. The specification does not define how the garbage collector must work. The designer of each JVM must decide how to implement the garbage-collected heap. This article describes various garbage collection techniques that have been developed
-
Garbage collection relieves programmers from the burden of freeing allocated memory.
-
The JVM has to keep track of which objects are being referenced by the executing program, and finalize and free unreferenced objects on the fly.
-
A second advantage of garbage collection is that it helps ensure program integrity. Garbage collection is an important part of Java's security strategy. Java programmers are unable to accidentally (or purposely) crash the JVM by incorrectly freeing memory.
-
A potential disadvantage of a garbage-collected heap is that it adds an overhead that can affect program performance.
-
In addition, programmers in a garbage-collected environment have less control over the scheduling of CPU time devoted to freeing objects that are no longer needed.
-
Java's garbage collector runs in its own thread
-
Any garbage collection algorithm must do two basic things. First, it must detect garbage objects. Second, it must reclaim the heap space used by the garbage objects and make it available to the program. Garbage detection is ordinarily accomplished by defining a set of roots and determining reachability from the roots. An object is reachable if there is some path of references from the roots by which the executing program can access the object. The roots are always accessible to the program. Any objects that are reachable from the roots are considered live. Objects that are not reachable are considered garbage, because they can no longer affect the future course of program execution.
-
In a JVM the root set is implementation dependent but would always include any object references in the local variables. In the JVM, all objects reside on the heap. The local variables reside on the Java stack, and each thread of execution has its own stack. Each local variable is either an object reference or a primitive type, such as int, char, or float. Therefore the roots of any JVM garbage-collected heap will include every object reference on every thread's stack. Another source of roots are any object references, such as strings, in the constant pool of loaded classes. The constant pool of a loaded class may refer to strings stored on the heap, such as the class name, superclass name, superinterface names, field names, field signatures, method names, and method signatures.
-
Any object referred to by a root is reachable and is therefore a live object. Additionally, any objects referred to by a live object are also reachable. The program is able to access any reachable objects, so these objects must remain on the heap. Any objects that are not reachable can be garbage collected because there is no way for the program to access them.
-
The JVM can be implemented such that the garbage collector knows the difference between a genuine object reference and a primitive type (for example, an int) that appears to be a valid object reference. However, some garbage collectors may choose not to distinguish between genuine object references and look-alikes. Such garbage collectors are called conservative because they may not always free every unreferenced object. Sometimes a garbage object will be wrongly considered to be live by a conservative collector, because an object reference look-alike refered to it. Conservative collectors trade off an increase in garbage collection speed for occasionally not freeing some actual garbage.
-
Two basic approaches to distinguishing live objects from garbage are reference counting and tracing. Reference counting garbage collectors distinguish live objects from garbage objects by keeping a count for each object on the heap. The count keeps track of the number of references to that object. Tracing garbage collectors, on the other hand, actually trace out the graph of references starting with the root nodes. Objects that are encountered during the trace are marked in some way. After the trace is complete, unmarked objects are known to be unreachable and can be garbage collected.
-
When an object is first created its reference count is set to one. When any other object or root is assigned a reference to that object, the object's count is incremented. When a reference to an object goes out of scope or is assigned a new value, the object's count is decremented. Any object with a reference count of zero can be garbage collected. When an object is garbage collected, any objects that it refers to has their reference counts decremented.
-
The basic tracing algorithm is called mark and sweep. This name refers to the two phases of the garbage collection process. In the mark phase, the garbage collector traverses the tree of references and marks each object it encounters. In the sweep phase unmarked objects are freed, and the resulting memory is made available to the executing program. In the JVM the sweep phase must include finalization of objects.
-
Garbage collectors of JVMs will likely have a strategy to combat heap fragmentation. Two strategies commonly used by mark and sweep collectors are compacting and copying.
-
Compacting collectors slide live objects over free memory space toward one end of the heap. In the process the other end of the heap becomes one large contiguous free area. All references to the moved objects are updated to refer to the new location.
-
Updating references to moved objects is sometimes made simpler by adding a level of indirection to object references. Instead of referring directly to objects on the heap, object references refer to a table of object handles. The object handles refer to the actual objects on the heap. When an object is moved, only the object handle must be updated with the new location. All references to the object in the executing program will still refer to the updated handle, which did not move. While this approach simplifies the job of heap defragmentation, it adds a performance overhead to every object access.
-
Copying garbage collectors move all live objects to a new area. As the objects are moved to the new area, they are placed side by side, thus eliminating any free spaces that may have separated them in the old area. The old area is then known to be all free space.
-
The advantage of this approach is that objects can be copied as they are discovered by the traversal from the root nodes. There are no separate mark and sweep phases.
-
Objects are copied to the new area on the fly, and forwarding pointers are left in their old locations. The forwarding pointers allow objects encountered later in the traversal that refer to already copied objects to know the new location of the copied objects.
-
A common copying collector is called stop and copy. In this scheme, the heap is divided into two regions. Only one of the two regions is used at any time. Objects are allocated from one of the regions until all the space in that region has been exhausted. At that point program execution is stopped and the heap is traversed. Live objects are copied to the other region as they are encountered by the traversal. When the stop and copy procedure is finished, program execution resumes. Memory will be allocated from the new heap region until it too runs out of space. At that point the program will once again be stopped. The heap will be traversed and live objects will be copied back to the original region. The cost associated with this approach is that twice as much memory is needed for a given amount of heap space because only half of the available memory is used at any time.
-
-
17 May 07
-
19 Apr 07
-
17 Apr 07
-
16 Apr 07
-
28 Mar 07
-
Query complex Java object trees using the XPath expression language
-
-
23 Feb 07
-
01 Feb 07
-
The Maven 2 POM demystified
The evolution of a project model
-
An introduction to Maven 2
-
-
10 Jan 07
-
27 Dec 06
-
23 Dec 06
-
12 Dec 06
-
24 Nov 06
-
19 Nov 06
-
16 Nov 06
-
08 Nov 06
-
28 Oct 06
-
23 Oct 06
-
10 Oct 06
Page Comments
I have not read the complete article but the headings and the introduction suggest that it could be worth a read for those who want to know why to use ANT
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.