| Method from sun.rmi.server.MarshalInputStream Detail: |
public void close() throws IOException {
done();
super.close();
}
Closes this stream, implicitly invoking done() first. |
public void done() {
Iterator< Runnable > iter = doneCallbacks.values().iterator();
while (iter.hasNext()) { // not thread-safe
Runnable callback = iter.next();
callback.run();
}
doneCallbacks.clear();
}
Indicates that the user of this MarshalInputStream is done reading
objects from it, so all callbacks registered with the setDoneCallback
method should now be (synchronously) executed. When this method
returns, there are no more callbacks registered.
This method is implicitly invoked by close() before it delegates to
the superclass's close method. |
public Runnable getDoneCallback(Object key) {
return doneCallbacks.get(key); // not thread-safe
}
Returns a callback previously registered via the setDoneCallback
method with given key, or null if no callback has yet been registered
with that key. |
protected Object readLocation() throws ClassNotFoundException, IOException {
return readObject();
}
Return the location for the class in the stream. This method can
be overridden by subclasses that store this annotation somewhere
else than as the next object in the stream, as is done by this class. |
protected Class resolveClass(ObjectStreamClass classDesc) throws ClassNotFoundException, IOException {
/*
* Always read annotation written by MarshalOutputStream
* describing where to load class from.
*/
Object annotation = readLocation();
String className = classDesc.getName();
/*
* Unless we were told to skip this consideration, choose the
* "default loader" to simulate the default ObjectInputStream
* resolveClass mechanism (that is, choose the first non-null
* loader on the execution stack) to maximize the likelihood of
* type compatibility with calling code. (This consideration
* is skipped during server parameter unmarshalling using the 1.2
* stub protocol, because there would never be a non-null class
* loader on the stack in that situation anyway.)
*/
ClassLoader defaultLoader =
skipDefaultResolveClass ? null : latestUserDefinedLoader();
/*
* If the "java.rmi.server.useCodebaseOnly" property was true or
* useCodebaseOnly() was called or the annotation is not a String,
* load from the local loader using the "java.rmi.server.codebase"
* URL. Otherwise, load from a loader using the codebase URL in
* the annotation.
*/
String codebase = null;
if (!useCodebaseOnly && annotation instanceof String) {
codebase = (String) annotation;
}
try {
return RMIClassLoader.loadClass(codebase, className,
defaultLoader);
} catch (AccessControlException e) {
return checkSunClass(className, e);
} catch (ClassNotFoundException e) {
/*
* Fix for 4442373: delegate to ObjectInputStream.resolveClass()
* to resolve primitive classes.
*/
try {
if (Character.isLowerCase(className.charAt(0)) &&
className.indexOf('.") == -1)
{
return super.resolveClass(classDesc);
}
} catch (ClassNotFoundException e2) {
}
throw e;
}
}
resolveClass is extended to acquire (if present) the location
from which to load the specified class.
It will find, load, and return the class. |
protected Class resolveProxyClass(String[] interfaces) throws ClassNotFoundException, IOException {
/*
* Always read annotation written by MarshalOutputStream.
*/
Object annotation = readLocation();
ClassLoader defaultLoader =
skipDefaultResolveClass ? null : latestUserDefinedLoader();
String codebase = null;
if (!useCodebaseOnly && annotation instanceof String) {
codebase = (String) annotation;
}
return RMIClassLoader.loadProxyClass(codebase, interfaces,
defaultLoader);
}
resolveProxyClass is extended to acquire (if present) the location
to determine the class loader to define the proxy class in. |
public void setDoneCallback(Object key,
Runnable callback) {
//assert(!doneCallbacks.contains(key));
doneCallbacks.put(key, callback); // not thread-safe
}
Registers a callback to make when this stream's done() method is
invoked, along with a key for retrieving the same callback instance
subsequently from the getDoneCallback method. |
void skipDefaultResolveClass() {
skipDefaultResolveClass = true;
}
Set a flag to indicate that the superclass's default resolveClass()
implementation should not be invoked by our resolveClass(). |
void useCodebaseOnly() {
useCodebaseOnly = true;
}
Disable code downloading except from the URL specified by the
"java.rmi.server.codebase" property. |