-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
29 lines (27 loc) · 884 Bytes
/
Server.java
File metadata and controls
29 lines (27 loc) · 884 Bytes
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
/**
* Server side of the Share Market
*
* @author Yoan Ribeiro
*/
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
public class Server
{
public static void main ( String[] args )
{
if (System.getSecurityManager() == null)
System.setSecurityManager( new RMISecurityManager() );
try
{
//Registry registry = LocateRegistry.getRegistry()
StockFactoryManager manager = (StockFactoryManager)Naming.lookup("rmi://localhost/manager");
Broker broker = new BrokerImpl( manager );
//registry.bind("broker",broker);
Naming.rebind("//localhost/broker", broker);
System.out.println("Broker added to Naming Server...");
}
catch(Exception e){ e.printStackTrace(); }
}
}