#include <scheduler.h>
Inherits TQObject, and DCOPObject.
Public Types | |
typedef TQPtrList< SimpleJob > | JobList |
Public Slots | |
void | slotSlaveDied (TDEIO::Slave *slave) |
void | slotSlaveStatus (pid_t pid, const TQCString &protocol, const TQString &host, bool connected) |
Signals | |
void | slaveConnected (TDEIO::Slave *slave) |
void | slaveError (TDEIO::Slave *slave, int error, const TQString &errorMsg) |
Static Public Member Functions | |
static void | doJob (SimpleJob *job) |
static void | scheduleJob (SimpleJob *job) |
static void | cancelJob (SimpleJob *job) |
static void | jobFinished (TDEIO::SimpleJob *job, TDEIO::Slave *slave) |
static void | putSlaveOnHold (TDEIO::SimpleJob *job, const KURL &url) |
static void | removeSlaveOnHold () |
static void | publishSlaveOnHold () |
static TDEIO::Slave * | getConnectedSlave (const KURL &url, const TDEIO::MetaData &config=MetaData()) |
static bool | assignJobToSlave (TDEIO::Slave *slave, TDEIO::SimpleJob *job) |
static bool | disconnectSlave (TDEIO::Slave *slave) |
static void | registerWindow (TQWidget *wid) |
static void | unregisterWindow (TQObject *wid) |
static bool | connect (const char *signal, const TQObject *receiver, const char *member) |
static bool | connect (const TQObject *sender, const char *signal, const TQObject *receiver, const char *member) |
static bool | disconnect (const TQObject *sender, const char *signal, const TQObject *receiver, const char *member) |
static void | checkSlaveOnHold (bool b) |
Protected Slots | |
void | startStep () |
void | slotCleanIdleSlaves () |
void | slotSlaveConnected () |
void | slotSlaveError (int error, const TQString &errorMsg) |
void | slotScheduleCoSlave () |
void | slotUnregisterWindow (TQObject *) |
Protected Member Functions | |
void | setupSlave (TDEIO::Slave *slave, const KURL &url, const TQString &protocol, const TQString &proxy, bool newSlave, const TDEIO::MetaData *config=0) |
bool | startJobScheduled (ProtocolInfo *protInfo) |
bool | startJobDirect () |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
The TDEIO::Scheduler manages io-slaves for the application.
It also queues jobs and assigns the job to a slave when one becomes available.
There are 3 possible ways for a job to get a slave:
1. Direct
This is the default. When you create a job the TDEIO::Scheduler will be notified and will find either an existing slave that is idle or it will create a new slave for the job.
Example:
2. Scheduled
If you create a lot of jobs, you might want not want to have a slave for each job. If you schedule a job, a maximum number of slaves will be created. When more jobs arrive, they will be queued. When a slave is finished with a job, it will be assigned a job from the queue.
Example:
3. Connection Oriented
For some operations it is important that multiple jobs use the same connection. This can only be ensured if all these jobs use the same slave.
You can ask the scheduler to open a slave for connection oriented operations. You can then use the scheduler to assign jobs to this slave. The jobs will be queued and the slave will handle these jobs one after the other.
Example:
Note that you need to explicitly disconnect the slave when the connection goes down, so your error handler should contain:
- See also
- TDEIO::Slave
- TDEIO::Job
Definition at line 110 of file scheduler.h.
Member Function Documentation
◆ cancelJob()
|
inlinestatic |
Stop the execution of a job.
- Parameters
-
job the job to cancel
Definition at line 144 of file scheduler.h.
◆ checkSlaveOnHold()
|
inlinestatic |
When true, the next job will check whether TDELauncher has a slave on hold that is suitable for the job.
- Parameters
-
b true when TDELauncher has a job on hold
Definition at line 279 of file scheduler.h.
◆ connect()
|
inlinestatic |
Function to connect signals emitted by the scheduler.
- See also
- slaveConnected()
- slaveError()
Definition at line 258 of file scheduler.h.
◆ doJob()
|
inlinestatic |
Register @p job with the scheduler. The default is to create a new slave for the job if no slave is available. This can be changed by calling scheduleJob.
- Parameters
-
job the job to register
Definition at line 128 of file scheduler.h.
◆ getConnectedSlave()
|
inlinestatic |
Requests a slave for use in connection-oriented mode.
- Parameters
-
url This defines the username,password,host & port to connect with. config Configuration data for the slave.
- Returns
- A pointer to a connected slave or 0 if an error occurred.
- See also
- assignJobToSlave()
- disconnectSlave()
Definition at line 195 of file scheduler.h.
◆ jobFinished()
|
inlinestatic |
Called when a job is done.
- Parameters
-
job the finished job slave the slave that executed the job
Definition at line 152 of file scheduler.h.
◆ publishSlaveOnHold()
|
inlinestatic |
Send the slave that was put on hold back to TDELauncher.
This allows another process to take over the slave and resume the job that was started.
Definition at line 181 of file scheduler.h.
◆ putSlaveOnHold()
|
inlinestatic |
Puts a slave on notice. A next job may reuse this slave if it requests the same URL. A job can be put on hold after it has emit'ed its mimetype. Based on the mimetype, the program can give control to another component in the same process which can then resume the job by simply asking for the same URL again.
- Parameters
-
job the job that should be stopped url the URL that is handled by the url
Definition at line 166 of file scheduler.h.
◆ registerWindow()
|
inlinestatic |
Send the slave that was put on hold back to TDELauncher. This allows another process to take over the slave and resume the job the that was started. Register the mainwindow @p wid with the TDEIO subsystem Do not call this, it is called automatically from void TDEIO::Job::setWindow(TQWidget*).
- Parameters
-
wid the window to register
- Since
- 3.1
Definition at line 242 of file scheduler.h.
◆ removeSlaveOnHold()
|
inlinestatic |
Removes any slave that might have been put on hold.
If a slave was put on hold it will be killed.
Definition at line 173 of file scheduler.h.
◆ scheduleJob()
|
inlinestatic |
Calling ths function makes that @p job gets scheduled for later execution, if multiple jobs are registered it might wait for other jobs to finish.
- Parameters
-
job the job to schedule
Definition at line 137 of file scheduler.h.
◆ slotUnregisterWindow
|
protectedslot |
- Since
- 3.1
Definition at line 888 of file scheduler.cpp.
The documentation for this class was generated from the following files: