use of org.ow2.proactive.scheduler.synchronization.AOSynchronization in project scheduling by ow2-proactive.
the class SchedulerFrontend method startSynchronizationService.
private SynchronizationInternal startSynchronizationService() throws java.io.IOException, ProActiveException {
// Create and start the Synchronization Service Active Object
final AOSynchronization privateStore = PAActiveObject.newActive(AOSynchronization.class, new Object[] { PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_SYNCHRONIZATION_DATABASE.getValueAsString()) });
// Wait for the service to be actually started
privateStore.isStarted();
Runtime.getRuntime().addShutdownHook(new Thread(() -> PAActiveObject.terminateActiveObject(privateStore, true)));
// We use the following trick to obtain a ProActive Stub which only implements methods declared in the SynchronizationInternal interface.
// As this stub will be used remotely inside task, we make sure that it does not drag unnecessary dependencies (static fields, internal methods, etc)
SynchronizationInternal publicStore = PAActiveObject.lookupActive(SynchronizationInternal.class, PAActiveObject.getUrl(privateStore));
// register this service and give it a name
PAActiveObject.registerByName(publicStore, SchedulerConstants.SYNCHRONIZATION_DEFAULT_NAME);
return publicStore;
}
Aggregations