问题标签 [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.

0 投票
4 回答
6138 浏览

java - 使用 Active Objects ORM for Java 的经验?

我正在研究 Java 的 ORM,而Active Objects引起了我的注意。显然,它受到了 Rails 的 ActiveRecord 的启发。根据我所读到的内容,这种方法似乎通过采用约定优于配置来解决现有 Java ORM 的许多问题。

你有什么经验?

0 投票
3 回答
849 浏览

c++ - 超时的 WaitForRequest 崩溃

编辑:我现在已经对我的代码进行了一些编辑,以便对“所有”代码有一个粗略的了解。也许这可能有助于识别问题;)

我已经集成了以下简单的代码片段,如果从 TCP 套接字读取数据,则取消计时器,否则取消从套接字读取的数据

这部分在活动对象中执行,由于集成了上面的代码片段,我总是得到内核恐慌:E32User-CBase 46:这个恐慌是由活动调度程序 CActiveScheduler 引发的。它是由杂散信号引起的。

在执行这段代码之前,我的代码从来没有任何问题;代码执行良好,因为从套接字读取数据然后取消并关闭计时器。我不明白计时器对象如何对 AO 产生任何影响。

如果有人能指出我正确的方向,那就太好了。

谢谢

0 投票
6 回答
1493 浏览

c++ - 线程应用程序的同步列表

我正在使用活动对象设计模式。

我需要一个列表,其中包含相同类型的用户定义对象。多个写入者将对象推送到列表中,读取者可以定时在队列中等待。

我知道我可以包装一个 STL 列表,但也许在 boost 中有现成的解决方案?我就是找不到。

升级版:

该应用程序在 Linux (RHEL 5.3) 上运行。

0 投票
3 回答
320 浏览

wpf - WPF 和活动对象

我有一个“活动对象”的集合。也就是说,需要定期更新自身的对象。反过来,这些对象应该用于更新基于 WPF 的 GUI。

在过去,我只会让每个对象都包含它自己的线程,但这仅在使用有限数量的具有明确定义的生命周期的对象时才有意义。现在我正在使用仅在表单需要时才存在的对象,因此生命周期是不可预测的。此外,我可以有几十个对象都进行数据库和 Web 服务调用。

正常情况下更新间隔为 1 秒,但由于超时,最多可能需要 30 秒。

那么,你会推荐什么设计呢?

0 投票
2 回答
1009 浏览

java - 是否有可以序列化代理对象的 JSON 库?

使用 ActiveObjects 作为我的 ORM 和 Gson 作为我的 JSON 处理器。

遇到从持久对象转到 Json 的问题。问题是我的持久化类实际上是一个接口,而 AO 正在代理该对象。这是一些示例代码:

提出了这个例外:

因为 place.getClass().getName() 给出:

$代理228

我尝试了几种不同组合的解决方案:

到目前为止没有任何效果,我正在使用一种不稳定的逐场解决方法。有什么建议么?我没有和 Gson 结婚,所以如果有一个替代库可以做到这一点,我会很乐意使用它。

0 投票
1 回答
194 浏览

python - s60的python中的活动对象

如何在 python 中为 s60 使用活动对象?谁能给我一个代码示例?

0 投票
1 回答
511 浏览

java - c3p0 循环和 OSGi

我将我的项目包装在 OSGi 包中(只需从 Activator.start() 调用我的第一个启动方法)。在我的项目中,我使用 ORM ActiveObjects 和 c3p0 池。所有项目依赖项(jar 库)都在类路径中。如果我使用 c3p0 运行我的项目,对 DB 的 1 次查询大约需要 5 分钟。没有 c3p0 它可以正常工作。在什么方面有问题?非常感谢!

0 投票
1 回答
1087 浏览

c++ - threading-related active object design questions (c++ boost)

I would like some feedback regarding the IService class listed below. From what I know, this type of class is related to the "active-object" pattern. Please excuse/correct if I use any related terminology incorrectly. Basically the idea is that the classes using this active object class need to provide a start and a stop method which control some event loop. This event loop could be implemented with a while loop or with boost asio etc.

This class is responsible for starting a new thread in a non-blocking manner so that events can be handled in/by the new thread. It must also handle all clean-up related code. I first tried an OO approach in which subclasses were responsible for overriding methods to control the event loop but the cleanup was messy: in the destructor calling the stop method resulted in a pure virtual function call in cases where the calling class had not manually called the stop method. The templated solution seems to be a lot cleaner:

The class could be used as follows:

Now to my specific questions:

1) Is the use of the boost condition variable correct? It seems like a bit of a hack to me: I wanted to wait for the thread to be launched so I waited on the condition variable. Then once the new thread has launched in the main method, I again wait on the same condition variable to allow the initial thread to continue. Then once the start method of the initial thread is exited, the new thread can continue. Is this ok?

2) Are there any cases in which the thread would not get launched successfully by the OS? I remember reading somewhere that this can occur. If this is possible, I should rather do a timed wait on the condition variable (as is commented out in the start method)?

3) I am aware that of the templated class could not implement the stop method "correctly" i.e. if the event loop fails to stop, the code will block on the joins (either in the stop or in the destructor) but I see no way around this. I guess it is up to the user of the class to make sure that the start and stop method are implemented correctly?

4) I would appreciate any other design mistakes, improvements, etc?

Thanks!

0 投票
1 回答
1204 浏览

c++ - C++ 活动对象

在http://www.paulbridger.com/active_object/中遇到这个出色的 ActiveObject 示例

我试过了,但只得到以下输出:

想知道为什么要等待结果?我需要在 Servant::doSomeWork() 中做任何事情吗?

0 投票
1 回答
1100 浏览

java - 如何在 ActiveObjects 中将两个 OneToMany 关系写入同一个表

如何在 ActiveObjects 中为同一个表编写两个 OneToMany 关系?为什么这个测试用例失败了?

简单的消息实体。

简单的沟通者(人或服务器)。

测试用例。

1.连接到localhost的mysql。

2.创建表模式。

3.创建sender和acceptor两个通信器。

4.创建10条消息作为setSender(sender)和setAcceptor(acceptor)。

5.检查发件人接受的消息数量。它应该为零。

6.但junit说它是10,但不是零。

谢谢你。