use of com.yahoo.vespa.config.protocol.JRTClientConfigRequest in project vespa by vespa-engine.
the class JRTConfigSubscription method subscribe.
@Override
public boolean subscribe(long timeout) {
lastOK = System.currentTimeMillis();
requester = getRequester();
requester.request(this);
JRTClientConfigRequest req = reqQueue.peek();
while (req == null && (System.currentTimeMillis() - lastOK <= timeout)) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new ConfigInterruptedException(e);
}
req = reqQueue.peek();
}
return req != null;
}
use of com.yahoo.vespa.config.protocol.JRTClientConfigRequest in project vespa by vespa-engine.
the class JRTConfigRequester method scheduleNextRequest.
private void scheduleNextRequest(JRTClientConfigRequest jrtReq, JRTConfigSubscription<?> sub, long delay, long timeout) {
if (delay < 0)
delay = 0;
JRTClientConfigRequest jrtReqNew = jrtReq.nextRequest(timeout);
if (log.isLoggable(LogLevel.DEBUG)) {
log.log(LogLevel.DEBUG, "My timing values: " + timingValues);
log.log(LogLevel.DEBUG, "Scheduling new request " + delay + " millis from now for " + jrtReqNew.getConfigKey());
}
scheduler.schedule(new GetConfigTask(jrtReqNew, sub), delay, TimeUnit.MILLISECONDS);
}
use of com.yahoo.vespa.config.protocol.JRTClientConfigRequest in project vespa by vespa-engine.
the class JRTConfigRequester method request.
/**
* Requests the config for the {@link com.yahoo.config.ConfigInstance} on the given {@link ConfigSubscription}
*
* @param sub a subscription
*/
public <T extends ConfigInstance> void request(JRTConfigSubscription<T> sub) {
JRTClientConfigRequest req = JRTConfigRequestFactory.createFromSub(sub);
doRequest(sub, req, timingValues.getSubscribeTimeout());
}
Aggregations