English 中文(简体)
在无国籍人会议上的多面性?
原标题:Multithreading in a stateless session bean?

《欧洲黄麻和黄麻制品公约》第3条具体规定,不允许以商业方式为无国籍会议创造新的通道。 为什么如此? 创造更多只进行原始计算而且从未上过服务器的工人胎面有什么错误?

我的会堂实施一种服务,使用户能够上载图像,而业务方法对这些图像进行细化图像处理。 那么,即使机器有8个或8个以上核心,它只能使用一个核心来做这项工作? 如果利用第三方图像处理图书馆,内部制造工人线,也违反EJB的光谱,即使该图书馆和这些镜子根本与EJB集装箱毫无关系。 这似乎并不正确。

如果无视EJB规则,并且仍然制造一些工人的read子来进行密集的加工,会发生什么情况? 当然,这些透镜将永远不会触及任何服务器物体,在返回之前,星号会加入。 可能还会发生什么坏事?

问题回答

《欧洲黄麻和黄麻制品公约》第3条具体规定,不允许以商业方式为无国籍会议创造新的通道。 为什么如此?

短版:对欧洲黄麻业公司的校对管理不予允许,因为它会损害资源管理、交易管理、安全(技术原因),也因为这也是欧洲黄麻业联合会模式不愿意促进的(哲学原因)。

欧洲黄麻和黄麻业联合会的特例认为:

21.1.2 Programming Restrictions

......

  • The enterprise bean must not attempt to manage threads. The enterprise bean must not attempt to start, stop, suspend, or resume a thread, or to change a thread’s priority or name. The enterprise bean must not attempt to manage thread groups.

这些功能保留给EJB集装箱。 允许企业主管理read子将削弱集装箱妥善管理经营环境的能力。

See also

(......) If i utilize a third party image processing library, that internally creates worker threads, i would also violate the EJB specs, even though that library and these threads have nothing to do with the EJB container at all. This does not seem right.

我可以说,如果你不喜欢,就不使用EJBs。

如果无视EJB规则,并且仍然制造一些工人的read子来进行密集的加工,会发生什么情况? 当然,这些透镜将永远不会触及任何服务器物体,在返回之前,星号会加入。 可能还会发生什么坏事?

这些透镜是否触及了服务器的物体,或者没有牵线。 规则是规则,你不想遵循这些规则,你自己也这样做,行为没有界定。 某些集装箱可能更宽松,并且允许它、其他一些圆点、贵方的申请是可携带的。 但它仍然明确禁止。

如果你想以标准方式“跳板”,使用“工作管理软件”或使用JMS。

Related Questions

在我的简化理解中,它喜欢经营一家公司。 您将 b子(集装箱)重新 re,一名雇员突然在无任何通知的情况下雇用100人。

但是,你仍然可以很容易地与“Asynchronous annotation”(其他方式也一样)。

@Stateless
public class Employee {
    @Asynchronous
    public Future<Void> work(Project projectThatTakeTooLong) {
        // work work work
        return new AsyncResult<Void>(null);
    }
}

@Stateless
public class Boss {

    @Inject
    private Employee randomStatelessEmployee;

    public void giveWork() {
        Future<Void> result1 = randomStatelessEmployee.work(new Project());
        Future<Void> result2 = randomStatelessEmployee.work(new Project());
        Future<Void> result3 = randomStatelessEmployee.work(new Project());
        result1.get();
        result2.get();
        result3.get();
    }
}

There s also a better example here: Jboss Java EE container and an ExecutorService

一种工作方式:

import java.util.concurrent.Executor;
import javax.ejb.Asynchronous;
import javax.ejb.Stateless;

@Stateless
public class TransactionalExecutor implements Executor {

    @Override @Asynchronous
    public void execute(Runnable command) {
        command.run();
    }
}

现在,你可以使用交易 检察官:

@Stateless
public class SlowService {

    @Inject
    Executor command;

    public void invoke(){
        Runnable command = new Runnable() {
            @Override
            public void run() {
                // heavy task
            }
        };
        command.execute(command);
    }    
}

This is known restriction not to use threads in J2EE applications. Application server should take care of parallel execution of the program

是的,你可以无视欧洲法院规则,但可以面对极其难以预测的行为





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签