- clean up
- addjust timeouts
This commit is contained in:
parent
3a5b990e4a
commit
859c6a2220
@ -43,7 +43,6 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
|
||||
private PresentationFileProcessor presentationFileProcessor;
|
||||
|
||||
public void processDocument(UploadedPresentation pres) {
|
||||
System.out.println("****** RECEIVED NEW FILE " + pres.getName());
|
||||
|
||||
SupportedDocumentFilter sdf = new SupportedDocumentFilter(gw);
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class Jpeg2SwfPageConverter implements PageConverter {
|
||||
|
||||
String COMMAND = SWFTOOLS_DIR + File.separatorChar + "jpeg2swf -o " + output.getAbsolutePath() + " " + presentationFile.getAbsolutePath();
|
||||
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 10000);
|
||||
|
||||
if (done && output.exists()) {
|
||||
return true;
|
||||
|
@ -24,7 +24,7 @@ public class OfficeDocumentValidator2 {
|
||||
|
||||
log.info("Running pres check " + COMMAND);
|
||||
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 25000);
|
||||
|
||||
if (done) {
|
||||
return true;
|
||||
|
@ -29,10 +29,11 @@ public class PageExtractorImp implements PageExtractor {
|
||||
private static Logger log = LoggerFactory.getLogger(PageExtractorImp.class);
|
||||
|
||||
private static final String SPACE = " ";
|
||||
private static final long extractTimeout = 10000; // 10sec
|
||||
|
||||
public boolean extractPage(File presentationFile, File output, int page) {
|
||||
String COMMAND = "pdfseparate -f " + page + " -l " + page + SPACE
|
||||
+ presentationFile.getAbsolutePath() + SPACE + output.getAbsolutePath();
|
||||
return new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
return new ExternalProcessExecutor().exec(COMMAND, extractTimeout);
|
||||
}
|
||||
}
|
||||
|
@ -74,20 +74,16 @@ public class PageToConvert {
|
||||
convertPdfToSwf(pres, page, pageFile);
|
||||
}
|
||||
|
||||
//System.out.println("****** CREATING THM page=" + page);
|
||||
/* adding accessibility */
|
||||
createThumbnails(pres, page, pageFile);
|
||||
|
||||
//System.out.println("****** CREATING TXTs page=" + page);
|
||||
createTextFiles(pres, page);
|
||||
|
||||
//System.out.println("****** CREATING SVGs page=" + page);
|
||||
// only create SVG images if the configuration requires it
|
||||
if (svgImagesRequired) {
|
||||
createSvgImages(pres, page);
|
||||
}
|
||||
|
||||
//System.out.println("****** CREATING PNGs page=" + page);
|
||||
// only create PNG images if the configuration requires it
|
||||
if (generatePngs) {
|
||||
createPngImages(pres, page, pageFile);
|
||||
@ -96,8 +92,6 @@ public class PageToConvert {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void createThumbnails(UploadedPresentation pres, int page, File pageFile) {
|
||||
//notifier.sendCreatingThumbnailsUpdateMessage(pres);
|
||||
thumbnailCreator.createThumbnail(pres, page, pageFile);
|
||||
|
@ -13,6 +13,6 @@ public class PdfPageDownscaler {
|
||||
|
||||
//System.out.println("DOWNSCALING " + COMMAND);
|
||||
|
||||
return new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
return new ExternalProcessExecutor().exec(COMMAND, 10000);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class PdfToSwfSlidesGenerationService {
|
||||
private PresentationConversionCompletionService presentationConversionCompletionService;
|
||||
|
||||
public PdfToSwfSlidesGenerationService(int numConversionThreads) {
|
||||
executor = Executors.newFixedThreadPool(5);
|
||||
executor = Executors.newFixedThreadPool(numConversionThreads);
|
||||
}
|
||||
|
||||
public void process(PageToConvert pageToConvert) {
|
||||
|
@ -38,7 +38,7 @@ public class Png2SwfPageConverter implements PageConverter {
|
||||
public boolean convert(File presentationFile, File output, int page, UploadedPresentation pres){
|
||||
String COMMAND = SWFTOOLS_DIR + File.separatorChar + "png2swf -o " + output.getAbsolutePath() + " " + presentationFile.getAbsolutePath();
|
||||
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 10000);
|
||||
|
||||
if (done && output.exists()) {
|
||||
return true;
|
||||
|
@ -116,7 +116,7 @@ public class PngCreatorImp implements PngCreator {
|
||||
|
||||
//System.out.println("********* CREATING PNGs " + COMMAND);
|
||||
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 10000);
|
||||
|
||||
if (done) {
|
||||
return true;
|
||||
|
@ -43,9 +43,6 @@ public class PresentationConversionCompletionService {
|
||||
PresentationToConvert p = presentationsToConvert.get(m.presId);
|
||||
if (p != null) {
|
||||
p.incrementPagesCompleted();
|
||||
|
||||
System.out.println("****** Received page complete " + m.page + " from " + p.pres.getName());
|
||||
|
||||
notifier.sendConversionUpdateMessage(p.getPagesCompleted(), p.pres, m.page);
|
||||
if (p.getPagesCompleted() == p.pres.getNumberOfPages()) {
|
||||
handleEndProcessing(p);
|
||||
@ -71,7 +68,6 @@ public class PresentationConversionCompletionService {
|
||||
String logStr = gson.toJson(logData);
|
||||
log.info(" --analytics-- data={}", logStr);
|
||||
|
||||
System.out.println("****** Conversion complete for " + p.pres.getName());
|
||||
notifier.sendConversionCompletedMessage(p.pres);
|
||||
}
|
||||
public void start() {
|
||||
|
@ -53,8 +53,6 @@ public class PresentationFileProcessor {
|
||||
}
|
||||
|
||||
public synchronized void process(UploadedPresentation pres) {
|
||||
System.out.println("****** QUEUE FOR PROCESSING FILE " + pres.getName());
|
||||
//presentations.offer(pres);
|
||||
Runnable messageProcessor = new Runnable() {
|
||||
public void run() {
|
||||
processUploadedPresentation(pres);
|
||||
@ -64,7 +62,6 @@ public class PresentationFileProcessor {
|
||||
}
|
||||
|
||||
private void processUploadedPresentation(UploadedPresentation pres) {
|
||||
System.out.println("****** PROCESSING FILE " + pres.getName());
|
||||
if (SupportedFileTypes.isPdfFile(pres.getFileType())) {
|
||||
determineNumberOfPages(pres);
|
||||
sendDocPageConversionStartedProgress(pres);
|
||||
@ -80,9 +77,6 @@ public class PresentationFileProcessor {
|
||||
|
||||
private void extractIntoPages(UploadedPresentation pres) {
|
||||
for (int page = 1; page <= pres.getNumberOfPages(); page++) {
|
||||
|
||||
System.out.println("****** Extracting page " + page + " from " + pres.getName());
|
||||
|
||||
File extractedPageFile = extractPage(pres, page);
|
||||
File downscaledPageFile = downscalePage(pres, extractedPageFile, page);
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class ThumbnailCreatorImp implements ThumbnailCreator {
|
||||
|
||||
//System.out.println(COMMAND);
|
||||
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 60000);
|
||||
boolean done = new ExternalProcessExecutor().exec(COMMAND, 10000);
|
||||
|
||||
if (done) {
|
||||
return true;
|
||||
|
@ -96,7 +96,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<bean id="presentationFileProcessor"
|
||||
class="org.bigbluebutton.presentation.imp.PresentationFileProcessor">
|
||||
<constructor-arg index="0" value="${numConversionThreads}"/>
|
||||
<constructor-arg index="0" value="${numFileProcessorThreads}"/>
|
||||
<property name="pageConverter" ref="pdf2SwfPageConverter"/>
|
||||
<property name="thumbnailCreator" ref="thumbCreator"/>
|
||||
<property name="pngCreator" ref="pngCreator"/>
|
||||
|
Loading…
Reference in New Issue
Block a user