Search in sources :

Example 1 with OScheduledEventBuilder

use of com.orientechnologies.orient.core.schedule.OScheduledEventBuilder in project orientdb by orientechnologies.

the class DistributedSchedulerTest method eventByAPI.

private void eventByAPI() throws InterruptedException {
    final ODatabaseDocumentTx db = new ODatabaseDocumentTx(getDatabaseURL(serverInstance.get(0)));
    db.open("admin", "admin");
    OFunction func = createFunction(db);
    db.getMetadata().getScheduler().scheduleEvent(new OScheduledEventBuilder().setName("test").setRule("0/1 * * * * ?").setFunction(func).build());
    Thread.sleep(5000);
    Long count = getLogCounter(db);
    Assert.assertTrue("count = " + count, count > 0);
    db.getMetadata().getScheduler().removeEvent("test");
    db.close();
}
Also used : OScheduledEventBuilder(com.orientechnologies.orient.core.schedule.OScheduledEventBuilder) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OFunction(com.orientechnologies.orient.core.metadata.function.OFunction)

Aggregations

ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)1 OFunction (com.orientechnologies.orient.core.metadata.function.OFunction)1 OScheduledEventBuilder (com.orientechnologies.orient.core.schedule.OScheduledEventBuilder)1