[jboss-user] [JBoss Seam] - problem with messages in scheduler.

Stateless Bean do-not-reply at jboss.com
Mon May 7 04:10:36 EDT 2007


hi,
I got in messages properties some text like:


  | myText = xxx yyy zzz
  | 

and my messages

  | @In 
  | protected Map<String, String> messages;
  | 

in normal case it works when i do somethink like:
String someString = messages.ge("myText");

someString get "xxx yyy zzz",
but i got method scheduled each minute and when i use messages in method i still get not "xxx yyy zzz", but "myText", why?
If I run my medthod like <s:link action="sfsb.method", messages work!!!!

here is my controler:

  | @Name("engineControler")
  | public class EngineControler extends GameSystem {
  | 	public EngineControler() {}
  | 	
  | 	@In(create=true)
  |     EngineProcessor processor;
  | 
  |     public String calcUserPoints() {
  |         try {
  |         	long interval = 1 * 500;
  | 	        @SuppressWarnings("unused")
  | 			Timer timer = processor.scheduleUserPoints(new Date(), interval, null);	        
  |  	        
  |         }
  |         catch (RuntimeException e) {
  |         	log.error("Scheduler ->engineControler - calcUserPoints(): " + e.getMessage());
  |         }
  |         return "success";
  |     }
  | 

and processor

  | @Name("processor")
  | public class EngineProcessor extends GameSystem {
  | 	public EngineProcessor() {}
  | 	   
  |     @SuppressWarnings("unchecked")
  | 	@Asynchronous
  |     @Transactional
  |     public Timer scheduleUserPoints(@Expiration Date when, 
  |                                     @IntervalDuration long interval, 
  |                                     Person p) { 
  |     	try {
  | 			long a = System.currentTimeMillis();
  | 			//=================================================
  | String someString = messages.ge("myText");        	   	
  | 			//=================================================			 
  | 			long b = System.currentTimeMillis();
  | 			System.out.println("TIME: " + (b - a) + " ms.");        	
  |         }
  |         catch (RuntimeException e) {
  |         	log.error("processor -> scheduleUserPoints(): " +
  |         			   e.getMessage());
  |         }
  |         return null;
  |     }
  | 

can anyone explain why my messages instance can't work in scheduler?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043582#4043582

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043582



More information about the jboss-user mailing list