当前位置: 首页>>代码示例>>Java>>正文


Java IPendingServiceCall类代码示例

本文整理汇总了Java中org.red5.server.api.service.IPendingServiceCall的典型用法代码示例。如果您正苦于以下问题:Java IPendingServiceCall类的具体用法?Java IPendingServiceCall怎么用?Java IPendingServiceCall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPendingServiceCall类属于org.red5.server.api.service包,在下文中一共展示了IPendingServiceCall类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handlePendingCallResult

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
/**
 * Handler for pending call result. Dispatches results to all pending call handlers.
 * 
 * @param conn
 *            Connection
 * @param invoke
 *            Pending call result event context
 */
protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) {
    final IServiceCall call = invoke.getCall();
    final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId());
    if (pendingCall != null) {
        // The client sent a response to a previously made call.
        Object[] args = call.getArguments();
        if (args != null && args.length > 0) {
            // TODO: can a client return multiple results?
            pendingCall.setResult(args[0]);
        }
        Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
        if (!callbacks.isEmpty()) {
            HashSet<IPendingServiceCallback> tmp = new HashSet<>();
            tmp.addAll(callbacks);
            for (IPendingServiceCallback callback : tmp) {
                try {
                    callback.resultReceived(pendingCall);
                } catch (Exception e) {
                    log.error("Error while executing callback {}", callback, e);
                }
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:33,代码来源:BaseRTMPHandler.java

示例2: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    String method = call.getServiceMethodName();
    log.debug("resultReceived: {}", method);
    if ("connect".equals(method)) {
        //rtmpClient.releaseStream(this, new Object[] { publishName });
        timer.schedule(new BandwidthStatusTask(), 2000L);
    } else if ("releaseStream".equals(method)) {
        //rtmpClient.invoke("FCPublish", new Object[] { publishName }, this);
    } else if ("createStream".equals(method)) {
        setState(StreamState.PUBLISHING);
        Object result = call.getResult();
        if (result instanceof Number) {
            streamId = (Number) result;
            log.debug("Publishing: {}", state);
            rtmpClient.publish(streamId, publishName, publishMode, this);
        } else {
            rtmpClient.disconnect();
            setState(StreamState.STOPPED);
        }
    } else if ("FCPublish".equals(method)) {

    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:25,代码来源:StreamingProxy.java

示例3: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    Number streamId = (Number) call.getResult();
    log.debug("CreateStreamCallBack resultReceived - stream id: {} call: {}", streamId, call);
    log.debug("Connection: {}", conn);
    if (conn != null && streamId != null) {
        log.debug("Setting new net stream");
        NetStream stream = new NetStream(streamEventDispatcher);
        stream.setConnection(conn);
        stream.setStreamId(streamId);
        conn.addClientStream(stream);
        NetStreamPrivateData streamData = new NetStreamPrivateData();
        streamData.outputStream = conn.createOutputStream(streamId);
        streamData.connConsumer = new ConnectionConsumer(conn, streamData.outputStream.getVideo(), streamData.outputStream.getAudio(), streamData.outputStream.getData());
        streamDataMap.put(streamId, streamData);
        log.debug("streamDataMap: {}", streamDataMap);
    }
    wrapped.resultReceived(call);
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:20,代码来源:BaseRTMPClientHandler.java

示例4: handlePendingCallResult

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
/**
 * Handler for pending call result. Dispatches results to all pending call
 * handlers.
 * 
 * @param conn
 *            Connection
 * @param invoke
 *            Pending call result event context
 */
protected void handlePendingCallResult(RTMPConnection conn, Notify invoke) {
	final IServiceCall call = invoke.getCall();
	final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getInvokeId());
	if (pendingCall != null) {
		// The client sent a response to a previously made call.
		Object[] args = call.getArguments();
		if (args != null && args.length > 0) {
			// TODO: can a client return multiple results?
			pendingCall.setResult(args[0]);
		}
		Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
		if (!callbacks.isEmpty()) {
			HashSet<IPendingServiceCallback> tmp = new HashSet<IPendingServiceCallback>();
			tmp.addAll(callbacks);
			for (IPendingServiceCallback callback : tmp) {
				try {
					callback.resultReceived(pendingCall);
				} catch (Exception e) {
					log.error("Error while executing callback {}", callback, e);
				}
			}
		}
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:34,代码来源:BaseRTMPHandler.java

示例5: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
	String method = call == null ? null : call.getServiceMethodName();
	logger.trace("call ### get Method Name " + method);
	if ("createStream".equals(method)) {
		if (call.getResult() != null) {
			publishScreen.setStreamId((Integer)call.getResult());
			publish(publishScreen.getStreamId(), id, "live", this);
			publishScreen.setStartPublish(true);
			publishScreen.start();
		} else {
			connectionClosed();
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:16,代码来源:RTMPClientPublish.java

示例6: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
	String method = call == null ? null : call.getServiceMethodName();
	System.err.println("method "+method);
	if (method == null) {
		return;
	}
	if ("connect".equals(method)) {
		isConnected = true;
	}

	if ("loadTestSyncMessage".equals(method)) {

		CallObject tCallObject = calls.get(counterCalls);
		if (tCallObject == null) {

			for (Entry<Integer, CallObject> tCallObjectEntry : calls.entrySet()) {

				System.err.println("Key " + tCallObjectEntry.getKey()
						+ "tCallObjectEntry "
						+ tCallObjectEntry.getValue().getStarted());

			}

			throw new RuntimeException(
					"tCallObject is null currentCountReturn "
							+ counterCalls + " list size "
							+ calls.size());
		}
		tCallObject.setEnded(new Date());
		calls.put(counterCalls, tCallObject);

		System.err.println("Call received " + counterCalls
				+ " instanceId: " + instanceId);

		counterCalls++;
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:39,代码来源:LoadTestRtmpClient.java

示例7: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
/**
 * Handle callback from service call.
 */
public void resultReceived(IPendingServiceCall call) {
    // if we aren't connection, skip any further testing
    if (Call.STATUS_NOT_CONNECTED != call.getStatus()) {

    } else {
        log.debug("Pending call skipped due to being no longer connected");
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:12,代码来源:ClientServerDetection.java

示例8: sendPendingServiceCallsCloseError

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
/**
 * When the connection has been closed, notify any remaining pending service calls that they have failed because the connection is
 * broken. Implementors of IPendingServiceCallback may only deduce from this notification that it was not possible to read a result for
 * this service call. It is possible that (1) the service call was never written to the service, or (2) the service call was written to
 * the service and although the remote method was invoked, the connection failed before the result could be read, or (3) although the
 * remote method was invoked on the service, the service implementor detected the failure of the connection and performed only partial
 * processing. The caller only knows that it cannot be confirmed that the callee has invoked the service call and returned a result.
 */
public void sendPendingServiceCallsCloseError() {
    if (pendingCalls != null && !pendingCalls.isEmpty()) {
        if (log.isDebugEnabled()) {
            log.debug("Connection calls pending: {}", pendingCalls.size());
        }
        for (IPendingServiceCall call : pendingCalls.values()) {
            call.setStatus(Call.STATUS_NOT_CONNECTED);
            for (IPendingServiceCallback callback : call.getCallbacks()) {
                callback.resultReceived(call);
            }
        }
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:22,代码来源:RTMPConnection.java

示例9: invoke

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
/** {@inheritDoc} */
public void invoke(String method, Object[] params, IPendingServiceCallback callback) {
    IPendingServiceCall call = new PendingCall(method, params);
    if (callback != null) {
        call.registerCallback(callback);
    }
    invoke(call);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:9,代码来源:RTMPConnection.java

示例10: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    System.out.println("resultReceived: " + call);
    Double streamId = (Double) call.getResult();
    System.out.println("stream id: " + streamId);
    // send our buffer size request
    if (sourceStreamName.endsWith(".flv") || sourceStreamName.endsWith(".f4v") || sourceStreamName.endsWith(".mp4")) {
        client.play(streamId, sourceStreamName, 0, -1);
    } else {
        client.play(streamId, sourceStreamName, -1, 0);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:13,代码来源:StreamRelay.java

示例11: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    System.out.println("connectCallback");
    ObjectMap<?, ?> map = (ObjectMap<?, ?>) call.getResult();
    String code = (String) map.get("code");
    System.out.printf("Response code: %s\n", code);
    if ("NetConnection.Connect.Rejected".equals(code)) {
        System.out.printf("Rejected: %s\n", map.get("description"));
        disconnect();
        finished = true;
    } else if ("NetConnection.Connect.Success".equals(code)) {
        invoke("demoService.getListOfAvailableFLVs", new Object[] {}, methodCallCallback);
        createStream(createStreamCallback);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:16,代码来源:ClientTest.java

示例12: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    log.debug("Received pending call: {}", call);
    Object result = call.getResult();
    if (result instanceof ObjectMap) {
        obj = getSharedObject(soName, false);
        obj.connect(Red5.getConnectionLocal());
        obj.addSharedObjectListener(this);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:11,代码来源:SharedObjectClient.java

示例13: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    System.out.println("resultReceived: " + call);
    Double streamId = (Double) call.getResult();
    System.out.println("stream id: " + streamId);
    // send our buffer size request
    client.play(streamId, sourceStreamName, 0, -1);
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:9,代码来源:RTMPClientTest.java

示例14: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    System.out.println("connectCallback");
    ObjectMap<?, ?> map = (ObjectMap<?, ?>) call.getResult();
    String code = (String) map.get("code");
    System.out.printf("Response code: %s\n", code);
    if ("NetConnection.Connect.Rejected".equals(code)) {
        System.out.printf("Rejected: %s\n", map.get("description"));
        disconnect();
        synchronized (RTMPTSClientTest.class) {
            finished = true;
            RTMPTSClientTest.class.notifyAll();
        }
    } else if ("NetConnection.Connect.Failed".equals(code)) {
        System.out.printf("Failed: %s\n", map.get("description"));
        disconnect();
        synchronized (RTMPTSClientTest.class) {
            finished = true;
            RTMPTSClientTest.class.notifyAll();
        }
    } else if ("NetConnection.Connect.Success".equals(code)) {
        test();
        createStream(createStreamCallback);
    } else {
        System.out.printf("Unhandled response code: %s\n", code);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:28,代码来源:RTMPTSClientTest.java

示例15: resultReceived

import org.red5.server.api.service.IPendingServiceCall; //导入依赖的package包/类
@Override
public void resultReceived(IPendingServiceCall call) {
    System.out.println("connectCallback");
    ObjectMap<?, ?> map = (ObjectMap<?, ?>) call.getResult();
    String code = (String) map.get("code");
    System.out.printf("Response code: %s\n", code);
    if ("NetConnection.Connect.Rejected".equals(code)) {
        System.out.printf("Rejected: %s\n", map.get("description"));
        disconnect();
        synchronized (RTMPTClientTest.class) {
            finished = true;
            RTMPTClientTest.class.notifyAll();
        }
    } else if ("NetConnection.Connect.Failed".equals(code)) {
        System.out.printf("Failed: %s\n", map.get("description"));
        disconnect();
        synchronized (RTMPTClientTest.class) {
            finished = true;
            RTMPTClientTest.class.notifyAll();
        }
    } else if ("NetConnection.Connect.Success".equals(code)) {
        test();
        createStream(createStreamCallback);
    } else {
        System.out.printf("Unhandled response code: %s\n", code);
    }
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:28,代码来源:RTMPTClientTest.java


注:本文中的org.red5.server.api.service.IPendingServiceCall类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。