home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
Hello8Server.java
< prev
next >
Wrap
Text File
|
1997-09-06
|
1KB
|
53 lines
/*
* Hello8Server.java
*
* This file is a modification of the Hello7Server.java
* in rmi1 sample. The added modification here is that
* the Hello8Server creates and bootstraps an rmi registry
* within its code so that there is no need to start up
* rmiregistry.
*/
package samples.rmi2;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.util.Date;
public class Hello8Server extends UnicastRemoteObject implements Hello8
{
public Hello8Server() throws RemoteException
{
super();
}
public String printHello() throws RemoteException
{
return( "Howdy!" );
}
public Date getTime() throws RemoteException
{
return( new Date( System.currentTimeMillis() ) );
}
public static void main( String args[] )
{
System.setSecurityManager( new RMISecurityManager() );
try
{
LocateRegistry.createRegistry( 1099 );
Hello8Server server = new Hello8Server();
Naming.rebind( "Hello8Server", server );
System.out.println( "Hello8Server : bound in registry" );
}
catch( Exception e )
{
System.out.println( e.toString() );
}
}
}