Merge pull request #5863 from dkapil/task/BAEL-10876

BAEL-10876 Removed corrupted RMI module
This commit is contained in:
Loredana Crusoveanu 2018-12-08 18:05:31 +02:00 committed by GitHub
commit ef75f0cfc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 67 deletions

View File

@ -1 +0,0 @@
## Relevant articles:

View File

@ -1,3 +0,0 @@
grant {
permission java.security.AllPermission;
};

View File

@ -1,3 +0,0 @@
grant {
permission java.security.AllPermission;
};

View File

@ -1,20 +0,0 @@
package org.baeldung;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
public class Client {
public static void main(String[] args) throws RemoteException, NotBoundException {
System.setProperty("java.security.policy", "file:./client.policy");
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
String name = "RandomNumberGenerator";
Registry registry = LocateRegistry.getRegistry();
RandomNumberGenerator randomNumberGenerator = (RandomNumberGenerator) registry.lookup(name);
int number = randomNumberGenerator.get();
System.out.println("Received random number:" + number);
}
}

View File

@ -1,8 +0,0 @@
package org.baeldung;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RandomNumberGenerator extends Remote{
int get() throws RemoteException;
}

View File

@ -1,10 +0,0 @@
package org.baeldung;
import java.rmi.RemoteException;
public class RandomNumberGeneratorEngine implements RandomNumberGenerator {
@Override
public int get() throws RemoteException {
return (int) (100 * Math.random());
}
}

View File

@ -1,22 +0,0 @@
package org.baeldung;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class Server {
public static void main(String[] args) throws RemoteException {
System.setProperty("java.security.policy", "file:./server.policy");
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
String name = "RandomNumberGenerator";
RandomNumberGenerator randomNumberGenerator = new RandomNumberGeneratorEngine();
RandomNumberGenerator stub =
(RandomNumberGenerator) UnicastRemoteObject.exportObject(randomNumberGenerator, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
System.out.println("RandomNumberGenerator bound");
}
}