Search in sources :

Example 1 with ObjectWrapper

use of isf.logic.ObjectWrapper in project isf-jclient by mikrohash.

the class NodeManager method getNodeInfo.

public static GetNodeInfoResponse getNodeInfo(final int parApi, boolean tryMultipleTimes) {
    final ObjectWrapper api = new ObjectWrapper(parApi);
    final ObjectWrapper res = new ObjectWrapper(null);
    TimeAbortCall tb = new TimeAbortCall("requesting node info", 0) {

        @Override
        public boolean onCall() {
            try {
                res.o = apis[(int) api.o].getNodeInfo();
                return true;
            } catch (Throwable e) {
                api.o = handleThrowableFromIotaAPI("receive getNodeInfo", e, (int) api.o);
                return false;
            }
        }
    };
    do {
        tb.call(NODEINFO_DURATION_TOLERANCE);
    } while (tryMultipleTimes);
    return (GetNodeInfoResponse) res.o;
}
Also used : TimeAbortCall(isf.logic.TimeAbortCall) ObjectWrapper(isf.logic.ObjectWrapper) GetNodeInfoResponse(jota.dto.response.GetNodeInfoResponse)

Aggregations

ObjectWrapper (isf.logic.ObjectWrapper)1 TimeAbortCall (isf.logic.TimeAbortCall)1 GetNodeInfoResponse (jota.dto.response.GetNodeInfoResponse)1