This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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

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

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?
Have you checked out Aspose?
subject: put Vector in run(), and update him
It's not a secret anymore!