io.vertx.ext.sync

## Class Sync

- java.lang.Object
- - io.vertx.ext.sync.Sync

- Deprecated.
  This project will be removed with Quasar being effectively abandoned

      @Deprecated
      public class Sync
      extends Object

  This class contains various static methods to allowing events and asynchronous results to be accessed in a synchronous way.
  Author:
    Tim Fox

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Sync()` Deprecated.

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `awaitEvent(java.util.function.Consumer<Handler<T>> consumer)` Deprecated. Receive a single event from a handler synchronously.
    `static <T> T` | `awaitEvent(java.util.function.Consumer<Handler<T>> consumer, long timeout)` Deprecated. Receive a single event from a handler synchronously.
    `static <T> T` | `awaitResult(java.util.function.Consumer<Handler<AsyncResult<T>>> consumer)` Deprecated. Invoke an asynchronous operation and obtain the result synchronous.
    `static <T> T` | `awaitResult(java.util.function.Consumer<Handler<AsyncResult<T>>> consumer, long timeout)` Deprecated. Invoke an asynchronous operation and obtain the result synchronous.
    `static <T> Handler<T>` | `fiberHandler(Handler<T> handler)` Deprecated. Convert a standard handler to a handler which runs on a fiber.
    `static co.paralleluniverse.fibers.FiberScheduler` | `getContextScheduler()` Deprecated. Get the `FiberScheduler` for the current context.
    `static void` | `removeContextScheduler()` Deprecated. Remove the scheduler for the current context
    `static <T> HandlerReceiverAdaptor<T>` | `streamAdaptor()` Deprecated. Create an adaptor that converts a stream of events from a handler into a receiver which allows the events to be received synchronously.
    `static <T> HandlerReceiverAdaptor<T>` | `streamAdaptor(co.paralleluniverse.strands.channels.Channel<T> channel)` Deprecated. Like `streamAdaptor()` but using the specified Quasar `Channel` instance.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Sync

          public Sync()

      Deprecated.

  - ### Method Detail

    - #### awaitResult

          @Suspendable
          public static <T> T awaitResult(java.util.function.Consumer<Handler<AsyncResult<T>>> consumer)

      Deprecated.
      Invoke an asynchronous operation and obtain the result synchronous. The fiber will be blocked until the result is available. No kernel thread is blocked.
      Type Parameters:
        `T` - the type of the result
      Parameters:
        `consumer` - this should encapsulate the asynchronous operation. The handler is passed to it.
      Returns:
        the result

    - #### awaitResult

          @Suspendable
          public static <T> T awaitResult(java.util.function.Consumer<Handler<AsyncResult<T>>> consumer,
                                                       long timeout)

      Deprecated.
      Invoke an asynchronous operation and obtain the result synchronous. The fiber will be blocked until the result is available. No kernel thread is blocked.
      Type Parameters:
        `T` - the type of the result
      Parameters:
        `consumer` - this should encapsulate the asynchronous operation. The handler is passed to it.
        `timeout` - In milliseconds when to cancel the awaited result
      Returns:
        the result or null in case of a time out

    - #### awaitEvent

          @Suspendable
          public static <T> T awaitEvent(java.util.function.Consumer<Handler<T>> consumer)

      Deprecated.
      Receive a single event from a handler synchronously. The fiber will be blocked until the event occurs. No kernel thread is blocked.
      Type Parameters:
        `T` - the type of the event
      Parameters:
        `consumer` - this should encapsulate the setting of the handler to receive the event. The handler is passed to it.
      Returns:
        the event

    - #### awaitEvent

          @Suspendable
          public static <T> T awaitEvent(java.util.function.Consumer<Handler<T>> consumer,
                                                      long timeout)

      Deprecated.
      Receive a single event from a handler synchronously. The fiber will be blocked until the event occurs. No kernel thread is blocked.
      Type Parameters:
        `T` - the type of the event
      Parameters:
        `consumer` - this should encapsulate the setting of the handler to receive the event. The handler is passed to it.
        `timeout` - In milliseconds when to cancel the awaited event
      Returns:
        the event

    - #### fiberHandler

          @Suspendable
          public static <T> Handler<T> fiberHandler(Handler<T> handler)

      Deprecated.
      Convert a standard handler to a handler which runs on a fiber. This is necessary if you want to do fiber blocking synchronous operations in your handler.
      Type Parameters:
        `T` - the event type of the handler
      Parameters:
        `handler` - the standard handler
      Returns:
        a wrapped handler that runs the handler on a fiber

    - #### streamAdaptor

          @Suspendable
          public static <T> HandlerReceiverAdaptor<T> streamAdaptor()

      Deprecated.
      Create an adaptor that converts a stream of events from a handler into a receiver which allows the events to be received synchronously.
      Type Parameters:
        `T` - the type of the event
      Returns:
        the adaptor

    - #### streamAdaptor

          @Suspendable
          public static <T> HandlerReceiverAdaptor<T> streamAdaptor(co.paralleluniverse.strands.channels.Channel<T> channel)

      Deprecated.
      Like `streamAdaptor()` but using the specified Quasar `Channel` instance. This is useful if you want to fine-tune the behaviour of the adaptor.
      Type Parameters:
        `T` - the type of the event
      Parameters:
        `channel` - the Quasar channel
      Returns:
        the adaptor

    - #### getContextScheduler

          @Suspendable
          public static co.paralleluniverse.fibers.FiberScheduler getContextScheduler()

      Deprecated.
      Get the `FiberScheduler` for the current context. There should be only one instance per context.
      Returns:
        the scheduler

    - #### removeContextScheduler

          @Suspendable
          public static void removeContextScheduler()

      Deprecated.
      Remove the scheduler for the current context

Copyright © 2022 Eclipse. All rights reserved.