GUI线程作业不是从callable调用的(GUI Thread job is not called from callable)
我试图从可调用的更新UI,但失败。 为什么是
System.out.println("UI thread.");
从未打电话? 我正在使用SWT。Callable<Boolean> callable = new Callable<Boolean>() { @Override public Boolean call() throws Exception { System.out.println("Executing Callable."); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { System.out.println("UI thread."); } }); System.out.println("End."); return true; } }; ExecutorService executor = Executors.newFixedThreadPool(10); executor.submit(callable);
I am trying to update the UI from a callable, but fail. Why is the
System.out.println("UI thread.");
never called? I am using SWT.Callable<Boolean> callable = new Callable<Boolean>() { @Override public Boolean call() throws Exception { System.out.println("Executing Callable."); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { System.out.println("UI thread."); } }); System.out.println("End."); return true; } }; ExecutorService executor = Executors.newFixedThreadPool(10); executor.submit(callable);
原文:https://stackoverflow.com/questions/14646450
更新时间:2023-05-31 08:05
最满意答案
感谢Brian,宣言现在有效。 我的函数的正确实现如下所示:
function To_Integer_Array(V: Integer_Vector) return Integer_Array is Temp_Arr: Integer_Array(1..Natural(V.Length)); begin for I in Temp_Arr'Range loop Temp_Arr(I) := V.Element(I); end loop; return Temp_Arr; end To_Integer_Array;
Thanks to Brian the declaration now works. The correct implementation for my function looks like this:
function To_Integer_Array(V: Integer_Vector) return Integer_Array is Temp_Arr: Integer_Array(1..Natural(V.Length)); begin for I in Temp_Arr'Range loop Temp_Arr(I) := V.Element(I); end loop; return Temp_Arr; end To_Integer_Array;
相关问答
更多-
就我个人而言,我会使用Python UDF,并且不会打扰其他任何事情: Vectors不是原生的SQL类型,所以会有这种或那种性能开销。 特别是这个过程需要两个步骤,首先将数据从外部类型转换为行 ,然后使用通用RowEncoder 将行 从内部表示 转换 为内部表示 。 任何下游ML Pipeline将比简单转换贵得多。 而且,它需要一个与上述相反的过程 但如果你真的想在这里找到其他的选择,你是: Scala UDF与Python包装器: 按照项目网站上的说明安装sbt 。 使用以下结构创建Scala包: ...
-
使用使用两个迭代器的vector构造函数,注意指针是有效的迭代器,并使用从数组到指针的隐式转换: int x[3] = {1, 2, 3}; std::vector
v(x, x + sizeof x / sizeof x[0]); test(v); 要么 test(std::vector (x, x + sizeof x / sizeof x[0])); 其中sizeof x / sizeof x[0]在这个上下文中显然是3 ; 这是获取数组中元素数量的通用方式。 请注意, x + ... -
如何在C ++中将向量转换为数组(How to convert vector to array)[2023-09-29]
有一个相当简单的技巧,因为规范现在保证向量存储其元素连续: std::vectorv; double* a = &v[0]; There's a fairly simple trick to do so, since the spec now guarantees vectors store their elements contiguously: std::vector v; double* a = &v[0]; -
除非您使用古老版本的jre,否则使用Vector无需修改。 我建议您迁移到List并相应地建立我的答案。 另外,我很困惑你为什么要转换为Integer。 你可以像这样直接在char []上工作。 您可以尝试以下输入,如[[4,2,6][....]] ArrayList
> table = new ArrayList >(); char[] chars = myString.toCharArray(); ArrayList 将Standard.Natural转换为Ada.Containers.Count_Type(Convert Standard.Natural to Ada.Containers.Count_Type)[2023-11-29]
对不起,我太愚蠢,不能真正阅读我所说的错误。 我尝试转换自然使用: Ada.Containers.Vectors.Count_Type(Bar_Natural) 这使得零感! 读取错误,看到Count_Type在包Ada.Containers中定义是很简单的。 因此正确的转换将是: Ada.Containers.Count_Type(Bar_Natural); 给予 Foo_Vector.Set_Length(Ada.Containers.Count_Type(Bar_Natural)); Sorry ...如果你将params传递给函数(而不是试图将结果传递回参数),那么非const'ness不是问题:你可以在需要cont char *任何地方使用char * 。 但是你有双指针问题 - const char **等。它们不会被隐式转换,因为它可能导致const违规。 您可以在C ++ FAQ Light中阅读解释。 在你的情况下,你可以创建一个vector,正如@aschepler所说。 顺便说一句, const char**不是“指向char的指针的const指针”,而是“指向 ... 您将永远了解它,因此无需在运行时询问。 You will always know it, so there is no need to ask at run-time.感谢Brian,宣言现在有效。 我的函数的正确实现如下所示: function To_Integer_Array(V: Integer_Vector) return Integer_Array is Temp_Arr: Integer_Array(1..Natural(V.Length)); begin for I in Temp_Arr'Range loop Temp_Arr(I) := V.Element(I); end loop; return Temp ...您不需要(也不应该)取消引用 - 您调用的函数需要数组,并传递它们的第一个元素。 使用 gsl_spline_init (spline, x_input_Array, y_input_Array, iNoOfPtsIni); You do not need (and should not) dereference - the function you call expects arrays, and you pass their first elements. Use gsl_spline_init (s ...虽然在Ada-2005/2012中Ada.Containers几乎肯定会取代它,但在Stepanov将其转换为C ++之前,您可能对STL的Ada前身感兴趣。 这是今天发布在comp.lang.ada上的。 如果你去Alex Stepanov的论文并向下滚动到“源代码”部分,第三个链接是“David R. Musser和Alexander A. Stepanov:Ada Generic Library”作为zip文件,解压缩和自述文件 。 由于它似乎是针对VAX / VMS Ada编译器并且是从1989年开 ...相关文章
更多- Callable接口实现Java多线程
- getOutputStream() has already been called for this response 问题
- 线程报错 thread
- 关于Thread类中的start()方法和run()方法
- Hadoop源码浅析——Job提交相关
- Nutch Job failed异常
- 引入thread后socket接受不了报文了
- Hadoop实现AbstractJob简化Job设置
- 提高Hadoop的mapreduce job效率笔记
- 一步一步掌握java的线程机制(二)----Thread的生命周期
最新问答
更多- 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
- 如何打破按钮上的生命周期循环(How to break do-while loop on button)
- C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
- 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
- 如何并排放置两个元件?(How to position two elements side by side?)
- 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
- 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
- Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
- 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
- 电脑高中毕业学习去哪里培训
- 电脑系统专业就业状况如何啊?
- IEnumerable
linq表达式(IEnumerable linq expressions) - 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
- Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
- 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
- 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
- 的?(The ? marks in emacs/haskell and ghc mode)
- 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
- 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
- 悬停时的图像转换(Image transition on hover)
- IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
- 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
- java分布式框架有哪些
- Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
- PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
- 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
- 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
- typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
- 武陟会计培训类的学校哪个好点?
- 从链接中删除文本修饰(Remove text decoration from links)