public void Run(object obj) { #if NETFRAMEWORK LuaInstance lua = null; try { lua = LuaCache.GetInstance(); // Start thread queries to each node. StartThreads(); lua.LoadPackage(statement); object[] args = new object[4 + statement.functionArgs.Length]; args[0] = lua.GetFunction(statement.functionName); args[1] = 2; args[2] = new LuaInputStream(inputQueue, cancel.Token); args[3] = new LuaOutputStream(resultSet); int count = 4; foreach (Value value in statement.functionArgs) { args[count++] = value.Object; } lua.Call("apply_stream", args); } catch (Neo.IronLua.LuaRuntimeException lre) { // Try to get that elusive lua stack trace. HandleException(new Exception(lre.Message + lre.StackTrace)); } catch (Exception e) { if (e.InnerException is Neo.IronLua.LuaRuntimeException) { // Try to get that elusive lua stack trace. Neo.IronLua.LuaRuntimeException lre = e.InnerException as Neo.IronLua.LuaRuntimeException; HandleException(new Exception(lre.Message + lre.StackTrace)); } else { HandleException(e); } } finally { // Send end command to user's result set. // If query was already cancelled, this put will be ignored. resultSet.Put(ResultSet.END); if (lua != null) { LuaCache.PutInstance(lua); } } #else HandleException(new AerospikeException("Lua not supported in .NET core")); #endif }
public void Run(object obj) { LuaInstance lua = null; try { lua = LuaCache.GetInstance(); // Start thread queries to each node. StartThreads(); lua.LoadPackage(statement); object[] args = new object[4 + statement.functionArgs.Length]; args[0] = lua.GetFunction(statement.functionName); args[1] = 2; args[2] = new LuaInputStream(inputQueue, cancel.Token); args[3] = new LuaOutputStream(resultSet); int count = 4; foreach (Value value in statement.functionArgs) { args[count++] = value.Object; } lua.Call("apply_stream", args); } catch (LuaRuntimeException lre) { // Try to get that elusive lua stack trace. HandleException(new Exception(lre.Message + lre.StackTrace)); } catch (Exception e) { if (e.InnerException is LuaRuntimeException) { // Try to get that elusive lua stack trace. LuaRuntimeException lre = e.InnerException as LuaRuntimeException; HandleException(new Exception(lre.Message + lre.StackTrace)); } else { HandleException(e); } } finally { // Send end command to user's result set. // If query was already cancelled, this put will be ignored. resultSet.Put(ResultSet.END); if (lua != null) { LuaCache.PutInstance(lua); } } }