com.streambase.sb.operator

## Interface Operator.RuntimeEnvironment

- Enclosing class:
    Operator

      public static interface Operator.RuntimeEnvironment

  This interface is used to gain access to StreamBase Server information and facilities.

  This is only valid during application runtime. It will not be valid during typecheck.

  Since:
    7.0 initial release

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExecutorService` | `createExecutor(int maxNumberOfWorkerThreads)` Create an ExecutorService.
    `Constants.LeadershipStatus` | `getLeadershipStatus()` Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
    `Operator.SharedObjectManager` | `getSharedObjectManager()` Return the SharedObjectManager
    `StreamBaseURI` | `getURI()` Return the URI of this Server.
    `void` | `registerUnmanagedThread(String name)` Threads that do not derive from Operator may call this method and their CPU usage will be tracked by the StreamBase profiler.
    `void` | `unregisterUnmanagedThread()` Threads which have called registerUnmanagedThread() and that are no longer interested in having the StreamBase profiler track them should call this method.

- - ### Method Detail

    - #### getURI

          StreamBaseURI getURI()

      Return the URI of this Server. Note that this URI does not contain any container information.
      Returns:
        the server's URI
      Since:
        7.0 initial release

    - #### getLeadershipStatus

          @Deprecated
          Constants.LeadershipStatus getLeadershipStatus()

      Deprecated. Legacy high-availability service, migrate to SB 10 high-availability service.
      return the LeadershipStatus of this server

      This method is no longer supported since the StreamBase 10 platform release. Please consult the documentation.

      Returns:
        leadership status
      Since:
        7.0 initial release

    - #### getSharedObjectManager

          Operator.SharedObjectManager getSharedObjectManager()

      Return the SharedObjectManager
      Returns:
        the SharedObjectManager
      Since:
        7.1 initial release
      See Also:
        `Operator.SharedObjectManager`

    - #### createExecutor

          ExecutorService createExecutor(int maxNumberOfWorkerThreads)

      Create an ExecutorService. Once created the Operator is responsible for the Executor life cycle including shutdown on suspend/shutdown, create on resume etc.
      Parameters:
        `maxNumberOfWorkerThreads` - the maximum number of worker threads, use 0 or -1 for unlimited number of worker threads, otherwise the number of worker threads is capped to the maxNumberOfWorkerThreads given.
      Returns:
        an Executor
      Since:
        7.0.6 initial release
      See Also:
        `ExecutorService`

    - #### registerUnmanagedThread

          void registerUnmanagedThread(String name)

      Threads that do not derive from Operator may call this method and their CPU usage will be tracked by the StreamBase profiler. This method must be called from the thread wishing to be tracked and after the operator has already started. The thread that calls this method must also call unregisterUnmanagedThread(), when it no longer wishes to be tracked, or is exiting. For example:

           public void run() {
            registerUnmanagedThread("QuotesProcessingThread")
            try {
                while (keepGoing) {
                    // work.
                }
            } catch (Throwable t) {
                // handle problem.
            } finally {
                // make certain to unregister
                unregisterUnmanagedThread();
            }
           }

      Parameters:
        `name` - - This name will be appended to the operator path name and be used as the thread name.
      Since:
        7.0.8 initial release

    - #### unregisterUnmanagedThread

          void unregisterUnmanagedThread()

      Threads which have called registerUnmanagedThread() and that are no longer interested in having the StreamBase profiler track them should call this method. This includes when a thread is going to exit.
      Since:
        7.0.8 initial release

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.