/** * Request permits from the limiter server. The returned {@link PermitAllocation} specifies the number of permits * that the client can use. */ public PermitAllocation getSync(ComplexResourceKey<PermitRequest, EmptyRecord> key) { try { FutureCallback<PermitAllocation> callback = new FutureCallback<>(); get(key, callback); return callback.get(); } catch (ExecutionException ee) { Throwable t = ee.getCause(); if (t instanceof RestLiServiceException) { throw (RestLiServiceException) t; } else { throw new RuntimeException(t); } } catch (InterruptedException ie) { throw new RuntimeException(ie); } } }
/** * Request permits from the limiter server. The returned {@link PermitAllocation} specifies the number of permits * that the client can use. */ public PermitAllocation getSync(ComplexResourceKey<PermitRequest, EmptyRecord> key) { try { FutureCallback<PermitAllocation> callback = new FutureCallback<>(); get(key, callback); return callback.get(); } catch (ExecutionException ee) { Throwable t = ee.getCause(); if (t instanceof RestLiServiceException) { throw (RestLiServiceException) t; } else { throw new RuntimeException(t); } } catch (InterruptedException ie) { throw new RuntimeException(ie); } } }