Packages

trait Simple extends IOApp

A simplified version of IOApp for applications which ignore their process arguments and always produces ExitCode.Success (unless terminated exceptionally or interrupted).

Source
IOApp.scala
See also

IOApp

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Simple
  2. IOApp
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def run: IO[Unit]

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def MainThread: ExecutionContext

    Executes the provided actions on the JVM's main thread.

    Executes the provided actions on the JVM's main thread. Note that this is, by definition, a single-threaded executor, and should not be used for anything which requires a meaningful amount of performance. Additionally, and also by definition, this process conflicts with producing the results of an application. If one fiber calls evalOn(MainThread) while the main fiber is returning, the first one will "win" and will cause the second one to wait its turn. Once the main fiber produces results (or errors, or cancels), any remaining enqueued actions are ignored and discarded (a mostly irrelevant issue since the process is, at that point, terminating).

    This is not recommended for use in most applications, and is really only appropriate for scenarios where some third-party library is sensitive to the exact identity of the calling thread (for example, LWJGL). In these scenarios, it is recommended that the absolute minimum possible amount of work is handed off to the main thread.

    Attributes
    protected
    Definition Classes
    IOApp
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. def computeWorkerThreadCount: Int

    Controls the number of worker threads which will be allocated to the compute pool in the underlying runtime.

    Controls the number of worker threads which will be allocated to the compute pool in the underlying runtime. In general, this should be no greater than the number of physical threads made available by the underlying kernel (which can be determined using Runtime.getRuntime().availableProcessors()). For any application which has significant additional non-compute thread utilization (such as asynchronous I/O worker threads), it may be optimal to reduce the number of compute threads by the corresponding amount such that the total number of active threads exactly matches the number of underlying physical threads.

    In practice, tuning this parameter is unlikely to affect your application performance beyond a few percentage points, and the default value is optimal (or close to optimal) in most common scenarios.

    This setting is JVM-specific and will not compile on JavaScript.

    For more details on Cats Effect's runtime threading model please see https://typelevel.org/cats-effect/docs/thread-model.

    Attributes
    protected
    Definition Classes
    IOApp
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def logNonDaemonThreadsEnabled: Boolean

    Controls whether non-daemon threads blocking application exit are logged to stderr when the IO produced by run has completed.

    Controls whether non-daemon threads blocking application exit are logged to stderr when the IO produced by run has completed. This mechanism works by starting a daemon thread which periodically polls all active threads on the system, checking for any remaining non-daemon threads and enumerating them. This can be very useful for determining why your application isn't gracefully exiting, since the alternative is that the JVM will just hang waiting for the non-daemon threads to terminate themselves. This mechanism will not, by itself, block shutdown in any way. For this reason, it defaults to true.

    In the event that your application exit is being blocked by a non-daemon thread which you cannot control (i.e. a bug in some dependency), you can circumvent the blockage by appending the following to the IO returned from run:

    val program: IO[ExitCode] = ???                      // the original IO returned from `run`
    program.guarantee(IO(Runtime.getRuntime().halt(0)))  // the bit you need to add

    This finalizer will forcibly terminate the JVM (kind of like kill -9), ignoring daemon threads and shutdown hooks, but only after all native Cats Effect finalizers have completed. In most cases, this should be a relatively benign thing to do, though it's definitely a bad default. Only use this to workaround a blocking non-daemon thread that you cannot otherwise influence!

    Can also be configured by setting the cats.effect.logNonDaemonThreadsOnExit system property.

    Attributes
    protected
    Definition Classes
    IOApp
    See also

    logNonDaemonThreadsInterval

  15. def logNonDaemonThreadsInterval: FiniteDuration

    Controls the interval used by the non-daemon thread detector.

    Controls the interval used by the non-daemon thread detector. Defaults to 10.seconds.

    Can also be configured by setting the cats.effect.logNonDaemonThreads.sleepIntervalMillis system property.

    Attributes
    protected
    Definition Classes
    IOApp
    See also

    logNonDaemonThreadsEnabled

  16. final def main(args: Array[String]): Unit
    Definition Classes
    IOApp
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. def reportFailure(err: Throwable): IO[Unit]

    Configures the action to perform when unhandled errors are caught by the runtime.

    Configures the action to perform when unhandled errors are caught by the runtime. By default, this simply delegates to cats.effect.std.Console!.printStackTrace. It is safe to perform any IO action within this handler; it will not block the progress of the runtime. With that said, some care should be taken to avoid raising unhandled errors as a result of handling unhandled errors, since that will result in the obvious chaos.

    Attributes
    protected
    Definition Classes
    IOApp
  21. final def run(args: List[String]): IO[ExitCode]

    The entry point for your application.

    The entry point for your application. Will be called by the runtime when the process is started. If the underlying runtime supports it, any arguments passed to the process will be made available in the args parameter. The numeric value within the resulting ExitCode will be used as the exit code when the process terminates unless terminated exceptionally or by interrupt.

    args

    The arguments passed to the process, if supported by the underlying runtime. For example, java com.company.MyApp --foo --bar baz or node com-mycompany-fastopt.js --foo --bar baz would each result in List("--foo", "--bar", "baz").

    Definition Classes
    SimpleIOApp
    See also

    IOApp.Simple!.run:cats\.effect\.IO[Unit]*

  22. def runtime: IORuntime

    The runtime which will be used by IOApp to evaluate the IO produced by the run method.

    The runtime which will be used by IOApp to evaluate the IO produced by the run method. This may be overridden by IOApp implementations which have extremely specialized needs, but this is highly unlikely to ever be truly needed. As an example, if an application wishes to make use of an alternative compute thread pool (such as Executors.fixedThreadPool), it is almost always better to leverage IO.evalOn on the value produced by the run method, rather than directly overriding runtime.

    In other words, this method is made available to users, but its use is strongly discouraged in favor of other, more precise solutions to specific use-cases.

    This value is guaranteed to be equal to unsafe.IORuntime.global.

    Attributes
    protected
    Definition Classes
    IOApp
  23. def runtimeConfig: IORuntimeConfig

    The configuration used to initialize the runtime which will evaluate the IO produced by run.

    The configuration used to initialize the runtime which will evaluate the IO produced by run. It is very unlikely that users will need to override this method.

    Attributes
    protected
    Definition Classes
    IOApp
  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from IOApp

Inherited from AnyRef

Inherited from Any

Ungrouped