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 Details

    • 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
    • getSharedObjectManager

      Operator.SharedObjectManager getSharedObjectManager()
      Return the SharedObjectManager
      Returns:
      the SharedObjectManager
      Since:
      7.1 initial release
      See Also:
    • 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:
    • 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