• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package sample.rmi;
2 
3 import javassist.tools.rmi.AppletServer;
4 import java.io.IOException;
5 import javassist.CannotCompileException;
6 import javassist.NotFoundException;
7 
8 public class Counter {
9     private int count = 0;
10 
get()11     public int get() {
12 	return count;
13     }
14 
increase()15     synchronized public int increase() {
16 	count += 1;
17 	return count;
18     }
19 
main(String[] args)20     public static void main(String[] args)
21 	throws IOException, NotFoundException, CannotCompileException
22     {
23 	if (args.length == 1) {
24 	    AppletServer web = new AppletServer(args[0]);
25 	    web.exportObject("counter", new Counter());
26 	    web.run();
27 	}
28 	else
29 	    System.err.println(
30 			"Usage: java sample.rmi.Counter <port number>");
31     }
32 }
33