home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Sample.bin
/
Hello7Server.java
< prev
next >
Wrap
Text File
|
1997-09-06
|
1KB
|
49 lines
/*
* Hello7Server.java
*
* class Hello7Server implements the remote interface
* Hello7 to identify it as a remote object.
* Methods printHello() and getTime() are remote methods
* for clients to call.
*/
package samples.rmi1;
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
public class Hello7Server extends UnicastRemoteObject implements Hello7
{
public Hello7Server() 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[] )
{
try
{
System.setSecurityManager( new RMISecurityManager() );
Hello7Server server = new Hello7Server();
Naming.rebind( "Hello7Server", server );
System.out.println( "Hello7Server : bound in registry" );
}
catch( Exception e )
{
System.out.println( e.toString() );
}
}
}