Class WhiteboardUtils


  • public class WhiteboardUtils
    extends Object
    • Field Detail

      • JMX_OAK_DOMAIN

        public static final String JMX_OAK_DOMAIN
        JMX Domain name under which Oak related JMX MBeans are registered
        See Also:
        Constant Field Values
    • Constructor Detail

      • WhiteboardUtils

        public WhiteboardUtils()
    • Method Detail

      • scheduleWithFixedDelay

        public static Registration scheduleWithFixedDelay​(Whiteboard whiteboard,
                                                          Runnable runnable,
                                                          long delayInSeconds,
                                                          boolean runOnSingleClusterNode,
                                                          boolean useDedicatedPool)
      • scheduleWithFixedDelay

        public static Registration scheduleWithFixedDelay​(Whiteboard whiteboard,
                                                          Runnable runnable,
                                                          Map<String,​Object> extraProps,
                                                          long delayInSeconds,
                                                          boolean runOnSingleClusterNode,
                                                          boolean useDedicatedPool)
      • getServices

        @NotNull
        public static <T> @NotNull List<T> getServices​(@NotNull
                                                       @NotNull Whiteboard wb,
                                                       @NotNull
                                                       @NotNull Class<T> type)
        Returns the currently available services from the whiteboard of the tracked type. Note that the underlying tracker is closed automatically.
        Parameters:
        wb - the whiteboard
        type - the service type
        Returns:
        a list of services
      • getService

        @Nullable
        public static <T> T getService​(@NotNull
                                       @NotNull Whiteboard wb,
                                       @NotNull
                                       @NotNull Class<T> type)
        Returns the one of the currently available services from the whiteboard of the tracked type. Note that the underlying tracker is closed automatically.
        Returns:
        one service or null
      • getServices

        @NotNull
        public static <T> @NotNull List<T> getServices​(@NotNull
                                                       @NotNull Whiteboard wb,
                                                       @NotNull
                                                       @NotNull Class<T> type,
                                                       @Nullable
                                                       @Nullable Predicate<T> predicate)
        Returns the currently available services from the whiteboard of the tracked type. If predicate is not null the returned list is limited to the ones that match the predicate. Note that the underlying tracker is stopped automatically after the services are returned.
        Parameters:
        wb - the whiteboard
        type - the service type
        predicate - filtering predicate or null
        Returns:
        a list of services
      • getService

        @Nullable
        public static <T> T getService​(@NotNull
                                       @NotNull Whiteboard wb,
                                       @NotNull
                                       @NotNull Class<T> type,
                                       @Nullable
                                       @Nullable Predicate<T> predicate)
        Returns the one of the currently available services from the whiteboard of the tracked type. If predicate is not null only a service that match the predicate is returned. Note that the underlying tracker is closed automatically.
        Parameters:
        wb - the whiteboard
        type - the service type
        predicate - filtering predicate or null
        Returns:
        one service or null