U E D R , A S I H C RSS

Hessian/Counter

화일로 저장을 안하기 때문에 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
>>>
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:24
Processing time 0.0222 sec