|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.fr.start; |
|
|
|
package com.fr.start; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.common.report.ReportState; |
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
import com.fr.design.dialog.ErrorDialog; |
|
|
|
import com.fr.design.dialog.ErrorDialog; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
@ -9,12 +10,14 @@ import com.fr.design.utils.DesignUtils; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.Event; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.event.Null; |
|
|
|
import com.fr.event.Null; |
|
|
|
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.process.FineProcess; |
|
|
|
import com.fr.process.FineProcess; |
|
|
|
import com.fr.process.ProcessEventPipe; |
|
|
|
import com.fr.process.ProcessEventPipe; |
|
|
|
import com.fr.process.engine.core.FineProcessContext; |
|
|
|
import com.fr.process.engine.core.FineProcessContext; |
|
|
|
import com.fr.process.engine.core.FineProcessEngineEvent; |
|
|
|
import com.fr.process.engine.core.FineProcessEngineEvent; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.ScheduledExecutorService; |
|
|
|
import java.util.concurrent.ScheduledExecutorService; |
|
|
|
import java.util.concurrent.ScheduledFuture; |
|
|
|
import java.util.concurrent.ScheduledFuture; |
|
|
@ -33,10 +36,12 @@ public class DesignerSuperListener { |
|
|
|
private static final int FIXED_FREQ = 2; |
|
|
|
private static final int FIXED_FREQ = 2; |
|
|
|
|
|
|
|
|
|
|
|
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener")); |
|
|
|
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener")); |
|
|
|
|
|
|
|
private final ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help")); |
|
|
|
|
|
|
|
|
|
|
|
private FineProcess process; |
|
|
|
private FineProcess process; |
|
|
|
private ScheduledFuture fixedFuture; |
|
|
|
private ScheduledFuture fixedFuture; |
|
|
|
private ScheduledFuture onceFuture; |
|
|
|
private ScheduledFuture onceFuture; |
|
|
|
|
|
|
|
private volatile boolean cancel = false; |
|
|
|
|
|
|
|
|
|
|
|
private DesignerSuperListener() { |
|
|
|
private DesignerSuperListener() { |
|
|
|
|
|
|
|
|
|
|
@ -49,6 +54,7 @@ public class DesignerSuperListener { |
|
|
|
public void start() { |
|
|
|
public void start() { |
|
|
|
process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE); |
|
|
|
process = FineProcessContext.getProcess(DesignerProcessType.INSTANCE); |
|
|
|
startExitListener(); |
|
|
|
startExitListener(); |
|
|
|
|
|
|
|
startHelpLister(); |
|
|
|
startFrameListener(); |
|
|
|
startFrameListener(); |
|
|
|
startFallBackListener(); |
|
|
|
startFallBackListener(); |
|
|
|
} |
|
|
|
} |
|
|
@ -62,6 +68,24 @@ public class DesignerSuperListener { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void startHelpLister() { |
|
|
|
|
|
|
|
helpService.submit(new Runnable() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
|
|
while (!cancel) { |
|
|
|
|
|
|
|
ProcessEventPipe pipe = process.getPipe(); |
|
|
|
|
|
|
|
String msg = pipe.info(); |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(ReportState.STOP.getValue(), msg)) { |
|
|
|
|
|
|
|
onceFuture.cancel(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(ReportState.ACTIVE.getValue(), msg)) { |
|
|
|
|
|
|
|
startFrameListener(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void startFrameListener() { |
|
|
|
private void startFrameListener() { |
|
|
|
onceFuture = service.schedule(new Runnable() { |
|
|
|
onceFuture = service.schedule(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -138,10 +162,12 @@ public class DesignerSuperListener { |
|
|
|
public void stopTask() { |
|
|
|
public void stopTask() { |
|
|
|
onceFuture.cancel(false); |
|
|
|
onceFuture.cancel(false); |
|
|
|
fixedFuture.cancel(false); |
|
|
|
fixedFuture.cancel(false); |
|
|
|
|
|
|
|
cancel = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void stop() { |
|
|
|
public void stop() { |
|
|
|
stopTask(); |
|
|
|
stopTask(); |
|
|
|
service.shutdown(); |
|
|
|
service.shutdown(); |
|
|
|
|
|
|
|
helpService.shutdown(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|