use of org.ow2.proactive.scheduler.synchronization.SynchronizationInternal in project scheduling by ow2-proactive.
the class SignalApiTest method classInit.
@BeforeClass
public static void classInit() throws IOException, ActiveObjectCreationException, NodeException, AlreadyBoundException {
CentralPAPropertyRepository.PA_CLASSLOADING_USEHTTP.setValue(false);
if (System.getProperty("log4j.configuration") == null) {
// While logger is not configured and it not set with sys properties, use Console logger
Logger.getRootLogger().getLoggerRepository().resetConfiguration();
BasicConfigurator.configure(new ConsoleAppender(new PatternLayout("%m%n")));
Logger.getRootLogger().setLevel(Level.DEBUG);
}
Logger.getLogger(SignalApiImpl.class).setLevel(Level.TRACE);
tempFolder = folder.newFolder("signal");
Node localNode = ProActiveRuntimeImpl.getProActiveRuntime().createLocalNode("signal-node-0", true, "signal-v-node-0");
synchronizationInternal = PAActiveObject.newActive(AOSynchronization.class, new Object[] { tempFolder.getAbsolutePath() }, localNode);
synchronizationInternal.createChannelIfAbsent(USER, TASK_ID, SIGNALS_CHANNEL, true);
signalApi = new SignalApiImpl(USER, TASK_ID, synchronizationInternal);
executor = Executors.newFixedThreadPool(2);
}
use of org.ow2.proactive.scheduler.synchronization.SynchronizationInternal 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