diff --git a/docs/allclasses-index.html b/docs/allclasses-index.html index 8cb5e62..6534011 100644 --- a/docs/allclasses-index.html +++ b/docs/allclasses-index.html @@ -1,11 +1,11 @@ - + All Classes and Interfaces - + diff --git a/docs/allpackages-index.html b/docs/allpackages-index.html index 4a21457..f01cd56 100644 --- a/docs/allpackages-index.html +++ b/docs/allpackages-index.html @@ -1,11 +1,11 @@ - + All Packages - + diff --git a/docs/help-doc.html b/docs/help-doc.html index 13cb13d..095df98 100644 --- a/docs/help-doc.html +++ b/docs/help-doc.html @@ -1,11 +1,11 @@ - + API Help - + diff --git a/docs/index-files/index-1.html b/docs/index-files/index-1.html index 9372a65..19ca7c2 100644 --- a/docs/index-files/index-1.html +++ b/docs/index-files/index-1.html @@ -1,11 +1,11 @@ - + A-Index - + @@ -58,7 +58,9 @@ loadScripts(document, 'script');
addToExistingPool(ServicePool, IService...) - Method in class io.github.simplex.simplexss.ServiceManager
 
associatedServices - Variable in class io.github.simplex.simplexss.ServicePool
-
 
+
+
A collection of services related to this service pool.
+
A C D E F G I L M N O P Q R S T 
All Classes and Interfaces|All Packages|Serialized Form diff --git a/docs/index-files/index-10.html b/docs/index-files/index-10.html index 2897510..4394a84 100644 --- a/docs/index-files/index-10.html +++ b/docs/index-files/index-10.html @@ -1,11 +1,11 @@ - + N-Index - + @@ -54,7 +54,13 @@ loadScripts(document, 'script');

N

name - Variable in class io.github.simplex.simplexss.ServicePool
-
 
+
+
The key used to identify this service pool.
+
+
newNamespacedKey(String, String) - Static method in interface io.github.simplex.api.IService
+
+
This is an easy static call for creating a new namespaced key for services and service pools.
+
A C D E F G I L M N O P Q R S T 
All Classes and Interfaces|All Packages|Serialized Form diff --git a/docs/index-files/index-11.html b/docs/index-files/index-11.html index eb494e3..e808c8a 100644 --- a/docs/index-files/index-11.html +++ b/docs/index-files/index-11.html @@ -1,11 +1,11 @@ - + O-Index - + diff --git a/docs/index-files/index-12.html b/docs/index-files/index-12.html index 2e7658c..61a4219 100644 --- a/docs/index-files/index-12.html +++ b/docs/index-files/index-12.html @@ -1,11 +1,11 @@ - + P-Index - + @@ -53,12 +53,16 @@ loadScripts(document, 'script'); A C D E F G I L M N O P Q R S T 
All Classes and Interfaces|All Packages|Serialized Form

P

+
parentPool - Variable in class io.github.simplex.api.ExecutableService
+
 
period - Variable in class io.github.simplex.api.ExecutableService
 
plugin - Variable in class io.github.simplex.impl.ServiceImpl
 
plugin - Variable in class io.github.simplex.simplexss.SchedulingSystem
 
+
pool - Variable in class io.github.simplex.impl.Main
+
 
A C D E F G I L M N O P Q R S T 
All Classes and Interfaces|All Packages|Serialized Form diff --git a/docs/index-files/index-13.html b/docs/index-files/index-13.html index f5006ba..9e811d8 100644 --- a/docs/index-files/index-13.html +++ b/docs/index-files/index-13.html @@ -1,11 +1,11 @@ - + Q-Index - + @@ -57,6 +57,8 @@ loadScripts(document, 'script');
 
queue(IService) - Method in interface io.github.simplex.api.ISchedule
 
+
queueService(NamespacedKey) - Method in class io.github.simplex.simplexss.ServicePool
+
 
A C D E F G I L M N O P Q R S T 
All Classes and Interfaces|All Packages|Serialized Form diff --git a/docs/index-files/index-14.html b/docs/index-files/index-14.html index bbafa59..d524957 100644 --- a/docs/index-files/index-14.html +++ b/docs/index-files/index-14.html @@ -1,11 +1,11 @@ - + R-Index - + diff --git a/docs/index-files/index-15.html b/docs/index-files/index-15.html index 87ddec9..f1eea77 100644 --- a/docs/index-files/index-15.html +++ b/docs/index-files/index-15.html @@ -1,11 +1,11 @@ - + S-Index - + @@ -56,11 +56,15 @@ loadScripts(document, 'script');
scheduler - Variable in class io.github.simplex.impl.Main
 
scheduler - Variable in class io.github.simplex.simplexss.ServicePool
-
 
+
+
The scheduler used to run the services in this pool.
+
SchedulingSystem<T extends org.bukkit.plugin.java.JavaPlugin> - Class in io.github.simplex.simplexss
 
SchedulingSystem(ServiceManager, T) - Constructor for class io.github.simplex.simplexss.SchedulingSystem
-
 
+
+
Creates a new instance of the scheduling system.
+
service_name - Variable in class io.github.simplex.api.ExecutableService
 
ServiceImpl - Class in io.github.simplex.impl
@@ -72,7 +76,9 @@ loadScripts(document, 'script');
ServiceManager - Class in io.github.simplex.simplexss
 
ServiceManager() - Constructor for class io.github.simplex.simplexss.ServiceManager
-
 
+
+
Creates a new instance of the Service Manager class.
+
ServicePool - Class in io.github.simplex.simplexss
 
ServicePool(NamespacedKey, boolean) - Constructor for class io.github.simplex.simplexss.ServicePool
@@ -91,8 +97,6 @@ loadScripts(document, 'script');
start() - Method in class io.github.simplex.impl.ServiceImpl
 
-
startService(NamespacedKey) - Method in class io.github.simplex.simplexss.ServicePool
-
 
startServices() - Method in class io.github.simplex.simplexss.ServicePool
 
stop() - Method in interface io.github.simplex.api.IService
@@ -101,7 +105,7 @@ loadScripts(document, 'script');
stop() - Method in class io.github.simplex.impl.ServiceImpl
 
-
stopService(NamespacedKey) - Method in class io.github.simplex.simplexss.ServicePool
+
stopService(NamespacedKey, Mono<Disposable>) - Method in class io.github.simplex.simplexss.ServicePool
 
stopServices(Flux<Disposable>) - Method in class io.github.simplex.simplexss.ServicePool
 
diff --git a/docs/index-files/index-16.html b/docs/index-files/index-16.html index 0d78cce..d4253a4 100644 --- a/docs/index-files/index-16.html +++ b/docs/index-files/index-16.html @@ -1,11 +1,11 @@ - + T-Index - + diff --git a/docs/index-files/index-2.html b/docs/index-files/index-2.html index c66c10d..0ad6213 100644 --- a/docs/index-files/index-2.html +++ b/docs/index-files/index-2.html @@ -1,11 +1,11 @@ - + C-Index - + diff --git a/docs/index-files/index-3.html b/docs/index-files/index-3.html index 2779033..68bb6af 100644 --- a/docs/index-files/index-3.html +++ b/docs/index-files/index-3.html @@ -1,11 +1,11 @@ - + D-Index - + @@ -54,7 +54,9 @@ loadScripts(document, 'script');

D

DEFAULT - Static variable in class io.github.simplex.simplexss.ServicePool
-
 
+
+
The default NamespacedKey used to identify unmarked services.
+
delay - Variable in class io.github.simplex.api.ExecutableService
 
disposables - Variable in class io.github.simplex.impl.Main
diff --git a/docs/index-files/index-4.html b/docs/index-files/index-4.html index 1adc22e..9feb55f 100644 --- a/docs/index-files/index-4.html +++ b/docs/index-files/index-4.html @@ -1,11 +1,11 @@ - + E-Index - + @@ -57,7 +57,23 @@ loadScripts(document, 'script');
 
ExecutableService - Class in io.github.simplex.api
 
-
ExecutableService(NamespacedKey, Long, Long, Boolean, Boolean) - Constructor for class io.github.simplex.api.ExecutableService
+
ExecutableService(NamespacedKey) - Constructor for class io.github.simplex.api.ExecutableService
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(ServicePool, NamespacedKey) - Constructor for class io.github.simplex.api.ExecutableService
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(ServicePool, NamespacedKey, Long, Long, Boolean) - Constructor for class io.github.simplex.api.ExecutableService
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(ServicePool, NamespacedKey, Long) - Constructor for class io.github.simplex.api.ExecutableService
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(ServicePool, NamespacedKey, Long, Long, Boolean, Boolean) - Constructor for class io.github.simplex.api.ExecutableService
Creates a new instance of an executable service.
diff --git a/docs/index-files/index-5.html b/docs/index-files/index-5.html index cbd50d4..7912293 100644 --- a/docs/index-files/index-5.html +++ b/docs/index-files/index-5.html @@ -1,11 +1,11 @@ - + F-Index - + diff --git a/docs/index-files/index-6.html b/docs/index-files/index-6.html index 34bcf3a..ec1547b 100644 --- a/docs/index-files/index-6.html +++ b/docs/index-files/index-6.html @@ -1,11 +1,11 @@ - + G-Index - + @@ -73,6 +73,8 @@ loadScripts(document, 'script');
 
getNamespacedKey() - Method in interface io.github.simplex.api.IService
 
+
getParentPool() - Method in class io.github.simplex.api.ExecutableService
+
 
getParentPool() - Method in interface io.github.simplex.api.IService
 
getParentPool() - Method in class io.github.simplex.impl.ServiceImpl
diff --git a/docs/index-files/index-7.html b/docs/index-files/index-7.html index 8be543c..0332d47 100644 --- a/docs/index-files/index-7.html +++ b/docs/index-files/index-7.html @@ -1,11 +1,11 @@ - + I-Index - + diff --git a/docs/index-files/index-8.html b/docs/index-files/index-8.html index 1346fec..13924e0 100644 --- a/docs/index-files/index-8.html +++ b/docs/index-files/index-8.html @@ -1,11 +1,11 @@ - + L-Index - + diff --git a/docs/index-files/index-9.html b/docs/index-files/index-9.html index 68c154f..a41b786 100644 --- a/docs/index-files/index-9.html +++ b/docs/index-files/index-9.html @@ -1,11 +1,11 @@ - + M-Index - + diff --git a/docs/index.html b/docs/index.html index b4f8585..5f68b70 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,11 +1,11 @@ - + Overview - + diff --git a/docs/io/github/simplex/api/Context.html b/docs/io/github/simplex/api/Context.html index 91dd332..8960390 100644 --- a/docs/io/github/simplex/api/Context.html +++ b/docs/io/github/simplex/api/Context.html @@ -1,11 +1,11 @@ - + Context - + diff --git a/docs/io/github/simplex/api/ExecutableService.html b/docs/io/github/simplex/api/ExecutableService.html index f46a1f2..83f0131 100644 --- a/docs/io/github/simplex/api/ExecutableService.html +++ b/docs/io/github/simplex/api/ExecutableService.html @@ -1,11 +1,11 @@ - + ExecutableService - + @@ -108,15 +108,18 @@ implements IS
private final boolean
mayInterruptWhenRunning
 
-
private final long
-
period
+
private ServicePool
+
parentPool
 
-
private final boolean
-
repeating
+
private final long
+
period
 
-
private final org.bukkit.NamespacedKey
-
service_name
+
private final boolean
+
repeating
 
+
private final org.bukkit.NamespacedKey
+
service_name
+
 
@@ -128,7 +131,31 @@ implements IS
Constructor
Description
-
ExecutableService(@NotNull org.bukkit.NamespacedKey service_name, +
ExecutableService(@NotNull org.bukkit.NamespacedKey service_name)
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(@Nullable ServicePool parentPool, + @NotNull org.bukkit.NamespacedKey service_name)
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(@Nullable ServicePool parentPool, + @NotNull org.bukkit.NamespacedKey service_name, + @NotNull Long delay, + @NotNull Long period, + @NotNull Boolean repeating)
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(@Nullable ServicePool parentPool, + @NotNull org.bukkit.NamespacedKey service_name, + @Nullable Long delay)
+
+
Creates a new instance of an executable service.
+
+
ExecutableService(@Nullable ServicePool parentPool, + @NotNull org.bukkit.NamespacedKey service_name, @Nullable Long delay, @Nullable Long period, @NotNull Boolean repeating, @@ -161,20 +188,23 @@ implements IS
org.bukkit.NamespacedKey
 
-
long
- +
reactor.core.publisher.Mono<ServicePool>
+
 
-
boolean
- -
+
long
+ +
 
+
boolean
+ +
Cancels the execution of this service.
-
boolean
- -
 
-
reactor.core.publisher.Mono<Void>
-
setCancelled(boolean cancel)
-
+
boolean
+ +
 
+
reactor.core.publisher.Mono<Void>
+
setCancelled(boolean cancel)
+
Cancels the execution of this service.
@@ -185,7 +215,7 @@ implements IS clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface io.github.simplex.api.IService

-getParentPool, getPlugin, run, start, stop
+getPlugin, run, start, stop
@@ -233,6 +263,12 @@ implements IS
private boolean cancelled
+
  • +
    +

    parentPool

    +
    +
    +
  • @@ -242,9 +278,94 @@ implements IS

    Constructor Details

    • -
      +

      ExecutableService

      public ExecutableService(@NotNull + @NotNull org.bukkit.NamespacedKey service_name)
      +
      +
      +
      Parameters:
      +
      service_name - A namespaced key which can be used to identify the service.
      +
      +
      +
    • +
    • +
      +

      ExecutableService

      +
      public ExecutableService(@Nullable + @Nullable ServicePool parentPool, + @NotNull + @NotNull org.bukkit.NamespacedKey service_name)
      +
      Creates a new instance of an executable service. + Each service is registered with a NamespacedKey, + to allow for easy identification within the associated ServicePool.
      +
      +
      Parameters:
      +
      parentPool - The ServicePool which this service is executing on.
      +
      service_name - A namespaced key which can be used to identify the service.
      +
      +
      +
    • +
    • +
      +

      ExecutableService

      +
      public ExecutableService(@Nullable + @Nullable ServicePool parentPool, + @NotNull + @NotNull org.bukkit.NamespacedKey service_name, + @Nullable + @Nullable Long delay)
      +
      Creates a new instance of an executable service. + The timings are measured in ticks (20 ticks per second). + You do not need to explicitly define a delay. + Each service is registered with a NamespacedKey, + to allow for easy identification within the associated ServicePool.
      +
      +
      Parameters:
      +
      parentPool - The ServicePool which this service is executing on.
      +
      service_name - A namespaced key which can be used to identify the service.
      +
      delay - A specified amount of time (in ticks) to wait before the service runs.
      +
      +
      +
    • +
    • +
      +

      ExecutableService

      +
      public ExecutableService(@Nullable + @Nullable ServicePool parentPool, + @NotNull + @NotNull org.bukkit.NamespacedKey service_name, + @NotNull + @NotNull Long delay, + @NotNull + @NotNull Long period, + @NotNull + @NotNull Boolean repeating)
      +
      Creates a new instance of an executable service. + The timings are measured in ticks (20 ticks per second). + You do not need to explicitly define a delay or a period, + however if you have flagged repeating as true, and the period is null, + then the period will automatically be set to 20 minutes. + Each service is registered with a NamespacedKey, + to allow for easy identification within the associated ServicePool.
      +
      +
      Parameters:
      +
      parentPool - The ServicePool which this service is executing on.
      +
      service_name - A namespaced key which can be used to identify the service.
      +
      delay - A specified amount of time (in ticks) to wait before the service runs.
      +
      period - How long the service should wait between service executions (in ticks).
      +
      repeating - If the service should be scheduled for repeated executions or not.
      +
      +
      +
    • +
    • +
      +

      ExecutableService

      +
      public ExecutableService(@Nullable + @Nullable ServicePool parentPool, + @NotNull @NotNull org.bukkit.NamespacedKey service_name, @Nullable @Nullable Long delay, @@ -263,6 +384,7 @@ implements IS to allow for easy identification within the associated ServicePool.
      Parameters:
      +
      parentPool - The ServicePool which this service is executing on.
      service_name - A namespaced key which can be used to identify the service.
      delay - A specified amount of time (in ticks) to wait before the service runs.
      period - How long the service should wait between service executions (in ticks).
      @@ -357,6 +479,18 @@ implements IS
      Actual stop call, to ensure that the service actually #isCancelled().
    • +
    • +
      +

      getParentPool

      +
      +
      +
      Specified by:
      +
      getParentPool in interface IService
      +
      Returns:
      +
      The ServicePool which this service is executing on.
      +
      +
      +
    diff --git a/docs/io/github/simplex/api/ISchedule.html b/docs/io/github/simplex/api/ISchedule.html index 5db81f5..0b2c17f 100644 --- a/docs/io/github/simplex/api/ISchedule.html +++ b/docs/io/github/simplex/api/ISchedule.html @@ -1,11 +1,11 @@ - + ISchedule - + diff --git a/docs/io/github/simplex/api/IService.html b/docs/io/github/simplex/api/IService.html index e46fe12..87f821f 100644 --- a/docs/io/github/simplex/api/IService.html +++ b/docs/io/github/simplex/api/IService.html @@ -1,11 +1,11 @@ - + IService - + @@ -118,17 +118,23 @@ extends boolean
     
    -
    default void
    -
    run()
    -
     
    -
    reactor.core.publisher.Mono<Void>
    - -
    +
    static @NotNull org.bukkit.NamespacedKey
    + +
    +
    This is an easy static call for creating a new namespaced key for services and service pools.
    +
    +
    default void
    +
    run()
    +
     
    +
    reactor.core.publisher.Mono<Void>
    + +
    The actual start method for the service.
    -
    reactor.core.publisher.Mono<Void>
    - -
    +
    reactor.core.publisher.Mono<Void>
    + +
    The actual end method for the service.
    @@ -248,6 +254,23 @@ extends +

    newNamespacedKey

    +
    +
    This is an easy static call for creating a new namespaced key for services and service pools.
    +
    +
    Parameters:
    +
    space - The namespace of the service.
    +
    key - The key name of the service.
    +
    Returns:
    +
    A NamespacedKey object representing the service.
    +
    + + diff --git a/docs/io/github/simplex/api/InvalidServiceException.html b/docs/io/github/simplex/api/InvalidServiceException.html index 1e0d61a..8269143 100644 --- a/docs/io/github/simplex/api/InvalidServiceException.html +++ b/docs/io/github/simplex/api/InvalidServiceException.html @@ -1,11 +1,11 @@ - + InvalidServiceException - + diff --git a/docs/io/github/simplex/api/InvalidServicePoolException.html b/docs/io/github/simplex/api/InvalidServicePoolException.html index a16bb2e..ef3d554 100644 --- a/docs/io/github/simplex/api/InvalidServicePoolException.html +++ b/docs/io/github/simplex/api/InvalidServicePoolException.html @@ -1,11 +1,11 @@ - + InvalidServicePoolException - + diff --git a/docs/io/github/simplex/api/package-summary.html b/docs/io/github/simplex/api/package-summary.html index d06739b..cc40647 100644 --- a/docs/io/github/simplex/api/package-summary.html +++ b/docs/io/github/simplex/api/package-summary.html @@ -1,11 +1,11 @@ - + io.github.simplex.api - + diff --git a/docs/io/github/simplex/api/package-tree.html b/docs/io/github/simplex/api/package-tree.html index 48dfc13..ede69c8 100644 --- a/docs/io/github/simplex/api/package-tree.html +++ b/docs/io/github/simplex/api/package-tree.html @@ -1,11 +1,11 @@ - + io.github.simplex.api Class Hierarchy - + diff --git a/docs/io/github/simplex/impl/Main.html b/docs/io/github/simplex/impl/Main.html index 41dca41..5188728 100644 --- a/docs/io/github/simplex/impl/Main.html +++ b/docs/io/github/simplex/impl/Main.html @@ -1,11 +1,11 @@ - + Main - + @@ -101,9 +101,12 @@ loadScripts(document, 'script');
    private reactor.core.publisher.Flux<reactor.core.Disposable>
     
    - - + +
     
    + + +
     
    @@ -167,6 +170,12 @@ loadScripts(document, 'script');

    Field Details

    • +
      +

      pool

      +
      public ServicePool pool
      +
      +
    • +
    • scheduler

      private SchedulingSystem<Main> scheduler
      diff --git a/docs/io/github/simplex/impl/ServiceImpl.html b/docs/io/github/simplex/impl/ServiceImpl.html index 33373ce..e6e0077 100644 --- a/docs/io/github/simplex/impl/ServiceImpl.html +++ b/docs/io/github/simplex/impl/ServiceImpl.html @@ -1,11 +1,11 @@ - + ServiceImpl - + @@ -235,6 +235,10 @@ loadScripts(document, 'script');

      getParentPool

      public reactor.core.publisher.Mono<ServicePool> getParentPool()
      +
      Specified by:
      +
      getParentPool in interface IService
      +
      Overrides:
      +
      getParentPool in class ExecutableService
      Returns:
      The ServicePool which this service is executing on.
      diff --git a/docs/io/github/simplex/impl/package-summary.html b/docs/io/github/simplex/impl/package-summary.html index ca4681a..fcded61 100644 --- a/docs/io/github/simplex/impl/package-summary.html +++ b/docs/io/github/simplex/impl/package-summary.html @@ -1,11 +1,11 @@ - + io.github.simplex.impl - + diff --git a/docs/io/github/simplex/impl/package-tree.html b/docs/io/github/simplex/impl/package-tree.html index 382d56c..1d2a59a 100644 --- a/docs/io/github/simplex/impl/package-tree.html +++ b/docs/io/github/simplex/impl/package-tree.html @@ -1,11 +1,11 @@ - + io.github.simplex.impl Class Hierarchy - + diff --git a/docs/io/github/simplex/simplexss/SchedulingSystem.html b/docs/io/github/simplex/simplexss/SchedulingSystem.html index e4e3059..0930b34 100644 --- a/docs/io/github/simplex/simplexss/SchedulingSystem.html +++ b/docs/io/github/simplex/simplexss/SchedulingSystem.html @@ -1,11 +1,11 @@ - + SchedulingSystem - + @@ -120,7 +120,9 @@ implements Description
    SchedulingSystem(@NotNull ServiceManager serviceManager, T plugin)
    -
     
    +
    +
    Creates a new instance of the scheduling system.
    +
    @@ -214,6 +216,12 @@ implements public SchedulingSystem(@NotNull @NotNull ServiceManager serviceManager, T plugin) +
    Creates a new instance of the scheduling system. This is used to manage the scheduling of services.
    +
    +
    Parameters:
    +
    serviceManager - The service manager to use for this scheduling system.
    +
    plugin - The plugin to use for this scheduling system. This should be an instance of your plugin.
    +
    diff --git a/docs/io/github/simplex/simplexss/ServiceManager.html b/docs/io/github/simplex/simplexss/ServiceManager.html index 731b754..b29ba96 100644 --- a/docs/io/github/simplex/simplexss/ServiceManager.html +++ b/docs/io/github/simplex/simplexss/ServiceManager.html @@ -1,11 +1,11 @@ - + ServiceManager - + @@ -105,7 +105,9 @@ loadScripts(document, 'script');
    Constructor
    Description
    -
     
    +
    +
    Creates a new instance of the Service Manager class.
    +
    @@ -184,6 +186,11 @@ loadScripts(document, 'script');

    ServiceManager

    public ServiceManager()
    +
    Creates a new instance of the Service Manager class. + This class acts as a Service Pool factory, and can be used to create + both single and multithreaded Service Pools, empty service pools, as well as + retrieve existing Service Pools. It also provides methods for you to add and remove + IServices from the {ServicePool} parameter.
    diff --git a/docs/io/github/simplex/simplexss/ServicePool.html b/docs/io/github/simplex/simplexss/ServicePool.html index 9777761..60c3287 100644 --- a/docs/io/github/simplex/simplexss/ServicePool.html +++ b/docs/io/github/simplex/simplexss/ServicePool.html @@ -1,11 +1,11 @@ - + ServicePool - + @@ -92,16 +92,24 @@ loadScripts(document, 'script');
    Description
    private final Set<IService>
    -
     
    +
    +
    A collection of services related to this service pool.
    +
    private static final org.bukkit.NamespacedKey
    -
     
    +
    +
    The default NamespacedKey used to identify unmarked services.
    +
    private final org.bukkit.NamespacedKey
    -
     
    +
    +
    The key used to identify this service pool.
    +
    private final reactor.core.scheduler.Scheduler
    -
     
    +
    +
    The scheduler used to run the services in this pool.
    +
    @@ -142,29 +150,30 @@ loadScripts(document, 'script');
    reactor.core.scheduler.Scheduler
     
    -
    reactor.core.publisher.Mono<IService>
    +
    @NotNull reactor.core.publisher.Mono<IService>
    getService(org.bukkit.NamespacedKey service_name)
     
    (package private) boolean
     
    -
    reactor.core.publisher.Mono<ServicePool>
    - +
    @NotNull reactor.core.publisher.Mono<reactor.core.Disposable>
    +
    queueService(org.bukkit.NamespacedKey service_name)
     
    -
    (package private) void
    - +
    @NotNull reactor.core.publisher.Mono<ServicePool>
    +
     
    -
    reactor.core.publisher.Mono<reactor.core.Disposable>
    -
    startService(org.bukkit.NamespacedKey service_name)
    +
    (package private) void
    +
     
    -
    reactor.core.publisher.Flux<reactor.core.Disposable>
    +
    @NotNull reactor.core.publisher.Flux<reactor.core.Disposable>
     
    -
    reactor.core.publisher.Mono<Void>
    -
    stopService(org.bukkit.NamespacedKey service_name)
    +
    @NotNull reactor.core.publisher.Mono<Void>
    +
    stopService(@NotNull org.bukkit.NamespacedKey service_name, + @Nullable reactor.core.publisher.Mono<reactor.core.Disposable> disposable)
     
    -
    reactor.core.publisher.Mono<Void>
    -
    stopServices(reactor.core.publisher.Flux<reactor.core.Disposable> disposableThread)
    +
    @NotNull reactor.core.publisher.Mono<Void>
    +
    stopServices(@NotNull reactor.core.publisher.Flux<reactor.core.Disposable> disposableThread)
     
    @@ -187,24 +196,28 @@ loadScripts(document, 'script');

    associatedServices

    private final Set<IService> associatedServices
    +
    A collection of services related to this service pool.
  • scheduler

    private final reactor.core.scheduler.Scheduler scheduler
    +
    The scheduler used to run the services in this pool.
  • name

    private final org.bukkit.NamespacedKey name
    +
    The key used to identify this service pool.
  • DEFAULT

    private static final org.bukkit.NamespacedKey DEFAULT
    +
    The default NamespacedKey used to identify unmarked services. This will cause errors if left unchecked.
  • @@ -220,6 +233,11 @@ loadScripts(document, 'script');

    ServicePool

    public ServicePool(org.bukkit.NamespacedKey name, boolean multithreaded)
    +
    +
    Parameters:
    +
    name - The name of this service pool.
    +
    multithreaded - Whether this service pool should be multithreaded, or operate upon a single thread.
    +
    @@ -234,73 +252,148 @@ loadScripts(document, 'script');

    getDefaultNamespacedKey

    static org.bukkit.NamespacedKey getDefaultNamespacedKey()
    +
    +
    Returns:
    +
    The default namespaced key to use if one is not assigned.
    +
  • addService

    void addService(IService service)
    +
    +
    Parameters:
    +
    service - Add a service to the pool's service collection.
    +
  • isValidService

    boolean isValidService(IService service)
    +
    +
    Parameters:
    +
    service - The service to check against this pool.
    +
    Returns:
    +
    Whether the service is registered with this pool.
    +
  • getAssociatedServices

    -
    @NotNull +
    @Contract(pure=true) +@NotNull public @NotNull Set<IService> getAssociatedServices()
    +
    +
    Returns:
    +
    A Set of IService objects which are registered with this pool.
    +
  • -
    -

    startService

    -
    public reactor.core.publisher.Mono<reactor.core.Disposable> startService(org.bukkit.NamespacedKey service_name)
    +
    +

    queueService

    +
    @NotNull +public @NotNull reactor.core.publisher.Mono<reactor.core.Disposable> queueService(org.bukkit.NamespacedKey service_name)
    +
    +
    Parameters:
    +
    service_name - The name of the service to queue. This should be a service that is located within this service pool. + If you name a service that is stored within another service pool, + this method will throw an error.
    +
    Returns:
    +
    A Mono object which contains a Disposable element which can be used to destroy the registered service.
    +
  • startServices

    -
    public reactor.core.publisher.Flux<reactor.core.Disposable> startServices()
    +
    @NotNull +public @NotNull reactor.core.publisher.Flux<reactor.core.Disposable> startServices()
    +
    +
    Returns:
    +
    A Flux object which contains a collection of Disposable elements, + which can be used to destroy the registered services using stopServices(Flux<Disposable>).
    +
  • stopServices

    -
    public reactor.core.publisher.Mono<Void> stopServices(reactor.core.publisher.Flux<reactor.core.Disposable> disposableThread)
    +
    @NotNull +public @NotNull reactor.core.publisher.Mono<Void> stopServices(@NotNull + @NotNull reactor.core.publisher.Flux<reactor.core.Disposable> disposableThread)
    +
    +
    Parameters:
    +
    disposableThread - A reactor.core.publisher.Flux<reactor.core.Disposable> which contains all the services that should be disposed..
    +
    Returns:
    +
    A reactor.core.publisher.Mono<Void> object which can be used to stop the services.
    +
  • -
    +

    stopService

    -
    public reactor.core.publisher.Mono<Void> stopService(org.bukkit.NamespacedKey service_name)
    +
    @NotNull +public @NotNull reactor.core.publisher.Mono<Void> stopService(@NotNull + @NotNull org.bukkit.NamespacedKey service_name, + @Nullable + @Nullable reactor.core.publisher.Mono<reactor.core.Disposable> disposable)
    +
    +
    Parameters:
    +
    service_name - The name of the service to stop.
    +
    disposable - A Disposable object which contains the service that should be disposed.
    +
    Returns:
    +
    A reactor.core.publisher.Mono<Void> object which can be used to stop the service.
    +
  • getService

    -
    public reactor.core.publisher.Mono<IService> getService(org.bukkit.NamespacedKey service_name)
    +
    @NotNull +public @NotNull reactor.core.publisher.Mono<IService> getService(org.bukkit.NamespacedKey service_name)
    +
    +
    Parameters:
    +
    service_name - The name of the service to get.
    +
    Returns:
    +
    A Mono object which contains the service.
    +
  • removeService

    void removeService(IService service)
    +
    +
    Parameters:
    +
    service - The service to remove from the pool's service collection.
    +
  • recycle

    -
    public reactor.core.publisher.Mono<ServicePool> recycle()
    +
    @NotNull +public @NotNull reactor.core.publisher.Mono<ServicePool> recycle()
    +
    +
    Returns:
    +
    This service pool after being cleared of all services. + You will need to register services with this pool again before using it.
    +
  • getScheduler

    -
    public reactor.core.scheduler.Scheduler getScheduler()
    +
    @Contract(pure=true) +public reactor.core.scheduler.Scheduler getScheduler()
    +
    +
    Returns:
    +
    The Scheduler which hosts the threads for the service pool.
    +
  • diff --git a/docs/io/github/simplex/simplexss/package-summary.html b/docs/io/github/simplex/simplexss/package-summary.html index b9a1422..b267119 100644 --- a/docs/io/github/simplex/simplexss/package-summary.html +++ b/docs/io/github/simplex/simplexss/package-summary.html @@ -1,11 +1,11 @@ - + io.github.simplex.simplexss - + diff --git a/docs/io/github/simplex/simplexss/package-tree.html b/docs/io/github/simplex/simplexss/package-tree.html index df057ac..1002240 100644 --- a/docs/io/github/simplex/simplexss/package-tree.html +++ b/docs/io/github/simplex/simplexss/package-tree.html @@ -1,11 +1,11 @@ - + io.github.simplex.simplexss Class Hierarchy - + diff --git a/docs/member-search-index.js b/docs/member-search-index.js index 99de2fd..1242ee8 100644 --- a/docs/member-search-index.js +++ b/docs/member-search-index.js @@ -1 +1 @@ -memberSearchIndex = [{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"addService(IService)","u":"addService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"addToExistingPool(ServicePool, IService...)","u":"addToExistingPool(io.github.simplex.simplexss.ServicePool,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"associatedServices"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"cancel()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"cancelled"},{"p":"io.github.simplex.api","c":"Context","l":"contextCollection()"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"createServicePool(NamespacedKey, IService...)","u":"createServicePool(org.bukkit.NamespacedKey,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"DEFAULT"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"delay"},{"p":"io.github.simplex.impl","c":"Main","l":"disposables"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"emptyServicePool(NamespacedKey, boolean)","u":"emptyServicePool(org.bukkit.NamespacedKey,boolean)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(NamespacedKey, Long, Long, Boolean, Boolean)","u":"%3Cinit%3E(org.bukkit.NamespacedKey,java.lang.Long,java.lang.Long,java.lang.Boolean,java.lang.Boolean)"},{"p":"io.github.simplex.api","c":"Context","l":"fluxFromCollection()"},{"p":"io.github.simplex.api","c":"ISchedule","l":"forceStart(IService)","u":"forceStart(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"forceStart(IService)","u":"forceStart(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"forceStop(IService)","u":"forceStop(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"forceStop(IService)","u":"forceStop(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"getAssociatedServicePool(IService)","u":"getAssociatedServicePool(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getAssociatedServices()"},{"p":"io.github.simplex.api","c":"Context","l":"getContext()"},{"p":"io.github.simplex.api","c":"IService","l":"getDefaultNamespacedKey()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getDefaultNamespacedKey()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getDelay()"},{"p":"io.github.simplex.api","c":"IService","l":"getDelay()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getMainSchedulerThread()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getNamespacedKey()"},{"p":"io.github.simplex.api","c":"IService","l":"getNamespacedKey()"},{"p":"io.github.simplex.api","c":"IService","l":"getParentPool()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"getParentPool()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getPeriod()"},{"p":"io.github.simplex.api","c":"IService","l":"getPeriod()"},{"p":"io.github.simplex.api","c":"IService","l":"getPlugin()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"getPlugin()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getProvidingPlugin()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getRepeatingPools()"},{"p":"io.github.simplex.impl","c":"Main","l":"getScheduler()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getScheduler()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getService(NamespacedKey)","u":"getService(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"getServiceManager()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getServiceManager()"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"getServicePools()"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"InvalidServiceException(IService)","u":"%3Cinit%3E(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"InvalidServiceException(Throwable)","u":"%3Cinit%3E(java.lang.Throwable)"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"InvalidServicePoolException()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"InvalidServicePoolException(Throwable)","u":"%3Cinit%3E(java.lang.Throwable)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"isCancelled()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"isPeriodic()"},{"p":"io.github.simplex.api","c":"IService","l":"isPeriodic()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"isValidService(IService)","u":"isValidService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"locateServiceWithinPools(IService)","u":"locateServiceWithinPools(io.github.simplex.api.IService)"},{"p":"io.github.simplex.impl","c":"Main","l":"Main()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"mainScheduler"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"mayInterruptWhenRunning"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"multithreadedServicePool(NamespacedKey, IService...)","u":"multithreadedServicePool(org.bukkit.NamespacedKey,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"name"},{"p":"io.github.simplex.impl","c":"Main","l":"onDisable()"},{"p":"io.github.simplex.impl","c":"Main","l":"onEnable()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"period"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"plugin"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"plugin"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"queue(IService)","u":"queue(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"queue(IService)","u":"queue(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"recycle()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"removeService(IService)","u":"removeService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"repeating"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"repeatingPools"},{"p":"io.github.simplex.api","c":"IService","l":"run()"},{"p":"io.github.simplex.api","c":"ISchedule","l":"runOnce(IService)","u":"runOnce(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"runOnce(IService)","u":"runOnce(io.github.simplex.api.IService)"},{"p":"io.github.simplex.impl","c":"Main","l":"scheduler"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"scheduler"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"SchedulingSystem(ServiceManager, T)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServiceManager,T)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"service_name"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"ServiceImpl(Main)","u":"%3Cinit%3E(io.github.simplex.impl.Main)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"serviceManager"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"ServiceManager()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"ServicePool(NamespacedKey, boolean)","u":"%3Cinit%3E(org.bukkit.NamespacedKey,boolean)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"servicePools"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"setCancelled(boolean)"},{"p":"io.github.simplex.api","c":"Context","l":"setContext(S)"},{"p":"io.github.simplex.api","c":"IService","l":"start()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"start()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"startService(NamespacedKey)","u":"startService(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"startServices()"},{"p":"io.github.simplex.api","c":"IService","l":"stop()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"stop()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"stopService(NamespacedKey)","u":"stopService(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"stopServices(Flux)","u":"stopServices(reactor.core.publisher.Flux)"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"supplyException()"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"supplyException(IService)","u":"supplyException(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"takeFromExistingPool(ServicePool, IService...)","u":"takeFromExistingPool(io.github.simplex.simplexss.ServicePool,io.github.simplex.api.IService...)"}];updateSearchResults(); \ No newline at end of file +memberSearchIndex = [{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"addService(IService)","u":"addService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"addToExistingPool(ServicePool, IService...)","u":"addToExistingPool(io.github.simplex.simplexss.ServicePool,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"associatedServices"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"cancel()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"cancelled"},{"p":"io.github.simplex.api","c":"Context","l":"contextCollection()"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"createServicePool(NamespacedKey, IService...)","u":"createServicePool(org.bukkit.NamespacedKey,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"DEFAULT"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"delay"},{"p":"io.github.simplex.impl","c":"Main","l":"disposables"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"emptyServicePool(NamespacedKey, boolean)","u":"emptyServicePool(org.bukkit.NamespacedKey,boolean)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(NamespacedKey)","u":"%3Cinit%3E(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(ServicePool, NamespacedKey)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServicePool,org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(ServicePool, NamespacedKey, Long)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServicePool,org.bukkit.NamespacedKey,java.lang.Long)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(ServicePool, NamespacedKey, Long, Long, Boolean)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServicePool,org.bukkit.NamespacedKey,java.lang.Long,java.lang.Long,java.lang.Boolean)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"ExecutableService(ServicePool, NamespacedKey, Long, Long, Boolean, Boolean)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServicePool,org.bukkit.NamespacedKey,java.lang.Long,java.lang.Long,java.lang.Boolean,java.lang.Boolean)"},{"p":"io.github.simplex.api","c":"Context","l":"fluxFromCollection()"},{"p":"io.github.simplex.api","c":"ISchedule","l":"forceStart(IService)","u":"forceStart(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"forceStart(IService)","u":"forceStart(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"forceStop(IService)","u":"forceStop(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"forceStop(IService)","u":"forceStop(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"getAssociatedServicePool(IService)","u":"getAssociatedServicePool(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getAssociatedServices()"},{"p":"io.github.simplex.api","c":"Context","l":"getContext()"},{"p":"io.github.simplex.api","c":"IService","l":"getDefaultNamespacedKey()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getDefaultNamespacedKey()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getDelay()"},{"p":"io.github.simplex.api","c":"IService","l":"getDelay()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getMainSchedulerThread()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getNamespacedKey()"},{"p":"io.github.simplex.api","c":"IService","l":"getNamespacedKey()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getParentPool()"},{"p":"io.github.simplex.api","c":"IService","l":"getParentPool()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"getParentPool()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"getPeriod()"},{"p":"io.github.simplex.api","c":"IService","l":"getPeriod()"},{"p":"io.github.simplex.api","c":"IService","l":"getPlugin()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"getPlugin()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getProvidingPlugin()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getRepeatingPools()"},{"p":"io.github.simplex.impl","c":"Main","l":"getScheduler()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getScheduler()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"getService(NamespacedKey)","u":"getService(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"getServiceManager()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"getServiceManager()"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"getServicePools()"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"InvalidServiceException(IService)","u":"%3Cinit%3E(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"InvalidServiceException(Throwable)","u":"%3Cinit%3E(java.lang.Throwable)"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"InvalidServicePoolException()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"InvalidServicePoolException(Throwable)","u":"%3Cinit%3E(java.lang.Throwable)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"isCancelled()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"isPeriodic()"},{"p":"io.github.simplex.api","c":"IService","l":"isPeriodic()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"isValidService(IService)","u":"isValidService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"locateServiceWithinPools(IService)","u":"locateServiceWithinPools(io.github.simplex.api.IService)"},{"p":"io.github.simplex.impl","c":"Main","l":"Main()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"mainScheduler"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"mayInterruptWhenRunning"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"multithreadedServicePool(NamespacedKey, IService...)","u":"multithreadedServicePool(org.bukkit.NamespacedKey,io.github.simplex.api.IService...)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"name"},{"p":"io.github.simplex.api","c":"IService","l":"newNamespacedKey(String, String)","u":"newNamespacedKey(java.lang.String,java.lang.String)"},{"p":"io.github.simplex.impl","c":"Main","l":"onDisable()"},{"p":"io.github.simplex.impl","c":"Main","l":"onEnable()"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"parentPool"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"period"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"plugin"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"plugin"},{"p":"io.github.simplex.impl","c":"Main","l":"pool"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"queue(IService)","u":"queue(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ISchedule","l":"queue(IService)","u":"queue(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"queueService(NamespacedKey)","u":"queueService(org.bukkit.NamespacedKey)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"recycle()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"removeService(IService)","u":"removeService(io.github.simplex.api.IService)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"repeating"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"repeatingPools"},{"p":"io.github.simplex.api","c":"IService","l":"run()"},{"p":"io.github.simplex.api","c":"ISchedule","l":"runOnce(IService)","u":"runOnce(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"runOnce(IService)","u":"runOnce(io.github.simplex.api.IService)"},{"p":"io.github.simplex.impl","c":"Main","l":"scheduler"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"scheduler"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"SchedulingSystem(ServiceManager, T)","u":"%3Cinit%3E(io.github.simplex.simplexss.ServiceManager,T)"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"service_name"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"ServiceImpl(Main)","u":"%3Cinit%3E(io.github.simplex.impl.Main)"},{"p":"io.github.simplex.simplexss","c":"SchedulingSystem","l":"serviceManager"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"ServiceManager()","u":"%3Cinit%3E()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"ServicePool(NamespacedKey, boolean)","u":"%3Cinit%3E(org.bukkit.NamespacedKey,boolean)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"servicePools"},{"p":"io.github.simplex.api","c":"ExecutableService","l":"setCancelled(boolean)"},{"p":"io.github.simplex.api","c":"Context","l":"setContext(S)"},{"p":"io.github.simplex.api","c":"IService","l":"start()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"start()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"startServices()"},{"p":"io.github.simplex.api","c":"IService","l":"stop()"},{"p":"io.github.simplex.impl","c":"ServiceImpl","l":"stop()"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"stopService(NamespacedKey, Mono)","u":"stopService(org.bukkit.NamespacedKey,reactor.core.publisher.Mono)"},{"p":"io.github.simplex.simplexss","c":"ServicePool","l":"stopServices(Flux)","u":"stopServices(reactor.core.publisher.Flux)"},{"p":"io.github.simplex.api","c":"InvalidServicePoolException","l":"supplyException()"},{"p":"io.github.simplex.api","c":"InvalidServiceException","l":"supplyException(IService)","u":"supplyException(io.github.simplex.api.IService)"},{"p":"io.github.simplex.simplexss","c":"ServiceManager","l":"takeFromExistingPool(ServicePool, IService...)","u":"takeFromExistingPool(io.github.simplex.simplexss.ServicePool,io.github.simplex.api.IService...)"}];updateSearchResults(); \ No newline at end of file diff --git a/docs/overview-summary.html b/docs/overview-summary.html index 382fda0..244c0ea 100644 --- a/docs/overview-summary.html +++ b/docs/overview-summary.html @@ -1,11 +1,11 @@ - + Generated Documentation (Untitled) - + diff --git a/docs/overview-tree.html b/docs/overview-tree.html index 83a3b4d..4c1e915 100644 --- a/docs/overview-tree.html +++ b/docs/overview-tree.html @@ -1,11 +1,11 @@ - + Class Hierarchy - + diff --git a/docs/serialized-form.html b/docs/serialized-form.html index 2de287a..2ac593d 100644 --- a/docs/serialized-form.html +++ b/docs/serialized-form.html @@ -1,11 +1,11 @@ - + Serialized Form - + diff --git a/src/main/java/io/github/simplex/api/ExecutableService.java b/src/main/java/io/github/simplex/api/ExecutableService.java index b3b3c8c..8b30ea2 100644 --- a/src/main/java/io/github/simplex/api/ExecutableService.java +++ b/src/main/java/io/github/simplex/api/ExecutableService.java @@ -17,6 +17,48 @@ public abstract class ExecutableService implements IService { private final boolean mayInterruptWhenRunning; private boolean cancelled = false; + private ServicePool parentPool; + + /** + * Creates a new instance of an executable service. + * Each service is registered with a {@link NamespacedKey}, + * to allow for easy identification within the associated {@link ServicePool}. + * + * @param service_name A namespaced key which can be used to identify the service. + */ + public ExecutableService(@NotNull NamespacedKey service_name) { + this((new ServicePool(IService.newNamespacedKey("", ""), false)), service_name, 0L, 0L, false, false); + } + + /** + * Creates a new instance of an executable service. + * Each service is registered with a {@link NamespacedKey}, + * to allow for easy identification within the associated {@link ServicePool}. + * + * @param parentPool The {@link ServicePool} which this service is executing on. + * @param service_name A namespaced key which can be used to identify the service. + */ + public ExecutableService(@Nullable ServicePool parentPool, @NotNull NamespacedKey service_name) { + this(parentPool, service_name, 0L, 0L, false, false); + } + + /** + * Creates a new instance of an executable service. + * The timings are measured in ticks (20 ticks per second). + * You do not need to explicitly define a delay. + * Each service is registered with a {@link NamespacedKey}, + * to allow for easy identification within the associated {@link ServicePool}. + * + * @param parentPool The {@link ServicePool} which this service is executing on. + * @param service_name A namespaced key which can be used to identify the service. + * @param delay A specified amount of time (in ticks) to wait before the service runs. + */ + public ExecutableService( + @Nullable ServicePool parentPool, + @NotNull NamespacedKey service_name, + @Nullable Long delay) { + this(parentPool, service_name, delay, 0L, false, false); + } /** * Creates a new instance of an executable service. @@ -27,6 +69,31 @@ public abstract class ExecutableService implements IService { * Each service is registered with a {@link NamespacedKey}, * to allow for easy identification within the associated {@link ServicePool}. * + * @param parentPool The {@link ServicePool} which this service is executing on. + * @param service_name A namespaced key which can be used to identify the service. + * @param delay A specified amount of time (in ticks) to wait before the service runs. + * @param period How long the service should wait between service executions (in ticks). + * @param repeating If the service should be scheduled for repeated executions or not. + */ + public ExecutableService( + @Nullable ServicePool parentPool, + @NotNull NamespacedKey service_name, + @NotNull Long delay, + @NotNull Long period, + @NotNull Boolean repeating) { + this(parentPool, service_name, delay, period, repeating, false); + } + + /** + * Creates a new instance of an executable service. + * The timings are measured in ticks (20 ticks per second). + * You do not need to explicitly define a delay or a period, + * however if you have flagged {@link #repeating} as true, and the period is null, + * then the period will automatically be set to 20 minutes. + * Each service is registered with a {@link NamespacedKey}, + * to allow for easy identification within the associated {@link ServicePool}. + * + * @param parentPool The {@link ServicePool} which this service is executing on. * @param service_name A namespaced key which can be used to identify the service. * @param delay A specified amount of time (in ticks) to wait before the service runs. * @param period How long the service should wait between service executions (in ticks). @@ -34,6 +101,7 @@ public abstract class ExecutableService implements IService { * @param mayInterruptWhenRunning If the service can be cancelled during execution. */ public ExecutableService( + @Nullable ServicePool parentPool, @NotNull NamespacedKey service_name, @Nullable Long delay, @Nullable Long period, @@ -44,6 +112,7 @@ public abstract class ExecutableService implements IService { this.delay = Objects.requireNonNullElse(delay, 0L); this.period = Objects.requireNonNullElse(period, (20L * 60L) * 20L); this.mayInterruptWhenRunning = mayInterruptWhenRunning; + this.parentPool = parentPool; } @Override @@ -99,4 +168,9 @@ public abstract class ExecutableService implements IService { } return Mono.empty(); } + + @Override + public Mono getParentPool() { + return Mono.just(parentPool); + } } diff --git a/src/main/java/io/github/simplex/api/IService.java b/src/main/java/io/github/simplex/api/IService.java index aad787b..97af0a1 100644 --- a/src/main/java/io/github/simplex/api/IService.java +++ b/src/main/java/io/github/simplex/api/IService.java @@ -68,4 +68,16 @@ public interface IService extends Runnable { .orElseThrow(InvalidServicePoolException.supplyException())) .subscribe(); } + + /** + * This is an easy static call for creating a new namespaced key for services and service pools. + * + * @param space The namespace of the service. + * @param key The key name of the service. + * @return A NamespacedKey object representing the service. + */ + @Contract("_, _ -> new") + static @NotNull NamespacedKey newNamespacedKey(String space, String key) { + return new NamespacedKey(space, key); + } } diff --git a/src/main/java/io/github/simplex/api/InvalidServiceException.java b/src/main/java/io/github/simplex/api/InvalidServiceException.java index 363c126..157dcc8 100644 --- a/src/main/java/io/github/simplex/api/InvalidServiceException.java +++ b/src/main/java/io/github/simplex/api/InvalidServiceException.java @@ -4,7 +4,7 @@ import java.util.function.Supplier; public class InvalidServiceException extends RuntimeException { public InvalidServiceException(IService service) { - super("The service " + service.getNamespacedKey().getKey() + " has encountered an exception."); + super("The service " + service.getNamespacedKey().getKey() + " is not present within any service pool."); } public InvalidServiceException(Throwable th) { diff --git a/src/main/java/io/github/simplex/impl/Main.java b/src/main/java/io/github/simplex/impl/Main.java index 402e391..dc8a4c4 100644 --- a/src/main/java/io/github/simplex/impl/Main.java +++ b/src/main/java/io/github/simplex/impl/Main.java @@ -1,7 +1,9 @@ package io.github.simplex.impl; +import io.github.simplex.api.IService; import io.github.simplex.simplexss.SchedulingSystem; import io.github.simplex.simplexss.ServiceManager; +import io.github.simplex.simplexss.ServicePool; import org.bukkit.plugin.java.JavaPlugin; import reactor.core.Disposable; import reactor.core.publisher.Flux; @@ -9,6 +11,7 @@ import reactor.core.publisher.Flux; import java.util.Objects; public class Main extends JavaPlugin { + public ServicePool pool = new ServicePool(IService.newNamespacedKey("pool", "one"), true); private SchedulingSystem
    scheduler; private Flux disposables; @@ -16,10 +19,8 @@ public class Main extends JavaPlugin { public void onEnable() { ServiceManager serviceManager = new ServiceManager(); this.scheduler = new SchedulingSystem<>(serviceManager, this); - scheduler.getServiceManager().subscribe(manager -> manager.getServicePools() - .doOnEach(signal -> disposables = Objects.requireNonNull(signal.get()).startServices()) - .subscribeOn(scheduler.getMainSchedulerThread(), false) - .subscribe()); + IService service = new ServiceImpl(this); + service.getParentPool().subscribe(element -> disposables = element.startServices()); } @Override diff --git a/src/main/java/io/github/simplex/impl/ServiceImpl.java b/src/main/java/io/github/simplex/impl/ServiceImpl.java index 0f60181..a4a597f 100644 --- a/src/main/java/io/github/simplex/impl/ServiceImpl.java +++ b/src/main/java/io/github/simplex/impl/ServiceImpl.java @@ -10,7 +10,7 @@ public class ServiceImpl extends ExecutableService { private final Main plugin; public ServiceImpl(Main plugin) { - super(IService.getDefaultNamespacedKey(), 20L, 20L * 60L * 10L, true, true); + super(plugin.pool, IService.getDefaultNamespacedKey(), 0L, 20 * 60 * 20L, true, false); this.plugin = plugin; } diff --git a/src/main/java/io/github/simplex/simplexss/SchedulingSystem.java b/src/main/java/io/github/simplex/simplexss/SchedulingSystem.java index a9daeef..6ce84d6 100644 --- a/src/main/java/io/github/simplex/simplexss/SchedulingSystem.java +++ b/src/main/java/io/github/simplex/simplexss/SchedulingSystem.java @@ -19,6 +19,12 @@ public final class SchedulingSystem implements ISchedule { private final Set repeatingPools; private final Scheduler mainScheduler; + /** + * Creates a new instance of the scheduling system. This is used to manage the scheduling of services. + * + * @param serviceManager The service manager to use for this scheduling system. + * @param plugin The plugin to use for this scheduling system. This should be an instance of your plugin. + */ public SchedulingSystem(@NotNull ServiceManager serviceManager, T plugin) { this.serviceManager = serviceManager; this.plugin = plugin; @@ -53,8 +59,7 @@ public final class SchedulingSystem implements ISchedule { @Override public @NotNull Mono runOnce(IService service) { return Mono.just(service).doOnNext(s -> { - s.start().subscribe(); - s.stop().subscribe(); + s.start().then(s.stop()).subscribe(); }).then(); } diff --git a/src/main/java/io/github/simplex/simplexss/ServiceManager.java b/src/main/java/io/github/simplex/simplexss/ServiceManager.java index 89e466d..bff0c5b 100644 --- a/src/main/java/io/github/simplex/simplexss/ServiceManager.java +++ b/src/main/java/io/github/simplex/simplexss/ServiceManager.java @@ -14,6 +14,13 @@ import java.util.Set; public final class ServiceManager { private final Set servicePools; + /** + * Creates a new instance of the Service Manager class. + * This class acts as a Service Pool factory, and can be used to create + * both single and multithreaded Service Pools, empty service pools, as well as + * retrieve existing Service Pools. It also provides methods for you to add and remove + * {@link IService}s from the {ServicePool} parameter. + */ public ServiceManager() { servicePools = new HashSet<>(); } diff --git a/src/main/java/io/github/simplex/simplexss/ServicePool.java b/src/main/java/io/github/simplex/simplexss/ServicePool.java index 916aad2..d9e2332 100644 --- a/src/main/java/io/github/simplex/simplexss/ServicePool.java +++ b/src/main/java/io/github/simplex/simplexss/ServicePool.java @@ -1,9 +1,10 @@ package io.github.simplex.simplexss; import io.github.simplex.api.IService; -import io.github.simplex.api.InvalidServiceException; import org.bukkit.NamespacedKey; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import reactor.core.Disposable; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -12,16 +13,31 @@ import reactor.core.scheduler.Schedulers; import java.util.HashSet; import java.util.Set; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; public final class ServicePool { + /** + * A collection of services related to this service pool. + */ private final Set associatedServices; + /** + * The scheduler used to run the services in this pool. + */ private final Scheduler scheduler; + /** + * The key used to identify this service pool. + */ private final NamespacedKey name; + /** + * The default {@link NamespacedKey} used to identify unmarked services. This will cause errors if left unchecked. + */ private static final NamespacedKey DEFAULT = new NamespacedKey("simplex_ss", "default_service_pool"); + /** + * @param name The name of this service pool. + * @param multithreaded Whether this service pool should be multithreaded, or operate upon a single thread. + */ public ServicePool(NamespacedKey name, boolean multithreaded) { this.name = name; this.associatedServices = new HashSet<>(); @@ -32,24 +48,44 @@ public final class ServicePool { } } + /** + * @return The default namespaced key to use if one is not assigned. + */ static NamespacedKey getDefaultNamespacedKey() { return DEFAULT; } + /** + * @param service Add a service to the pool's service collection. + */ void addService(IService service) { getAssociatedServices().add(service); } + /** + * @param service The service to check against this pool. + * @return Whether the service is registered with this pool. + */ boolean isValidService(IService service) { return getAssociatedServices().contains(service); } + /** + * @return A {@link Set} of {@link IService} objects which are registered with this pool. + */ + @Contract(pure = true) @NotNull public Set getAssociatedServices() { return associatedServices; } - public Mono startService(NamespacedKey service_name) { + /** + * @param service_name The name of the service to queue. This should be a service that is located within this service pool. + * If you name a service that is stored within another service pool, + * this method will throw an error. + * @return A {@link Mono} object which contains a {@link Disposable} element which can be used to destroy the registered service. + */ + public @NotNull Mono queueService(NamespacedKey service_name) { Mono service = getService(service_name); return service.map(s -> { if (s.isPeriodic()) { @@ -65,7 +101,11 @@ public final class ServicePool { }); } - public Flux startServices() { + /** + * @return A {@link Flux} object which contains a collection of {@link Disposable} elements, + * which can be used to destroy the registered services using {@link ServicePool#stopServices(Flux)}. + */ + public @NotNull Flux startServices() { return Mono.just(getAssociatedServices()).flatMapMany(services -> { Set disposables = new HashSet<>(); for (IService service : services) { @@ -84,30 +124,58 @@ public final class ServicePool { }); } - public Mono stopServices(Flux disposableThread) { + /** + * @param disposableThread A {@link Flux} which contains all the services that should be disposed.. + * @return A {@link Mono} object which can be used to stop the services. + */ + public @NotNull Mono stopServices(@NotNull Flux disposableThread) { getAssociatedServices().forEach(service -> service.stop().subscribe()); return disposableThread.doOnNext(Disposable::dispose).then(); } - public Mono stopService(NamespacedKey service_name) { - return getService(service_name).doOnNext(IService::stop).then(); + /** + * @param service_name The name of the service to stop. + * @param disposable A {@link Disposable} object which contains the service that should be disposed. + * @return A {@link Mono} object which can be used to stop the service. + */ + public @NotNull Mono stopService(@NotNull NamespacedKey service_name, @Nullable Mono disposable) { + getService(service_name).doOnNext(IService::stop).subscribe(); + if (disposable != null) { + disposable.doOnNext(Disposable::dispose).subscribe(); + } + return Mono.empty(); } - public Mono getService(NamespacedKey service_name) { + /** + * @param service_name The name of the service to get. + * @return A {@link Mono} object which contains the service. + */ + public @NotNull Mono getService(NamespacedKey service_name) { return Flux.fromIterable(getAssociatedServices()) .filter(service -> service.getNamespacedKey().equals(service_name)) .next(); } + /** + * @param service The service to remove from the pool's service collection. + */ void removeService(IService service) { getAssociatedServices().remove(service); } - public Mono recycle() { + /** + * @return This service pool after being cleared of all services. + * You will need to register services with this pool again before using it. + */ + public @NotNull Mono recycle() { this.getAssociatedServices().clear(); return Mono.just(this); } + /** + * @return The {@link Scheduler} which hosts the threads for the service pool. + */ + @Contract(pure = true) public Scheduler getScheduler() { return scheduler; }