首页 \ 问答 \ 如何实现与J2EE应用程序的异步处理(How to implement asynchronous processing with J2EE application)

如何实现与J2EE应用程序的异步处理(How to implement asynchronous processing with J2EE application)

我有一个每天大约有2k个并发用户的企业应用程序。 这些用户处理客户呼叫,因此应用程序速度至关重要。

当用户打完电话时,他们会提交所有捕获的信息。 此提交可能需要10-45秒。

我正在研究如何从用户那里获得延迟。

我们有一个在IE中运行的Web前端,后端是一个运行在单个EJB上的沉重的Java。

我希望这个提交过程是异步的,因为一旦用户提交请求,他们不必等待提交完成,然后再继续下一位客户。 这是目前实施的。

最初我只想到产生另一个线程来处理提交,但这对EJB来说是不可能的。

我能想到的其他选项是使用JMS或SIB,

最好的解决方案是什么? 我还缺少另一种选择吗?


I have an enterprise application with around 2k concurrent users every day. These users handle customer calls so application speed is of vital importance.

When a user is wrapping up a call they commit all the information they captured. This commit can take anywhere from 10-45 seconds.

I am looking into ways to take the delay away from the user.

We have a web front end running in I.E. the backend is heavy java running on a single EJB.

I wanted to make this commit process asynchronous in that once the user submits the request they don't have to wait for the commit to finish before going on to the next customer. This is what is currently implemented.

Originally I was thinking of just spawning another thread to handle the commit but that's a no no with EJB's.

Other options I can think of would be using JMS or SIB,

What would the best solution be? Is there another alternative I am missing?


原文:https://stackoverflow.com/questions/2008720
更新时间:2023-05-10 15:05

最满意答案

我读这个的方式,你试图将这棵树转换成只有Id,Name和Children的节点树。 在这种情况下,我认为它的方式是清洁节点。

要清理节点:

  1. 使用原始节点的Name和Id创建节点。
  2. 将新节点的Children设置为原始节点的子节点的已清理版本。 (这是递归调用。)

在代码中,那将是:

def clean_node(node):
    return {
        'Name': node['Name'],
        'Id': node['Id'],
        'Children': map(clean_node, node['Children']),
    }

>>> print map(clean_node, data)
[{'Name': 'x', 'Children': [], 'Id': 'y'}, {'Name': 'xx', 'Children': [{'Name': 'xyx', 'Children': [], 'Id': 'yxy'}], 'Id': 'yy'}]

我发现像这样打破递归问题更容易 - 尝试使用全局变量会很快变得非常混乱。


The way I read this, you're trying to convert this tree into a tree of nodes which only have Id, Name and Children. In that case, the way I'd think of it is as cleaning nodes.

To clean a node:

  1. Create a node with the Name and Id of the original node.
  2. Set the new node's Children to be the cleaned versions of the original node's children. (This is the recursive call.)

In code, that would be:

def clean_node(node):
    return {
        'Name': node['Name'],
        'Id': node['Id'],
        'Children': map(clean_node, node['Children']),
    }

>>> print map(clean_node, data)
[{'Name': 'x', 'Children': [], 'Id': 'y'}, {'Name': 'xx', 'Children': [{'Name': 'xyx', 'Children': [], 'Id': 'yxy'}], 'Id': 'yy'}]

I find it's easier to break recursive problems down like this - trying to use global variables turns simple things very confusing very quickly.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。