问题标签 [active-objects]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - To use Active object or not?
The active object design pattern as I understand is tying up a (private/dedicated) thread life time with an object and making it work on independent data. From some of the documentation I read , the evolution of this kind of paradigm was because of two reasons , first , managing raw threads would be pain and second more threads contending for the shared resource doesn't scale well using mutex and locks. while I agree with the first reason , I do not fully comprehend the second . Making an object active just makes the object independent but the problems like contention for lock/mutex is still there (as we still have shared queue/buffer), the object just delegated the sharing responsibility onto the message queue. The only advantage of this design pattern as i see is the case where I had to perform long asynch task on the shared object (now that i am just passing message to a shared queue , the threads no longer have to block for long on mutex/locks but they still will blocka and contend for publishing messages/task). Other than this case could someone tell more scenarios where this kind of design pattern will have other advantages.
The second question I have is (I just started digging around design patterns) , what is the conceptual difference between , active object , reactor and proactor design pattern . How do you decide in which design pattern is more efficient and suits your requirements more. It would be really nice if someone can demonstrate certain examples showing how the three design patterns will behave and which one has comparative advantage/disadvantage in different scenarios.
I am kind of confused as I have used active object (which used shared thread-safe buffer) and boost::asio(Proactor) both to do similar kind of async stuff , I would like to know if any one has more insights on applicability of different patterns when approaching a problem.
java - 使用 JAXB 编组活动对象?
我正在尝试编组一个将 Thread 扩展为 XML 的类,代码如下:
}
这导致我出现这个错误:com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
java.lang.Thread$UncaughtExceptionHandler is an interface, and JAXB can't handle interfaces. ... java.lang.Thread$UncaughtExceptionHandler does not have a no-arg default constructor.
如果我正确理解这一点,它扩展 Thread 的事实会导致这个问题,但我还没有在网上看到解决方案。
除了使类成为实现可运行的对象之外,有没有人知道解决方案或解决方法?
java - TransactionCallback 类型不是通用的;它不能用参数 [Ao 实体] 参数化
在下面的内容中,向我显示了一个错误,因为“TransactionCallback 类型不是通用的;它不能用参数参数化”在 Eclipse 编辑器中。
我的 JAVASE 版本是 - 1.7.0
知道为什么它不采用通用对象吗?
java - 如何在活动对象实体中编写更新查询
我们如何编写更新实体 ActiveObject - com.atlassian.activeobjects.external.ActiveObjects。
任何人请分享我的东西。
我正在使用如下创建实体活动对象的东西,它工作正常:
谢谢
java - 面临查询错误为“HSQL Database : Unexpected token: END in statement”的问题
我创建了一个活动对象查询,如下所示:
但它给了我以下错误:
活动对象库引发 SQL 异常:数据库:-名称:HSQL 数据库引擎-版本:1.8.0-次要版本:8-主要版本:1 驱动程序:-名称:HSQL 数据库引擎驱动程序-版本:1.8。 0 java.sql.SQLException:意外的令牌:语句中的END [SELECT * FROM PUBLIC.AO_0371A8_IP WHERE user =?并开始>=?和结束<=?]
创建实体的东西如下:
我的实体如下所示:
任何想法?
java - 无法查询特定范围内的日期条件
我想从 HSQL 数据库中获取记录,查询如下:
现在,它给了我一个错误,“To_DATE”不是有效的关键字,如下所示:
如果我删除“To_date”,那么即使数据库中存在数据,我也不会从数据中获取正确的结果数据并且仅返回 null。数据库中日期字段值的格式为“2013-05-15 00:00:00.000000000”
任何人都可以分享我查询数据库的任何替代方法吗?
java - 如何创建活动对象“IN”条件查询
我当前的查询如下,它适用于单个用户:
现在,我想更改此查询以获取多用户数据,如下所示,但它不起作用并且给了我无效的列名。
此外,尝试通过应用单引号。即使是单个用户输入参数值也无法正常工作并给出相同的错误。
任何人都可以建议我出了什么问题并且必须在这里纠正吗?
错误为 ,
或 when - where("used "('?')" 并为单个用户验证
谢谢你
java - 无法在休息服务中检测到活动对象接口
我的活动对象界面如下:
现在,我的休息服务班如下:
在上面的内容中,我突出显示了“** .... **”这一行,这在执行“atlas-run”时引发了一个错误,错误如下:
你能建议我这里有什么问题吗?
此外,文件名是“TaskData.java”,与它的活动对象接口名称相同。(在上面的内容中,我已经为“TaskData”提供了完整的限定名称但没有工作,之前,我只保留了“TaskData”并通过导入的命名空间引用)。
(使用 Eclipse 编辑器和 atlas-sdk 4.1.4)。
笔记:
一种奇怪的行为是,它可以工作一段时间但不是每次都有效,通常,每当我遇到错误时,删除“TaskData”界面中的一些空格或行并休息服务类然后它就可以工作了)
java - 如何沿对角线移动可见图像?
我一直在试图弄清楚如何使可见图像在小程序窗口中对角移动。
如果您按向上、向下、向左或向右,图像(gif)会相应移动,但是如果您尝试同时按两个键(例如同时向上和向右),图像只会沿您按下的方向移动秒(即使您同时按下按键仍然存在微观延迟)。
可能有一种我不知道的简单方法可以解决此问题,或者可能有人已经找到了解决方法...我感谢可以提供的任何帮助或建议。
谢谢
英雄类(这个类定义了“英雄”是什么;在这种情况下是一个简单的像素人,以及他能做什么)
HeroGame 类(该类创建“英雄”并指定位置,以及用于使他移动的键)
再次感谢您花时间阅读本文并希望有所帮助。
design-patterns - 建模为单个对象的活动对象模式建模
我正在以下位置阅读有关活动对象的文章
http://www.cs.wustl.edu/~schmidt/PDF/Act-Obj.pdf
本文描述了主动对象模式,它将方法执行与方法调用分离,以简化对驻留在其自己的控制线程中的对象的同步访问。主动对象模式允许一个或多个独立的执行线程交错访问建模为单个对象的数据。种类繁多的生产者/消费者和读取器/写入器应用程序非常适合这种并发模型。
我了解方法执行如何解耦方法调用。
我的问题是作者的意思是活动对象模式如何允许一个或多个独立的执行线程交错访问建模为单个对象的数据?
请求给出一个示例,说明作者将数据建模为单个对象的含义以及在这种情况下线程如何交错。
感谢您的时间和帮助。