diff --git a/main/targetplatform/io.sarl.lang.targetplatform.target b/main/targetplatform/io.sarl.lang.targetplatform.target index c8920fc18a..aae1883e38 100644 --- a/main/targetplatform/io.sarl.lang.targetplatform.target +++ b/main/targetplatform/io.sarl.lang.targetplatform.target @@ -35,6 +35,7 @@ + @@ -44,7 +45,7 @@ - + diff --git a/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF b/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF index a68b18a688..34feb117e6 100644 --- a/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF +++ b/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF @@ -32,7 +32,8 @@ Require-Bundle: io.sarl.core;bundle-version="0.11.0", org.apache.log4j;bundle-version="1.2.15", org.eclipse.xtend.lib;bundle-version="2.20.0", stax2-api;bundle-version="4.2.0", - com.google.guava.failureaccess;bundle-version="1.0.1" + com.google.guava.failureaccess;bundle-version="1.0.1", + java-uuid-generator;bundle-version="4.0.1" Bundle-ActivationPolicy: lazy Bundle-Vendor: %Bundle-Vendor Export-Package: io.sarl.sre; diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/skills/bic/SchedulesSkill.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/skills/bic/SchedulesSkill.sarl index fc54359cd1..e514a8d337 100644 --- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/skills/bic/SchedulesSkill.sarl +++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/skills/bic/SchedulesSkill.sarl @@ -20,6 +20,9 @@ */ package io.sarl.sre.skills.bic +import com.fasterxml.uuid.EthernetAddress +import com.fasterxml.uuid.Generators +import com.fasterxml.uuid.impl.TimeBasedGenerator import io.sarl.core.AgentTask import io.sarl.core.Logging import io.sarl.core.Time @@ -38,6 +41,7 @@ import java.text.MessageFormat import java.util.Map import java.util.UUID import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.ConcurrentSkipListSet import java.util.concurrent.ExecutionException import java.util.concurrent.Future import java.util.concurrent.TimeUnit @@ -48,7 +52,6 @@ import javax.inject.Inject import static io.sarl.sre.services.lifecycle.AgentLife.* import static io.sarl.sre.services.lifecycle.BehaviorLife.* -import java.util.concurrent.ConcurrentSkipListSet /** * Skill that permits to execute tasks with an executor service. @@ -69,7 +72,15 @@ skill SchedulesSkill extends Skill implements InternalSchedules { var activeTaskRepository : ConcurrentHashMap = null - /** Constructor. + /** + * JUG Time based generator used for naming tasks, enough for this kind of missions not for a string unique UUID + * Goal: replace UUID.randomUUID that is way too slow in multithread context + */ + var uuidTimeBasedGenerator : TimeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface()); + + + /** + * Constructor. */ @Inject new (service : ExecutorService) { @@ -139,7 +150,9 @@ skill SchedulesSkill extends Skill implements InternalSchedules { var description : TaskDescription = null var realName : String if (name.isNullOrEmpty) { - realName = "task-" + UUID::randomUUID.toString + // see http://www.cowtowncoder.com/blog/archives/2010/10/entry_429.html + //Don't use UUID::randomUUID way too slow + realName = "task-" + uuidTimeBasedGenerator.generate().toString } else { realName = name