Git Product home page Git Product logo

Comments (5)

yschimke avatar yschimke commented on May 22, 2024

It seems a bit of a shame to lose AutoCloseable. it simplifies client usage, where often the synchronous close is useful with try-with-resources blocks.

from rsocket-java.

NiteshKant avatar NiteshKant commented on May 22, 2024

@yschimke I would like to hear more of the cases where try-with-resources is useful for real world applications. I would always end up doing Observable.concatWith(socket.close()) (in RxJava world ofcourse) as one can't really synchronously close the socket, it is always at the completion of an asynchronous call.

Having said that, I think we can always provide a utility method elsewhere which converts asynchronous close() to synchronous AutoClose implementation.

from rsocket-java.

robertroeser avatar robertroeser commented on May 22, 2024

technically this wouldn't close until someone request(n) the close - so that could be a little weird.

why not use a CompletableFuture?

from rsocket-java.

yschimke avatar yschimke commented on May 22, 2024

@NiteshKant I agree but would probably differentiate between expert users, and normal users.

I think making the simplest most Java idiomatic thing work correctly (but not optimally) is a cost worth paying. e.g. the clarity of the sample code that will be cut and paste everywhere.

It's a lot easier for users to go from correct+simpler -> correct+optimal once they care enough.

from rsocket-java.

NiteshKant avatar NiteshKant commented on May 22, 2024

0.5.x has close() and onClose() methods on ReactiveSocket. Closing this issue.

from rsocket-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.