Search in sources :

Example 1 with QtiLogicException

use of uk.ac.ed.ph.jqtiplus.exception.QtiLogicException in project OpenOLAT by OpenOLAT.

the class OpenOLATExtensionPackage method obtainMaximaSessionForThread.

// ------------------------------------------------------------------------
public QtiMaximaProcess obtainMaximaSessionForThread() {
    QtiMaximaProcess maximaSession = sessionThreadLocal.get();
    if (maximaSession == null) {
        if (qtiMaximaProcessPoolManager != null) {
            log.debug("Obtaining new maxima process from pool for this request");
            /* Need to get a new process from pool */
            maximaSession = qtiMaximaProcessPoolManager.obtainProcess();
            sessionThreadLocal.set(maximaSession);
        } else {
            throw new QtiLogicException("The MathAssess extensions package could not be configured to communicate with Maxima. This package should not have been used in this case");
        }
    }
    return maximaSession;
}
Also used : QtiMaximaProcess(uk.ac.ed.ph.qtiworks.mathassess.glue.maxima.QtiMaximaProcess) QtiLogicException(uk.ac.ed.ph.jqtiplus.exception.QtiLogicException)

Example 2 with QtiLogicException

use of uk.ac.ed.ph.jqtiplus.exception.QtiLogicException in project openolat by klemens.

the class OpenOLATExtensionPackage method obtainMaximaSessionForThread.

// ------------------------------------------------------------------------
public QtiMaximaProcess obtainMaximaSessionForThread() {
    QtiMaximaProcess maximaSession = sessionThreadLocal.get();
    if (maximaSession == null) {
        if (qtiMaximaProcessPoolManager != null) {
            log.debug("Obtaining new maxima process from pool for this request");
            /* Need to get a new process from pool */
            maximaSession = qtiMaximaProcessPoolManager.obtainProcess();
            sessionThreadLocal.set(maximaSession);
        } else {
            throw new QtiLogicException("The MathAssess extensions package could not be configured to communicate with Maxima. This package should not have been used in this case");
        }
    }
    return maximaSession;
}
Also used : QtiMaximaProcess(uk.ac.ed.ph.qtiworks.mathassess.glue.maxima.QtiMaximaProcess) QtiLogicException(uk.ac.ed.ph.jqtiplus.exception.QtiLogicException)

Aggregations

QtiLogicException (uk.ac.ed.ph.jqtiplus.exception.QtiLogicException)2 QtiMaximaProcess (uk.ac.ed.ph.qtiworks.mathassess.glue.maxima.QtiMaximaProcess)2