Search in sources :

Example 1 with LogSubscriberSocket

use of com.centurylink.mdw.designer.runtime.LogSubscriberSocket in project mdw-designer by CenturyLinkCloud.

the class LogWatcher method startup.

public void startup(boolean watchProcess) {
    this.watchProcess = watchProcess;
    if (logListener != null)
        // already started
        return;
    pattern = Pattern.compile(MESSAGE_REG_EX, Pattern.DOTALL);
    processInstancePages = new HashMap<Long, ProcessInstancePage>();
    processInstances = new HashMap<Long, ProcessInstanceVO>();
    accumulated = new LinkedList<ProcessInstanceUpdater>();
    scheduleShutdown = false;
    MessageConsole console = MessageConsole.findConsole("Live View Log", icon, display);
    console.setRunnableEntity(this);
    console.setDefaultShowPref(true);
    console.setStatus(MessageConsole.STATUS_RUNNING);
    console.clearConsole();
    outputStream = console.newMessageStream();
    try {
        dataAccess = new DesignerDataAccess(process.getProject().getDesignerProxy().getDesignerDataAccess());
        logListener = new LogSubscriberSocket(dataAccess, serverSettings.getLogWatcherPort(), process.getProject().isOldNamespaces()) {

            protected void handleMessage(String message) {
                handleLogMessage(message);
            }
        };
        logListener.start(true);
        new Thread(new Runnable() {

            public void run() {
                processQueue();
            }
        }).start();
    } catch (Exception ex) {
        if (outputStream != null)
            ex.printStackTrace(new PrintStream(outputStream));
        if (logListener != null && !logListener.isClosed()) {
            logListener.shutdown();
            logListener = null;
        }
        PluginMessages.uiError(ex, "Monitor Logs", process.getProject());
    }
}
Also used : PrintStream(java.io.PrintStream) MessageConsole(com.centurylink.mdw.plugin.MessageConsole) IOException(java.io.IOException) LogSubscriberSocket(com.centurylink.mdw.designer.runtime.LogSubscriberSocket) ProcessInstancePage(com.centurylink.mdw.designer.runtime.ProcessInstancePage) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Aggregations

DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)1 LogSubscriberSocket (com.centurylink.mdw.designer.runtime.LogSubscriberSocket)1 ProcessInstancePage (com.centurylink.mdw.designer.runtime.ProcessInstancePage)1 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)1 MessageConsole (com.centurylink.mdw.plugin.MessageConsole)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1