!--a11y-->
Characteristics of a Remote
Object 
A remote object is an object that defines methods, which can be called by a client located in a remote Java Virtual Machine (JVM). A remote object implements one or more remote interfaces that declare remote methods of the object.
From RMI-P4 perspective, a remote interface is any interface that inherits the java.rmi.Remote interface, either directly or indirectly. Each method that such an interface or its superior interfaces define is considered a remote method.

Here is an example of a remote interface that directly inherits java.rmi.Remote, and which defines three remote methods:
|
public interface Account extends java.rmi.Remote { public void deposit(int amount); public void draw (int amount) throws OverdrawException; public int getBalance() throws java.rmi.RemoteException; } |

According to the RMI-P4 definition of a remote method, it is not mandatory to throw java.rmi.RemoteException (as opposed to the RMI specification, which requires remote objects to throw such an exception). However, we do recommend that you declare RemoteException in the throw clauses of your remote methods for the sake of consistency in exception handling. Also, this avoids the possibility of getting a com.sap.engine.services.rmi_p4.P4RuntimeException exception when the methods are executed.

Here is an example of a remote interface that inherits both a non-remote interface and a java.rmi.Remote interface.
Assume we have the following interface:
|
public interface Parent { public void method1(); public void method2() throws java.rmi.RemoteException; public void method3() throws UserException; } |
The following interface inherits the Parent interface, along with the java.rmi.Remote:
|
public interface Child extends Parent, java.rmi.Remote { } |
According to the rule above, all the methods of the Parent interface are valid remote methods.
This remote interface must be then implemented. You do this by following several guidelines:
· The implementation class can implement one or more remote interfaces.
· The implementation class can inherit other remote objects.
· The implementation class can declare methods that are not declared by a remote object; those methods can be called locally only.
A parameter that is sent to or returned from a remote object can be any serializable object. These are the primitive Java types, the remote objects, and non-remote objects that implement java.io.Serializable.
