-
Notifications
You must be signed in to change notification settings - Fork 1
/
Server.java
33 lines (33 loc) · 1003 Bytes
/
Server.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.*;
import java.text.*;
public class Server extends BankImplementation
{
public Server() {}
public static void main(String args[])
{
BankImplementation bank;
BankInterface stub;
Registry registry;
try
{
// Instantiating the implementation class
bank = new BankImplementation();
// Exporting the object of implementation class
// (here we are exporting the remote object to the stub)
stub = (BankInterface) UnicastRemoteObject.exportObject(bank, 0);
// Binding the remote object (stub) in the registry
registry = LocateRegistry.getRegistry();
registry.bind("BankInterface", stub);
System.err.println("Server ready");
}
catch (Exception e)
{
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
}