Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Anthony Accioly

+ Follow
since Dec 22, 2008
Anthony likes ...
Scala IntelliJ IDE Suse
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anthony Accioly

Almost every Spring WebFlux example out there is leveraging Spring Data MongoDB to build Reactive end to end solutions.

As I understand it, JDBC is inherently a blocking API and we'll not be getting reactive support for relational databases any time soon. Leveraging Spring JPA async queries and dedicated thread pools can potentially improve things but it is not a replacement for real Reactive support.

My question is. Ate there known limitations when using Spring WebFlux with a "blocking" persistence layer such as a Spring Data JPA? Would it even make sense to build a Reactive REST API on top of a traditional blocking persistence layer (in terms os scalability)?
4 years ago

Campbell Ritchie wrote:

Anthony Accioly wrote:. . . Can this be narrowed down somehow? . . .  

I think you would have to narrow the question yourself.

Unfortunately I don't have the required permissions to edit my question, but here it goes: @Dmitry, can you tell us a little bit about how Jetbrains leverages Kotlin's Coroutines and asynchronous programming to build their products?
4 years ago

Dmitry Jemerov wrote:"Briefly summarizing" the entire landscape of concurrent programming would require writing at least a few pages of text, and this is simply too broad for this forum and the time we have now.

Hi Dmitry, you are right, reading the question it ended up too broad. Can this be narrowed down somehow? Maybe you can give us some insights on the features that you feel particularly excited about and maybe how are you leveraging Kotlin's concurrency model internally at JetBrains?  
4 years ago
Kotlin 1.1 has introduced Coroutines as an experimental feature (documentation). Quasar is also gaining popularity in the JVM World.

My impression is that Kotlin is taking a kitchen sync approach to asynchronous programming. Between Coroutines and libraries like Quasar there are many ways to implement asynchronous features, just to list a few idioms:

  • Async/Await
  • Channel and Select expressions
  • Generators/yield
  • Fibers
  • Actors
  • Completable Futures
  • Reactive extensions (Rx)

  • While some of these overlap and / or are based on each other, there are still many choices left to the end developer. The same problem can be solved in many, may ways, which is both a curse and a blessing (C++ gives Kotlin a Thumbs up / Python leaves the room ).

    I guess my question is: Can you briefly summarize how to choose the right asynchronous idiom in Kotlin? What kinds of problems are best solved by each kind of constructs And finally, do you foresee that the majority of the Kotlin community converging towards a specific idiom (like Erlang Actors or C# async / await)?
    4 years ago
    Hello Mr. Ganesh,

    Thank you for the prompt answer and the much welcome lesson on the perks of parallel streams.
    If you don't mind a follow up question, besides AtomigLong, parallel streams and CyclicBarrier what classes / constructs are important to master when studying concurrency for the certification?
    Locks, synchronized, ExecutorService? Any other hints about what is covered by the exam (should I be worried about things such as Semaphore and StampedLock)?
    Hello Mr. Ganesh,

    I would like to have your input about the - somewhat broad - certification topic:

    Use synchronized keyword and java.util.concurrent.atomic package to control the order of thread execution

    Is my understanding that in Java 8 classes such as AtomicLong / AtomicInteger were rewritten replacing compare-and-swap techniques with fetch-and-add. Other than that, looks like some new methods were introduced to take advantage of lambda constructs.
    I've also read about new classes in the java.util.concurrent.atomic such as LongAccumulator and LongAdder meant outperform AtomicLong under heavy update contention situations.

    Do you know if those improvements are part of the exam? If so, could your briefly comment about how to use those new constructs and when to choose one over the other?

    Kind regards,
    Hi, I'm trying to write a simple temperature conversion DSL for learning purposes.
    Here is my code so far:




    I think I did pretty ok for a first attempt, but I would like to eliminate the need for the extra parenthesis if possible, so that I could use the DSL like this:

    Is that possible? If so, could you guys please point the way?

    11 years ago
    Out of Topic: I keep hitting the Submit Button thinking I'm hitting "Preview" lol
    11 years ago
    I Think what you really meant is that you want the PDF Content from the Servlet to be displayed inside a JSP Page isn't it?
    The Servlet should not "redirect" it's content for the JSP, the client (JSP, HTML or any other view technology) should request the content from the Servlet.
    Since you are using frames, you can accomplish that by using links with targets. What I mean is that your page jspex1.jsp should have a link for the Servlet URL (/RenderServlet?filename="bla.pdf") targeting jpex2 frame.
    See if this helps': HTML Frames Tutorial. take a Look at the syntax.
    And Bear, sorry for my PM, looks like we are back at a Client Side question after all .
    11 years ago
    See my example code at A Previous Code Ranch Post for a base implementation.
    Replace content type with within line 21.
    Replace line 24 with the following:
    You only need to close the first stream at line 44. All of the others close method calls are redundant.
    If you are receiving the file location via http parameters like don't forget to write some cleaning code for that (you really don't want to give access to every single file at that server).
    If you hit some performance problems (I Hit with 200+ concurrent users) you can also try NIO API and some caching (check out Java Caching System).

    11 years ago
    Sorry, was meant to be an awnser to other thread. Not a new one.

    In short, flex integration heaven
    12 years ago
    With such new UI target languages/frameworks as Flex (AIR), Silverlight (OutOFBrowser) and Java FX (draggable applications) the barrier between Desktop and Web Based Desktop is falling. New top of the class server side languages such as Scala are quite productive for large concurrent applications. All of those languages are free and multi-environment. Also Google is working hard on Chrome OS and V8 Javascript engine.
    Where do you think software development is headed? Are we moving to a cloud computing scenario? Will the average user follow the change? How about the enterprise, will it trust the internet for sensitive applications suchs as ERPs and CRMs?
    12 years ago

    Are you sure its IE that is not handling this? What version of the Flash player do you have installed in IE? Is it being used to try to run the SWF? If its not being used at all, check the headers that are set in the response. You can double check you set these correctly with a tool like fiddler. Unless your SWF content really isn't a SWF and your Content-Type is wrong, flash player will be being used (assuming its there).

    Paul, headers are ok. The content is SWF and I tested it using Flash Player 10. Internet Explorer does call Flash and display the video when the content isn't served through a .htm URL (first web.xml), the situation happens when we use the second web.xml file (the content is mapped to /serveFile.htm). You can test it yourself with the code I wrote. Firefox and Safari works fine. The same situation occurs at my real application.
    The headers, file, and flash players are exactly the same. The situation only occurs with IE (tested with IE 6 and 7).

    Is there any server side workarounds?
    I definitively need to have this url mapped to a htm extension for several reasons. I did read MIME sniffing articles at MSDN but telling customers to tweak Internet Explorer options or run .reg files is out of question...
    12 years ago
    Hey all,

    I'm currently using Servlets (in fact Struts Actions, but my problem is also reproducable with Servlets) to serve binary content stored into a database. Mainly images, pdf files, flash videos, office documents and such. I would like to display the content through the browser when possible, and let the users download the content otherwise.

    Everything works fine until the binary data server gets mapped to an .htm extension (business requirement of my application). At that point, IE breaks showing only a blank page.

    Here is a reproduced version of the problem:

    Works fine with that web.xml

    But breaks IE ( blank page) with that one:

    I’m aware that can be used to force the download of every single file (inline mode don’t make any difference). Still, it would be a pain to have users downloading files such as jpg images and pdfs just because IE can’t handle MIME types appropriately.

    Anyone got a better workaround or suggestion?

    12 years ago