Search in sources :

Example 1 with QMMetaEvent

use of org.jkiss.dbeaver.model.qm.QMMetaEvent in project dbeaver by dbeaver.

the class TransactionInfoDialog method createContextFilter.

protected QMEventFilter createContextFilter(DBCExecutionContext executionContext) {
    if (executionContext == null) {
        return VOID_FILTER;
    }
    final boolean showAll = showAllCheck != null && showAllCheck.getSelection();
    final boolean showPrevious = showPreviousCheck != null && showPreviousCheck.getSelection();
    final QMMSessionInfo currentSession = QMUtils.getCurrentSession(executionContext);
    final QMMTransactionSavepointInfo currentSP = QMUtils.getCurrentTransaction(executionContext);
    QMEventFilter filter = new QMEventFilter() {

        @Override
        public boolean accept(QMMetaEvent event) {
            QMMObject object = event.getObject();
            if (object instanceof QMMStatementExecuteInfo) {
                QMMStatementExecuteInfo exec = (QMMStatementExecuteInfo) object;
                if (!showPrevious && exec.getSavepoint() != currentSP) {
                    return false;
                }
                if (exec.getStatement().getSession() != currentSession) {
                    return false;
                }
                DBCExecutionPurpose purpose = exec.getStatement().getPurpose();
                if (purpose == DBCExecutionPurpose.META || purpose == DBCExecutionPurpose.UTIL) {
                    return false;
                }
                return (showAll || exec.isTransactional());
            }
            return false;
        }
    };
    return filter;
}
Also used : QMMSessionInfo(org.jkiss.dbeaver.model.qm.meta.QMMSessionInfo) QMEventFilter(org.jkiss.dbeaver.model.qm.QMEventFilter) QMMetaEvent(org.jkiss.dbeaver.model.qm.QMMetaEvent) QMMStatementExecuteInfo(org.jkiss.dbeaver.model.qm.meta.QMMStatementExecuteInfo) DBCExecutionPurpose(org.jkiss.dbeaver.model.exec.DBCExecutionPurpose) QMMObject(org.jkiss.dbeaver.model.qm.meta.QMMObject) QMMTransactionSavepointInfo(org.jkiss.dbeaver.model.qm.meta.QMMTransactionSavepointInfo)

Example 2 with QMMetaEvent

use of org.jkiss.dbeaver.model.qm.QMMetaEvent in project dbeaver by serge-rider.

the class QMLogFileWriter method metaInfoChanged.

@Override
public synchronized void metaInfoChanged(@NotNull List<QMMetaEvent> events) {
    if (!enabled || logWriter == null) {
        return;
    }
    StringBuilder logBuffer = new StringBuilder(4000);
    for (QMMetaEvent event : events) {
        if (eventFilter.accept(event)) {
            writeEvent(logBuffer, event);
        }
    }
    try {
        logWriter.write(logBuffer.toString());
        logWriter.flush();
    } catch (IOException e) {
        log.warn("IO error writing QM log. Disable log file writer", e);
        ContentUtils.close(logWriter);
        logWriter = null;
    }
}
Also used : QMMetaEvent(org.jkiss.dbeaver.model.qm.QMMetaEvent) IOException(java.io.IOException)

Example 3 with QMMetaEvent

use of org.jkiss.dbeaver.model.qm.QMMetaEvent in project dbeaver by dbeaver.

the class QMLogFileWriter method metaInfoChanged.

@Override
public synchronized void metaInfoChanged(@NotNull List<QMMetaEvent> events) {
    if (!enabled || logWriter == null) {
        return;
    }
    StringBuilder logBuffer = new StringBuilder(4000);
    for (QMMetaEvent event : events) {
        if (eventFilter.accept(event)) {
            writeEvent(logBuffer, event);
        }
    }
    try {
        logWriter.write(logBuffer.toString());
        logWriter.flush();
    } catch (IOException e) {
        log.warn("IO error writing QM log. Disable log file writer", e);
        ContentUtils.close(logWriter);
        logWriter = null;
    }
}
Also used : QMMetaEvent(org.jkiss.dbeaver.model.qm.QMMetaEvent) IOException(java.io.IOException)

Example 4 with QMMetaEvent

use of org.jkiss.dbeaver.model.qm.QMMetaEvent in project dbeaver by serge-rider.

the class QMLogFileWriter method metaInfoChanged.

@Override
public synchronized void metaInfoChanged(DBRProgressMonitor monitor, @NotNull List<QMMetaEvent> events) {
    if (!enabled || logWriter == null) {
        return;
    }
    StringBuilder logBuffer = new StringBuilder(4000);
    for (QMMetaEvent event : events) {
        if (eventFilter.accept(event)) {
            writeEvent(logBuffer, event);
        }
    }
    try {
        logWriter.write(logBuffer.toString());
        logWriter.flush();
    } catch (IOException e) {
        log.warn("IO error writing QM log. Disable log file writer", e);
        ContentUtils.close(logWriter);
        logWriter = null;
    }
}
Also used : QMMetaEvent(org.jkiss.dbeaver.model.qm.QMMetaEvent) IOException(java.io.IOException)

Aggregations

QMMetaEvent (org.jkiss.dbeaver.model.qm.QMMetaEvent)4 IOException (java.io.IOException)3 DBCExecutionPurpose (org.jkiss.dbeaver.model.exec.DBCExecutionPurpose)1 QMEventFilter (org.jkiss.dbeaver.model.qm.QMEventFilter)1 QMMObject (org.jkiss.dbeaver.model.qm.meta.QMMObject)1 QMMSessionInfo (org.jkiss.dbeaver.model.qm.meta.QMMSessionInfo)1 QMMStatementExecuteInfo (org.jkiss.dbeaver.model.qm.meta.QMMStatementExecuteInfo)1 QMMTransactionSavepointInfo (org.jkiss.dbeaver.model.qm.meta.QMMTransactionSavepointInfo)1