화일로 저장을 안하기 때문에 resin 이 죽으면 데이터가 날라가지만 -_-; 암튼 간단하게 구현할 수 있는 counter.
Counter ¶
~cpp
import com.caucho.hessian.server.HessianServlet;
public class RpcCounter extends HessianServlet implements Count {
int counter=0;
public int getCount() {
return counter;
}
public void count() {
counter++;
}
public void dec() {
counter--;
}
public void reset() {
counter =0;
}
}
Client ¶
~cpp
>>> from hessianlib import Hessian
>>> counter = Hessian("http://localhost:8080/servlet/RpcCounter")
>>> counter.getCount()
2
>>> counter.count()
>>> counter.getCount()
3
>>>