package com.antbang.rmilab;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author GAGA
*/
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
import java.util.Properties;
public class MyRMIImpl extends UnicastRemoteObject implements MyRMIInterface
{
public MyRMIImpl(String name) throws RemoteException
{
super();
try
{
Naming.rebind(name, this);
} catch (Exception e)
{
System.out.println("Exception occurred: " + e);
}
}
public Date getDate()
{
return new java.util.Date();
}
public String getDiscription()
{
StringBuilder hostDescription = new StringBuilder();
Properties properties=System.getProperties();
for (Object key : properties.keySet())
{
if(properties.get(key).toString().length()>30)
continue;
hostDescription.append(key+""+" : ");
hostDescription.append(properties.get(key)+"\n");
}
return hostDescription.toString();
}
public void sendMessage(Message message) throws RemoteException
{
System.out.println(message);
}
}
评论0