Search in sources :

Example 1 with JRTClientConfigRequest

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;
}
Also used : JRTClientConfigRequest(com.yahoo.vespa.config.protocol.JRTClientConfigRequest) ConfigInterruptedException(com.yahoo.config.subscription.ConfigInterruptedException) ConfigInterruptedException(com.yahoo.config.subscription.ConfigInterruptedException)

Example 2 with JRTClientConfigRequest

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);
}
Also used : JRTClientConfigRequest(com.yahoo.vespa.config.protocol.JRTClientConfigRequest)

Example 3 with JRTClientConfigRequest

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());
}
Also used : JRTClientConfigRequest(com.yahoo.vespa.config.protocol.JRTClientConfigRequest)

Aggregations

JRTClientConfigRequest (com.yahoo.vespa.config.protocol.JRTClientConfigRequest)3 ConfigInterruptedException (com.yahoo.config.subscription.ConfigInterruptedException)1