[J2EE Design Patterns] - Design problem: EJB containers prevent threadpool allocation
by mcandelo
I have a design issue I'm working through - I'm attempting to limit requests into a remote system to a set number per client. So for each client we have, I want a max of (for example) 15 requests to be sent to the system. Clients are added and removed constantly so extra development for each client is out of the question.
In normal Java I would just create a new client object that allocates a thread pool and send requests into each client. The thread pool would limit the number of active requests in the system and all is well. However, this logic will not work in EJB land because the container does not like application code allocating thread pools.
The only other way I can think of to implement anything like this would be to submit jobs to a queue and have an MDB pull off the queue with a fixed pool size. But this solution would not allow for dynamically increasing the number of clients (we would need to allocate a new pool for each client).
So, is there a way to create & limit asynchronous processes using JBoss/EJB's?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215369#4215369
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215369
15 years, 10 months
[JBoss jBPM] - Re: Problem deploying on JBoss 5
by gchanteb
Hi.
Rogerio, your solution doesn't work :-(.
I use JBPM 3.3.1.GA with JBoss 5.0.1.GA.
I have changed jsf-facelet in order to have jbpm console working.
When i want to "examine" a process, i have this error:
"java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean"
With your solution, i can "examine" a process.
BUT... when i examine process and when i want to "delete" one which is running (5 Running Mar 5, 2009 3:02:20 PM Examine Delete End Suspend ), i have this problem:
/app/t_processinstances.xhtml @69,88 value="#{filter_running=='true'}": Illegal Syntax for Set Operation
| /app/t_processinstances.xhtml @71,92 value="#{filter_suspended=='true'}": Illegal Syntax for Set Operation
| /app/t_processinstances.xhtml @73,84 value="#{filter_ended=='true'}": Illegal Syntax for Set Operation
How could i do ?
Thx.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215367#4215367
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215367
15 years, 10 months
[Remoting] - JBoss remoting integration with legacy systems
by eliezerreis
Hi,
I need implement a server socket to do integration between 3 systems implemented in languages diferent (C#, Delphi). I already implemented all functionality (existe thread in this functionality ) in one desktop application (using api java.net) for more fast debug and test. When I went include this functionality in my web applications (.war) in JBoss AS a lot of problems happened. Then i'd like knows if it's possible with JBoss Remoting:
1) Is possible run jboss remoting server together with my web application.
2) Is possible use java.net.socket to do clients for jboss remoting with socket transport?
3) Is possible legacy systems connect on jboss remoting servers that use socket transport?
3) When some changes happening on my web service is possible with jboss remoting send message for all clients?
Thanks for help.
Eliezer.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215357#4215357
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215357
15 years, 10 months
[JBoss AOP] - Using AOP to mock out dependecies for unit-test
by nizzy
Hi Guys,
AOP newbie;
I hope someone can help me I'm developing a quick AOP proof of concept with the intention to roll it out company wide. The idea is to use AOP to mock-out dependencies in order to simplify unit testing. I'm sure I don't have to state the benefits here.
However I have created a basic J2EE project with a single SessionBean and a few entities.
I have dependencies created in the constructor of the SessionBean which I want to mock out.
private IPersistenceHelper helper;
| public AOPUnitTestManagerBean() {
| helper = new PersistenceHelper(PERSISTENCE_CONTEXT_NAME);
| }
I have written an simple Interceptor which intercepts the PersistenceHelper constructor and replaces it with a MockPersistenceHelper;
public class PersistenceHelperInterceptor implements Interceptor {
|
| /**
| * Log4j Logger for this class
| */
| private static final Logger log = Logger
| .getLogger(PersistenceHelperInterceptor.class);
|
| public String getName() {
| return "PersistenceHelperInterceptor";
| }
|
| public Object invoke(Invocation invocation) throws Throwable {
| if (log.isDebugEnabled()) {
| log.debug("inside invoke(arg0)");
| }
| Object helper = new MockPersistenceHelper(null);
| return helper;
| }
| }
I can get this working if the MockPersistenceHelper extends the PersistenceHelper. This is not my preferred solution since it would be better if the MockPersistenceHelper implemented the same interface as the PersistenceHelper, this ensures that all methods have a mock implementations as oppsoed to simply over-riding the methods (open to abuse).
the jboss-aop.xml to get this to work;
<?xml version="1.0" encoding="UTF-8"?>
| <aop>
| <bind pointcut="execution(public com.xxx.unittest.aop.PersistenceHelper->new(java.lang.String))">
| <interceptor class="com.xxx.unittest.aop.interceptor.PersistenceHelperInterceptor"/>
| </bind>
| </aop>
So I have changed it to something like;
<?xml version="1.0" encoding="UTF-8"?>
| <aop>
|
| <bind pointcut="execution(public $typedef{persistenceHelperTypeDef}->new(java.lang.String))">
| <interceptor class="com.xxx.unittest.aop.interceptor.PersistenceHelperInterceptor"/>
| </bind>
|
| <typedef name="persistenceHelperTypeDef"
| expr="class($instanceof{com.xxx.unittest.aop.IPersistenceHelper})
| AND !class($instanceof{com.xxx.unittest.aop.mock.*})" />
| </aop>
However every option I have tries either gives me a ClassCastException, returned object not as expected, or a Stack overflow since the MockPersistenceHelper is itself intercepted since it implements the defined interface.
So I suppose the question is how can I define the typedef such that;
1. It intercepts the constructor of classes of IPersistenceHelper but does not intercept those classes in the xx.xx.xx.mock package.
Hope that wasn't too long winded to ask, hopefully, a straightforward question. This all occurs outside the JBossAS container!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215355#4215355
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4215355
15 years, 10 months