Week 11 Flashcards
What is dynamic code loading in RMI?
Enables downloading class definitions along with object references during remote method invocation
Allows introducing new behaviors and types to a JVM at runtime
Requires that class definitions are available in a network-accessible location
What are class loaders in Java?
Responsible for loading classes into the JVM
Types of class loaders:
Bootstrap Class Loader: Loads core Java libraries
Extensions Class Loader: Loads from platform-specific extension directories
System Class Loader: Loads from the current directory or CLASSPATH
How does the class loading process work?
Precedence: Bootstrap → Extensions → System
Example process:
Y y = new Y();
is internally executed as:
Y y = X.class.getClassLoader().loadClass(“Y”).newInstance();
Can you develop custom class loaders?
Yes, by extending java.lang.ClassLoader
Enables adding new classes dynamically at runtime without restarting the application
Often leveraged by RMI for dynamic behavior
What are stubs in RMI?
Client-side proxies that represent remote objects
Implement the same interfaces as the remote object, enabling seamless method calls
What is the RMI architecture?
Application Layer: Contains client and server programs
Stub and Skeleton Layer: Handles method invocation and redirection
Remote Reference Layer: Manages remote object references
Transport Layer: Based on TCP/IP for communication
How do distributed and non-distributed models differ?
Distributed model:
Clients interact with remote interfaces, not implementation classes
Non-remote arguments/results are passed by copy
Remote objects are passed by reference
Remote method invocations can fail due to network or remote errors
How are distributed and non-distributed models similar?
Both can:
Pass remote object references as arguments or results
Use casting with remote interfaces
Use instanceof to check remote interface compatibility
What are the limitations of RMI?
Requires all class definitions to be accessible
Additional exceptions for remote invocations
Performance overhead due to serialization and network latency
How is RMI used in enterprise applications?
Enables distributed services across multiple machines
Supports dynamic runtime behavior through class loading
Common in thin-client architectures where the server handles most processing