- add delay to processing of presentation to make sure that meeting has already been

created. This makes sure that the meeting is able to handle the presentation
   processing events.
This commit is contained in:
Richard Alam 2017-03-06 20:05:26 +00:00
parent 3ec0167812
commit 1a2bd4d74d
3 changed files with 40 additions and 6 deletions

View File

@ -56,7 +56,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<bean id="recordingServiceHelper" class="org.bigbluebutton.api.RecordingServiceHelperImp"/>
<bean id="presDownloadService" class="org.bigbluebutton.presentation.PresentationUrlDownloadService">
<bean id="presDownloadService" class="org.bigbluebutton.presentation.PresentationUrlDownloadService" destroy-method="stop">
<property name="presentationDir" value="${presentationDir}"/>
<property name="presentationBaseURL" value="${presentationBaseURL}"/>
<property name="pageExtractor" ref="pageExtractor"/>

View File

@ -560,7 +560,7 @@ public class MeetingService implements MessageListener {
createMeeting(breakout);
presDownloadService.extractPage(message.parentMeetingId,
presDownloadService.extractPresentationPage(message.parentMeetingId,
message.sourcePresentationId,
message.sourcePresentationSlide, breakout.getInternalId());
} else {

View File

@ -6,6 +6,10 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.httpclient.HttpClient;
@ -29,8 +33,24 @@ public class PresentationUrlDownloadService {
private String presentationDir;
private String BLANK_PRESENTATION;
public void processUploadedPresentation(UploadedPresentation uploadedPres) {
documentConversionService.processDocument(uploadedPres);
private ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(3);
public void stop() {
scheduledThreadPool.shutdownNow();
}
public void processUploadedPresentation(final UploadedPresentation uploadedPres) {
/**
* We delay processing of the presentation to make sure that the meeting has already been created.
* Otherwise, the meeting won't get the conversion events.
*/
ScheduledFuture scheduledFuture =
scheduledThreadPool.schedule(new Runnable() {
public void run() {
documentConversionService.processDocument(uploadedPres);
}
}, 5, TimeUnit.SECONDS);
}
public void processUploadedFile(String meetingId, String presId,
@ -41,8 +61,22 @@ public class PresentationUrlDownloadService {
processUploadedPresentation(uploadedPres);
}
public void extractPage(String sourceMeetingId, String presentationId,
Integer presentationSlide, String destinationMeetingId) {
public void extractPresentationPage(final String sourceMeetingId, final String presentationId,
final Integer presentationSlide, final String destinationMeetingId) {
/**
* We delay processing of the presentation to make sure that the meeting has already been created.
* Otherwise, the meeting won't get the conversion events.
*/
ScheduledFuture scheduledFuture =
scheduledThreadPool.schedule(new Runnable() {
public void run() {
extractPage(sourceMeetingId, presentationId, presentationSlide, destinationMeetingId) ;
}
}, 5, TimeUnit.SECONDS);
}
private void extractPage(final String sourceMeetingId, final String presentationId,
final Integer presentationSlide, final String destinationMeetingId) {
// Build the source meeting path
File sourceMeetingPath = new File(presentationDir + File.separator