All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.rsocket.internal.BaseDuplexConnection Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package io.rsocket.internal;

import io.rsocket.DuplexConnection;
import reactor.core.publisher.Mono;
import reactor.core.publisher.MonoProcessor;

public abstract class BaseDuplexConnection implements DuplexConnection {
  private MonoProcessor onClose = MonoProcessor.create();

  public BaseDuplexConnection() {
    onClose.doFinally(s -> doOnClose()).subscribe();
  }

  protected abstract void doOnClose();

  @Override
  public final Mono onClose() {
    return onClose;
  }

  @Override
  public final void dispose() {
    onClose.onComplete();
  }

  @Override
  public final boolean isDisposed() {
    return onClose.isDisposed();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy