class Context {

    public void complete() throws SQLException
    {
        // If Context is no longer open/valid, just note that it has already been closed
        if(!isValid())
            log.info("complete() was called on a closed Context object. No changes to commit.");

        try
        {
            // As long as we have a valid, writeable database connection,
            // rollback any changes if we are in read-only mode,
            // otherwise, commit any changes made as part of the transaction
            if(isReadOnly()) {
                abort();
            } else {
                commit();
            }
        }
        finally
        {
            if(dbConnection != null)
            {
                // Free the DB connection
                dbConnection.closeDBConnection();
                dbConnection = null;
            }
        }
    }

    protected  Context(EventService eventService, DBConnection dbConnection);
    public  Context();
    public  Context(Mode mode);

}