com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kmf-jsonrpcconnector-client Show documentation
Show all versions of kmf-jsonrpcconnector-client Show documentation
JSON-RPC Protocol with transports based on http and websocket
/*
* (C) Copyright 2013 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
package com.kurento.kmf.jsonrpcconnector.internal.client;
import static com.kurento.kmf.jsonrpcconnector.JsonUtils.INJECT_SESSION_ID;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import com.kurento.kmf.jsonrpcconnector.Session;
import com.kurento.kmf.jsonrpcconnector.Transaction;
import com.kurento.kmf.jsonrpcconnector.client.RequestAlreadyRespondedException;
import com.kurento.kmf.jsonrpcconnector.internal.message.*;
public class TransactionImpl implements Transaction {
public interface ResponseSender {
void sendResponse(Message message) throws IOException;
}
private final Session session;
private boolean async;
private final AtomicBoolean responded = new AtomicBoolean(false);
private final ResponseSender responseSender;
private final Request> request;
public TransactionImpl(Session session, Request> request,
ResponseSender responseSender) {
super();
this.session = session;
this.responseSender = responseSender;
this.request = request;
}
@Override
public void sendResponse(Object result) throws IOException {
boolean notResponded = setRespondedIfNot();
if (notResponded) {
Response
© 2015 - 2025 Weber Informatics LLC | Privacy Policy