Strumenti Utente

Strumenti Sito


lpr-b-2007-2008:ccremoto
package ccRMI;
 
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
 
public class CC extends UnicastRemoteObject implements InterfacciaCC {
 
 
	private static final long serialVersionUID = 1L;
 
	private long cc = 0L;
 
	protected CC() throws RemoteException {
		super();
	}
 
	public synchronized long prelievo(long quanto) throws RemoteException {
		if(quanto <= cc) {
			cc -= quanto;
			return (cc);
		} else 
			return -cc;
	}
 
	public synchronized long saldo() throws RemoteException {
		return cc;
	}
 
	public synchronized long versa(long quanto) throws RemoteException {
		cc += quanto;
		return cc;
	}
 
}
lpr-b-2007-2008/ccremoto.txt · Ultima modifica: 19/09/2008 alle 14:08 (11 anni fa) (modifica esterna)