singleUsing

fun <T, R> singleUsing(resourceSupplier: () -> R, resourceCleanup: (resource: R) -> Unit, eager: Boolean = true, sourceSupplier: (resource: R) -> Single<T>): Single<T>

Returns a Single that for each subscription acquires a new resource via resourceSupplier, then calls sourceSupplier and subscribes to the returned upstream Single and disposes the resource via sourceSupplier when the upstream Single is finished (either terminated or disposed).

Please refer to the corresponding RxJava document.