• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Firing a Java Code on a scheduled time

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on Event like clicking on a button
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
reply
    Bookmark Topic Watch Topic
  • New Topic