Remote Object


The remote object is the active instance of the remote server class. The remote object must implement the remote interface. Specific requirements on the implementation are only required by J2SE. A WebLogic implementation does not require extending the UnicastRemoteObject base class and does not require each method to throw RemoteException .

Java 2 Standard Edition Remote Object

The remote object provides the implementation for the remotely accessible object. A J2SE implementation must extend the java.rmi.server.UnicastRemoteObject . It must also implement the remote interface that was created for it. The following is a summary of the rules that apply to a J2SE remote object:

  • It extends java.rmi.server.UnicastRemoteObject .

  • It implements the remote interface that was created for it.

  • The explicitly written default constructor throws java.rmi.RemoteException , even if the constructor does nothing else. This is true because the base class super() constructor, which is automatically called, throws RemoteException .

  • The main() method must construct the remote object and register it with the rmiregistry using Naming.bind() or Naming.rebind() .

  • The main() method must install a security manager if the remote object is bound to a network host. You should not install a security manager if localhost is being used. To install the RMISecurityManager , add the following code to the beginning of the main() method:

     
     System.setSecurityManager( new RMISecurityManager() ); 

The JVM that is serving the registered remote object will continue to run after the main() method returns. It runs because the remote object is being served by another thread, allowing RMI clients continued access to the running remote object as long as the Java process that loaded the remote object is running.

WebLogic Remote Object

In WebLogic, there is no requirement to extend UnicastRemoteObject . As a result, you can utilize a logical object hierarchy. In addition, each method in the interface does not need to declare a java.rmi.RemoteException in its throws block. Exceptions that your application throws can be specific to that application and can extend RuntimeException . Finally, no Security Manager is required. All WebLogic RMI services are provided by the WebLogic Server, which provides more sophisticated security options, such as Secure Sockets Layer (SSL) and Access Control Lists (ACLs). You can remove the call to setSecurityManager() when converting RMI code to WebLogic RMI.



BEA WebLogic Platform 7
BEA WebLogic Platform 7
ISBN: 0789727129
EAN: 2147483647
Year: 2003
Pages: 360

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net