home *** CD-ROM | disk | FTP | other *** search
Java Source | 1999-04-09 | 1.6 KB | 72 lines |
- import java.io.*;
- import java.net.*;
- import java.util.*;
-
-
- /**
- * Class to represent a job running on the server that stays running to
- * handle requests from clients or other running jobs.
- */
- public class JDPEntityTemplate {
-
- /*
- * Jagg instance for database access.
- */
- JDPJagg jaggSQL;
- /*
- * Handle to the subsystem manager of the server.
- */
- JDPSubsystemMgr manager;
- /*
- * Handle to the job that this class is running in.
- */
- JDPJob thisJob;
- /*
- * Handle to the utilities class.
- */
- JDPUtils utils;
-
- /**
- * Creates a new module that runs on the server and can be accessed
- * by other modules or by remote clients.
- * @param manager the handle to the subsystem manager.
- * @param thisJob the handle to the job in which this class runs.
- */
- public JDPEntityTemplate (JDPSubsystemMgr manager, JDPJob thisJob) {
-
- this.manager = manager;
- this.thisJob = thisJob;
- thisJob.setInstance(this);
- jaggSQL = new JDPJagg(manager.JDPJaggPath);
- utils = new JDPUtils(null);
- utils.jaggSQL = jaggSQL;
-
- thisJob.appendJobLog("Job started on " + (new Date()).toString());
-
- //
- // Stay running while the server remains running or until
- // manually terminated.
- //
- while (!manager.shutdownRequested) {
- try {
- //
- // Insert repetitive processing here if required
- //
-
- //
- // Wait 10 seconds until the next repetitive processing
- // needs to be done
- //
- Thread.sleep(10000);
- } catch (Exception e) {
- thisJob.logException(e);
- thisJob.setJobStatus(JDPJob.INCOMPLETE);
- }
- }
-
- thisJob.appendJobLog("Job completed on " + (new Date()).toString());
-
- }
-
- }
-