• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Firing a Java Code on a scheduled time

 
Vinod Vinu
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, iam new to java but i worked in lotus domino technology as a developer. In that technology, we used to create agents which can be fired :-
1) on Event,
@) or on scheduled time

here in java, iam wondering how a piece of code in java is fired on both these events(event/scheduled)

i think that depends on server which we use.
Is that depends on IDE also.
iam using Eclipse with Tomcat application server.

I would really appreciate your help in providng me the basic working of it.
thanks in advance....
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which "Event" is that? Some user action like clicking a button? Some database trigger? Something else?

If the IDE is going to dictate your code, then you have picked up a bad IDE indeed.
Since you mentioned Eclipse, I do not think Eclipse puts down any such limitations.

Check out Quartz. It is an open source scheduling framework which lets you practically do all kinds of scheduling jobs.
 
Vinod Vinu
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on Event like clicking on a button
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you will need is listeners

If you are using a JButton you will need something like



If you are taking some action when a particular button is clicked, you don't need a scheduler, unless you want the action to be taken in the future.
Also check out the javax.swing.Timer class.
These two links might also be helpful
http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
http://java.sun.com/products/jfc/tsc/articles/timer/
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam using Eclipse with Tomcat application server.

Are you making a web application ? The button you click are on web pages ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic