[Management, JMX/JBoss] - How to programmaticly schedule many tasks ?
by dmary
Hi all,
I was reading many docs and post on scheduling into Jboss and I didn't really found any good solution. I use Jboss 4.05 GA in clustered environnement.
I need to create and schedule programmaticly each days , at any time, many tasks which require at least one parameter (this parameter can differ and change behavior of tasks)
I need as I said I use cluster, to execute tasks on only one node into the farm, but I want to register new tasks anywhere in the farm.
Do I need to register new tasks with only a JMX Schedule Manager ?
or any other way ?
As I will register for example 200 tasks by days at any time (these tasks will run once at a given time), do I need to declare only one Scheduler config (org.jboss.varia.scheduler.Scheduler) or one SchedulerProvider config (org.jboss.varia.scheduler.SingleScheduleProvider | org.jboss.varia.scheduler.DBScheduleProvider)?
I'm completly lost and I need help !!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157882#4157882
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157882
17 years, 10 months
[EJB 3.0] - EntityManager's Native Query & Paging Results
by rabbiaqaswar
Hello
I am working with EJB3 on JBoss 4.2.2 GA. In one of the SessionBeans there is a query (sql) which i am running using the createNativeQuery method of the EntityManager.
The query is supposed to return 20 Ids of an Entity. The query returns all 20 Ids. Now if i want to use paging (see only the last 10 records) through the setFirstResult and setMaxResults method of Query, i do this:
query = em.createNativeQuery(strQuery.toString());
| query.setFirstResult(10);
| query.setMaxResults(10);
|
then:
ArrayList ids = (ArrayList) query.getResultList();
| System.out.println("no of users found: "+ids.size());
|
| if(ids != null && !ids .isEmpty()){
| for (Iterator it = ids.iterator(); it.hasNext();) {
| BigDecimal userId= (BigDecimal)it.next();
| System.out.println("userid: "+userId);
| }
| }
|
In this case the query finds 10 records as the ids.size method gives 10 but then in the loop it gives this exception i.e.
03:09:47,451 ERROR [STDERR] java.lang.ClassCastException: [Ljava.lang.Object;
| 03:09:47,451 ERROR [STDERR] at com.server.servicefacades.UserSessionBean.searchUser(UserSessionBean.java:802)
| 03:09:47,451 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
I suppose the ids ArrayList contains Object arrays instead of containing the userId somehow but i donot understand why. Help please?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157872#4157872
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157872
17 years, 10 months
[JBoss Messaging] - Re: Can JBoss Messaging uses direct method invocation while
by gary.c.chen
En, could you please tell me how JBM determine client and server are in the same VM ?
You know, in a Servlet we use JNDI as follow :
Context ctx = new InitialContext();
QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("java:/ConnectionFactory");
and we don't use the JNDI URL property.
I had ever developed Application Server before, in our Application Server, we used the JNDI URL property to determine the JNDI lookup action is inside the server VM or outside, according to this we return a ConnectionFactory that it's created Connection used direct method invocation or used Socket.
So I am very interesting in how JBM achieve the optimisation. Like the above I describe ?
And you said the client and the server must in the same VM and loaded by the same ClassLoader, so JBM can do the optimisation, is that right ?
And we know that the Servlet class and the JMS Server class are not loaded by the same ClassLoader.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157867#4157867
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157867
17 years, 10 months