ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.app.trace
Class DBContactTrace

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.app.trace.DBContactTrace
All Implemented Interfaces:
ContactTrace

public class DBContactTrace
extends Object
implements ContactTrace

Defines an exited-contact listener used to output a trace of every call processed by a simulator into a database. Each time a new contact is notified to this listener, a SQL request is used to update a table through JDBC. This results in a call-by-call trace of the simulation. If an SQL exception is thrown at any given time by the writer, the exception's stack trace is printed, and this call logger is disabled to avoid getting any further exception message.


Field Summary
 
Fields inherited from interface umontreal.iro.lecuyer.contactcenters.app.trace.ContactTrace
OUTCOME_ABANDONED, OUTCOME_BLOCKED, OUTCOME_FAILED, OUTCOME_SERVED
 
Constructor Summary
DBContactTrace(DBConnectionParams dbProperties, String dbTable)
          Constructs a new call trace to a database, using the given parameters to establish the connection, and and sending the data to the table with the given name.
 
Method Summary
 void close()
          Closes the trace facility after a simulation.
 void init()
          Initializes the tracing mechanism.
 void writeLine(int step, int type, int period, double arvTime, double queueTime, String outcome, int group, double srvTime)
          Writes a new line in the trace representing a simulated contact.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBContactTrace

public DBContactTrace(DBConnectionParams dbProperties,
                      String dbTable)
Constructs a new call trace to a database, using the given parameters to establish the connection, and and sending the data to the table with the given name.

Parameters:
dbProperties - the database properties, for JDBCManager.
dbTable - the output table for the trace.
Method Detail

init

public void init()
Description copied from interface: ContactTrace
Initializes the tracing mechanism. This method opens the trace file or database connection, and writes headers, etc. If an error occurs during the initialization, this method should log the error, and disable tracing.

Specified by:
init in interface ContactTrace

close

public void close()
Description copied from interface: ContactTrace
Closes the trace facility after a simulation. This method closes files, database connections, etc.

Specified by:
close in interface ContactTrace

writeLine

public void writeLine(int step,
                      int type,
                      int period,
                      double arvTime,
                      double queueTime,
                      String outcome,
                      int group,
                      double srvTime)
Description copied from interface: ContactTrace
Writes a new line in the trace representing a simulated contact. The line includes the step of the simulation at which the contact occurred, the type of the contact, the period of its arrival, its time spent in queue, its outcome, the group of its serving agent, and its service time. Some of these fields might be Double.NaN if the information does not exist. For example, a blocked or abandoned call does not have a serving agent group, or a service time.

Specified by:
writeLine in interface ContactTrace
Parameters:
step - the step, in the experiment, during which the call occurred.
type - the type of the call.
period - the period of arrival of the call.
arvTime - the arrival time.
queueTime - the time spent by the call in the queue.
outcome - the outcome of the call.
group - the group of the serving agent.
srvTime - the service time of the call.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.