java-ee

ExecutorService in Java Servlet

六月ゝ 毕业季﹏ 提交于 2019-12-19 08:11:10
问题 I need to perform some tasks(Mostly Call multiple External URL's with request parameters and read data) concurrently in java servlet and send response to user within a few seconds.I am trying to use ExecutorService to achieve the same. I need four FutureTasks created in each user request in the doGet method. Each Task runs for around 5-10 sec and the total response time to the user is around 15 sec. Can you please suggest which of the following design is better while using ExecutorService in

ExecutorService in Java Servlet

寵の児 提交于 2019-12-19 08:11:04
问题 I need to perform some tasks(Mostly Call multiple External URL's with request parameters and read data) concurrently in java servlet and send response to user within a few seconds.I am trying to use ExecutorService to achieve the same. I need four FutureTasks created in each user request in the doGet method. Each Task runs for around 5-10 sec and the total response time to the user is around 15 sec. Can you please suggest which of the following design is better while using ExecutorService in

Why do EJB beans with bean-managed transactions act as a “transaction barrier”?

左心房为你撑大大i 提交于 2019-12-19 07:49:58
问题 A quote from the EJB 3.1 specification: 13.6.1 Bean-Managed Transaction Demarcation The container must manage client invocations to an enterprise bean instance with bean-managed transaction demarcation as follows. When a client invokes a business method via one of the enterprise bean’s client views, the container suspends any transaction that may be associated with the client request. On the other hand, a transaction from a stand-alone client or another EJB is propagated into a bean using

Primefaces Captcha disappears or doesn't update/refresh on invalid input?

隐身守侯 提交于 2019-12-19 07:48:23
问题 I have the following piece of code inside an h:form <h:panelGrid id="captchaGrid"> <p:captcha id="captcha" label="Captcha" required="true" requiredMessage="required" validatorMessage="..."> </p:captcha> <p:message id="captchaMessage" for="captcha" /> </h:panelGrid> <p:commandButton id="submitButton" value="save" actionListener="#{userBean.save}" update="captchaGrid" onstart="doSomething()" oncomplete="doSomethingElse(xhr, status, args)" icon="ui-icon-check"> </p:commandButton> This works fine

Disadvantages of J2EE session management in ColdFusion

馋奶兔 提交于 2019-12-19 06:46:58
问题 Manual page tells about bunch of advantages of the J2EE session management (SM) over the ColdFusion SM, but what about other side? Which problems can appear when using J2EE SM? Also, if J2EE SM is so cool, why ColdFusion SM is still default? I can see one obvious reason: backwards compatibility. And this is typical for Adobe. Same time I doubt that Adobe cares about compatibility with other CFML engines. Any other reasons? 回答1: None that I've found, really. As soon as J2EE session management

how to instantiate more then one CDI/Weld bean for one class?

佐手、 提交于 2019-12-19 06:46:20
问题 In Spring it was possible to instantiate any class by defining the corresponding bean in xml conf. It was also possible to instantiate more then one bean for the same class with different parameters..... Are the such features in CDI as well, namely is it possible to create different instances of the same class with different initialization parameters? Is it also possible to create a bean without changing the class....I mean without adding annotation? ADDED Let me make an example. <bean id=

how to instantiate more then one CDI/Weld bean for one class?

陌路散爱 提交于 2019-12-19 06:46:08
问题 In Spring it was possible to instantiate any class by defining the corresponding bean in xml conf. It was also possible to instantiate more then one bean for the same class with different parameters..... Are the such features in CDI as well, namely is it possible to create different instances of the same class with different initialization parameters? Is it also possible to create a bean without changing the class....I mean without adding annotation? ADDED Let me make an example. <bean id=

How do you keep changes separate and isolated across multiple deployment environments in git?

落爺英雄遲暮 提交于 2019-12-19 04:25:55
问题 At my workplace, we are attempting to design a workflow based around Git to handle our deployments and changes to the code. We have a Java EE web application and 3 deployment environments (Test, QA and Production). We also have an instance of Jenkins CI to handle builds and deployments. When changes are made to the application's code (in branches) we need to be able to pick and choose which ones get promoted to QA and Production. Some might get to QA and then never go to production. We also

How to make a SELECT query in Hibernate includes Subquery COUNT(*)

独自空忆成欢 提交于 2019-12-19 04:19:07
问题 Let's say we have a Category - Items one-to-many relation. I would like to do this SELECT c.*, (SELECT COUNT(*) FROM items i WHERE i.catId=c.id) AS itemCount FROM category c And let's say we have a Hibernate POJO "class Category". My first question is I really couldn't figure out that from that query I get a List<Category> object right? And how can I access the "itemCount"? Because there's no Category.getItemCount() And secondly, how can I write the Criteria query? Thanks 回答1: Seems like this

JBoss 6 - Deploy ejb in war packaging

拥有回忆 提交于 2019-12-19 04:09:41
问题 I am trying to use the new EJB3.1 feature where one can deploy an EJB packaged within a .war file. I am using Maven 2.2.1 to package the EJB module and then dropping the ejb jar in a war module (as a dependency). The final war contains a simple web.xml with no content, and the ejb jar library in the lib directory. However, though the application is deployed correctly, the annotated ejb (@Stateless) is not recognized by the container. I have no ejb-jar.xml descriptor (which I believe is