コード例 #1
0
        /// <summary>
        /// Invokes the proxy.
        /// </summary>
        /// <param name="method">Method.</param>
        /// <param name="args">Arguments.</param>
        /// <returns>
        /// Invocation result.
        /// </returns>
        private object InvokeProxyMethod(MethodBase method, object[] args)
        {
            using (var inStream = new PlatformMemoryStream(_memory.Allocate()))
                using (var outStream = new PlatformMemoryStream(_memory.Allocate()))
                {
                    // 1) Write to a stream
                    inStream.WriteBool(SrvKeepBinary); // WriteProxyMethod does not do this, but Java does

                    ServiceProxySerializer.WriteProxyMethod(_marsh.StartMarshal(inStream), method, args);

                    inStream.SynchronizeOutput();

                    inStream.Seek(0, SeekOrigin.Begin);

                    // 2) call InvokeServiceMethod
                    string   mthdName;
                    object[] mthdArgs;

                    ServiceProxySerializer.ReadProxyMethod(inStream, _marsh, out mthdName, out mthdArgs);

                    var result = ServiceProxyInvoker.InvokeServiceMethod(_svc, mthdName, mthdArgs);

                    ServiceProxySerializer.WriteInvocationResult(outStream, _marsh, result.Key, result.Value);

                    _marsh.StartMarshal(outStream).WriteString("unused"); // fake Java exception details

                    outStream.SynchronizeOutput();

                    outStream.Seek(0, SeekOrigin.Begin);

                    return(ServiceProxySerializer.ReadInvocationResult(outStream, _marsh, KeepBinary));
                }
        }
コード例 #2
0
        private long ServiceInvokeMethod(long memPtr)
        {
            using (var stream = IgniteManager.Memory.Get(memPtr).GetStream())
            {
                var svc = _handleRegistry.Get <IService>(stream.ReadLong(), true);

                string   mthdName;
                object[] mthdArgs;

                ServiceProxySerializer.ReadProxyMethod(stream, _ignite.Marshaller, out mthdName, out mthdArgs);

                var result = ServiceProxyInvoker.InvokeServiceMethod(svc, mthdName, mthdArgs);

                stream.Reset();

                ServiceProxySerializer.WriteInvocationResult(stream, _ignite.Marshaller, result.Key, result.Value);

                stream.SynchronizeOutput();

                return(0);
            }
        }
コード例 #3
0
        private void ServiceInvokeMethod(void *target, long svcPtr, long inMemPtr, long outMemPtr)
        {
            SafeCall(() =>
            {
                using (var inStream = IgniteManager.Memory.Get(inMemPtr).GetStream())
                    using (var outStream = IgniteManager.Memory.Get(outMemPtr).GetStream())
                    {
                        var svc = _handleRegistry.Get <IService>(svcPtr, true);

                        string mthdName;
                        object[] mthdArgs;

                        ServiceProxySerializer.ReadProxyMethod(inStream, _ignite.Marshaller, out mthdName, out mthdArgs);

                        var result = ServiceProxyInvoker.InvokeServiceMethod(svc, mthdName, mthdArgs);

                        ServiceProxySerializer.WriteInvocationResult(outStream, _ignite.Marshaller, result.Key, result.Value);

                        outStream.SynchronizeOutput();
                    }
            });
        }