File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes put Vector in run(), and update him Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "put Vector in run(), and update him" Watch "put Vector in run(), and update him" New topic
Author

put Vector in run(), and update him

Marko Debac
Ranch Hand

Joined: Aug 21, 2006
Posts: 121
Hallo to all,

I have a burdensome problem:

I have one servlet who is sterted at deploy and in his init() its created main thread which is supposed to run forewer. Her run() method should execute other threads which are created on demand from other class (or servlet). For this other child threads I had created class with schedule tasks (so it is not new thread, but new class in which I put (on creation)various times for executing her tasks).

So, the problem is: I have that other servlet, I have that class with schedule tasks and I have main servlet thread runnig, so, I must put those new classes created on demand in some vector, and put that vector in main run() to execute forewer, and so I can add new classes on demand with new times, and put it in this vector (or, on demand remove from vector, to not execute any more). How?

This is my class Profile with schedule time job:
This is my main servlet thread code:

Please help me to create new Profile, put them into Vector for execute

regardes,
Marko
Marko Debac
Ranch Hand

Joined: Aug 21, 2006
Posts: 121
Maybe with HttpSessionAttributeListener:

every time when I call function from somewhere, like and put in Listener
and in running servlet

every time when I call function() with diferent parameters, I will add new Profile in Vector, to execute new task with diferent id for (every) diferent time, or not?
 
 
subject: put Vector in run(), and update him