THE Java™ Programming Language, Fourth Edition
} } // ... definition of other methods ... } Each new game creates a new PlayerLoader object to load the class for that run of t ...
classes will typically return null, indicating it was loaded by the bootstrap loader. You can get the parent class loader from t ...
protected final Class<?>defineClass(String name, byte[] data, int offset, int length)throws ClassFormatError Returns a Cla ...
Linking Verifying that the class's bytecodes conform to the language rules, preparing the virtual machine by allocating space fo ...
Resource names must be made up of one or more valid identifiers separated by / characters, specifying a path to the resource. Ty ...
found first by the system class loader or the bootstrap loader. Exercise 16.12: Modify your results for Exercise 16.11 to allow ...
are equivalent to the calls loader.setClassAssertionStatus("com.acme.Evaluator", false); loader.setPackageAssertionStatus("com.a ...
something completely different from what the object thought it referenced. This situation could cause all manner of havoc when t ...
understand garbage collection. Each virtual machine has its own collection strategy, and some let you choose among several. Use ...
} // ... public synchronized void close() throws IOException { if (file != null) { file.close(); file = null; } } protected void ...
However, the virtual machine invokes finalize at most once on any object, even if that object becomes unreachable more than once ...
and you reduce the likelihood of the garbage collector running during the task. Here is a method that aggressively frees everyth ...
17.5.1. The Reference Class The classes for the reference object types are contained in the package java.lang.ref. The primary c ...
strong references becomes unreachable when it is no longer strongly reachable. The reachability stages of an object trigger beha ...
// don't remember it, read it in data = readBytesFromFile(file); lastFile = file; lastData = new WeakReference<byte[]>(dat ...
Creates a new reference object with the given referent and registered with the given queue. Both weak and soft references are en ...
determine which piece of code is responsible for returning the resource. To deal with this situation, the resource manager can a ...
final ReferenceQueue queue; final Map<Reference<?>, Resource> refs; final Thread reaper; boolean shutdown = false; p ...
break; // all done } } } } ReaperThread is an inner class, and a given reaper thread runs until its associated resource manager ...
the field no longer refers to it. This approach also covers the case of inner class objectsan inner class instance is reachable ...
«
14
15
16
17
18
19
20
21
22
23
»
Free download pdf