[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Server side Trigger  XML
Forum Index -> Development
Author Message
kklasen

Power User

Joined: 19/11/2020 08:33:30
Messages: 29
Offline

Hello,

I want to make a triggered event on server side. All 24 hours it should check some entries on Database. I tried with TimerTask class but it never triggers.
So, I found some Demos for triggering but they only wait some seconds und not a whole day.
Is it not possible to use TimerTask on server side? Or is there a Demo with a long long long Trigger.

thanks for the help!

Kind regards

Klas
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5204
Offline

Hi,

the "enemy" you are fighting with is the session-timeout! ;-)

THis is configured in web.xml:

Code:
 ...
   <session-config>
      ...
       <session-timeout>60</session-timeout>
       ...
   </session-config>
 


(in minutes)

In more complex situations there are also other session timeouts involved (proxy, single sign on, ...), so things can be more complicated in addition.

So better set the timer to "every 30 minutes" and then manage the actual counting of the 24 hours on server-side.

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
kklasen

Power User

Joined: 19/11/2020 08:33:30
Messages: 29
Offline

Hello,
A question if I use this method:

Code:
 	private void timerTask24() {			
 		String nameOfTable = "tbl_training_gebucht" ,  column_name = "TrainBookID",  sCustData ,  whereName = "Aktiv";
 		
 		sCustData = 1 +" : " +1;
 		    TimerTask repeatedTask = new TimerTask() {
 		        public void run() {
 //		        	Statusbar.outputMessage("Task performed on " + new Date()+" "+ Thread.currentThread().getName());
 		        	LoadUpdateDBTrain(nameOfTable, column_name, sCustData, whereName);
 		        	
 		        }
 		    };
 		    Timer timer = new Timer("Timer 24h");
 		    
 		    long delay = 1000L;
 //		    long period = 1000L * 60L * 60L * 24L;
 		    long period = 1000L * 60L ;
 		    timer.scheduleAtFixedRate(repeatedTask, delay, period);
 	
 	}
 
 


And put the method name in the constructor, should it not work? I am a little bit confused.

Kind regards

Klas
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5204
Offline

Hi Klas,

now I am confused, too. ;-)

When I was talking about "timer" then I was talking about the TIMER-component of CaptainCasa. This is like a "virutal button" which presses itself automatically every x milliseconds. (x defines in DURATION attribute).

The session needs to be kept alive by requests from the client side. (Like a user that is constantly interacting...)

In the demo workplace you find examples: General > Asynchrnous Processing > Timer

Hope, this clarifies confusion! (?)

Kind regards, Björn

Björn Müller, CaptainCasa GmbH
kklasen

Power User

Joined: 19/11/2020 08:33:30
Messages: 29
Offline

Hello,

ah okey!
looks very cool, I give it a try.

Kind regards

Klas
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team