import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Computeapp extends Remote
{
Object executeTask(int i)throws RemoteException;
}
import java.rmi.*;
import java.rmi.server.*;
public class ComputeappEngine extends UnicastRemoteObject implements Computeapp
{
public ComputeappEngine()throws RemoteException
{
super();
}
public Object executeTask(int i)throws RemoteException
{
return i * i;
}
}
import java.rmi.*;
public class Client{
public static void main(String args[]){
try{
Computeapp comp=(Computeapp)Naming.lookup("//localhost/Computeapp");
System.out.println(comp.executeTask(4));
}
catch(Exception e){
System.err.println("computeappEngine Exception"+e.getMessage());
e.printStackTrace();
}
}
}
import java.rmi.*;
import java.rmi.server.*;
class Server1 extends UnicastRemoteObject{
public Server1()throws RemoteException
{
}
public static void main(String args[])throws RemoteException
{
String names = "//localhost/Computeapp";
try{
Computeapp engine = new ComputeappEngine();
Naming.rebind(names, engine);
System.out.println("computeappEngine bound");
}
catch(Exception e){
System.err.println("computeappEngine Exception"+e.getMessage());
e.printStackTrace();
}
}
}
import java.rmi.RemoteException;
public interface Computeapp extends Remote
{
Object executeTask(int i)throws RemoteException;
}
import java.rmi.*;
import java.rmi.server.*;
public class ComputeappEngine extends UnicastRemoteObject implements Computeapp
{
public ComputeappEngine()throws RemoteException
{
super();
}
public Object executeTask(int i)throws RemoteException
{
return i * i;
}
}
import java.rmi.*;
public class Client{
public static void main(String args[]){
try{
Computeapp comp=(Computeapp)Naming.lookup("//localhost/Computeapp");
System.out.println(comp.executeTask(4));
}
catch(Exception e){
System.err.println("computeappEngine Exception"+e.getMessage());
e.printStackTrace();
}
}
}
import java.rmi.*;
import java.rmi.server.*;
class Server1 extends UnicastRemoteObject{
public Server1()throws RemoteException
{
}
public static void main(String args[])throws RemoteException
{
String names = "//localhost/Computeapp";
try{
Computeapp engine = new ComputeappEngine();
Naming.rebind(names, engine);
System.out.println("computeappEngine bound");
}
catch(Exception e){
System.err.println("computeappEngine Exception"+e.getMessage());
e.printStackTrace();
}
}
}