
org.brutusin.rpc.client.action.DelegatingHttpAction Maven / Gradle / Ivy
/*
* Copyright 2016 Ignacio del Valle Alles [email protected].
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.brutusin.rpc.client.action;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.brutusin.json.ParseException;
import org.brutusin.json.spi.JsonCodec;
import org.brutusin.json.spi.JsonNode;
import org.brutusin.json.spi.JsonSchema;
import org.brutusin.rpc.client.http.HttpEndpoint;
import org.brutusin.rpc.client.http.HttpResponse;
import org.brutusin.rpc.http.Cacheable;
import org.brutusin.rpc.http.HttpAction;
import org.brutusin.rpc.http.HttpServiceItem;
import org.brutusin.rpc.http.StreamResult;
/**
*
* @author Ignacio del Valle Alles [email protected]
*/
public class DelegatingHttpAction extends HttpAction {
private final HttpEndpoint endpoint;
private final String targetId;
private volatile HttpServiceItem si;
private volatile JsonSchema inputSchema;
private volatile JsonSchema outputSchema;
private volatile boolean loaded;
public DelegatingHttpAction(HttpEndpoint endpoint, String targetId) {
this.endpoint = endpoint;
this.targetId = targetId;
}
@Override
public boolean isActive() {
if (!loaded) {
synchronized (this) {
if (!loaded) {
try {
getServiceItem();
loaded = true;
} catch (Exception e) {
loaded = false;
}
}
}
}
return loaded;
}
@Override
public Cacheable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy