Ron McLeod

Marshal
+ Follow

Recent posts by Ron McLeod

This is a typical use for CompletableFuture - downloading a number of numbers of files from one or more servers in the background, and processing the content once they all have been downloaded.  All downloads are performed asynchrounously.

If its not clear from the code and the debug output, the sequence is:
    - the file which contains the list of the other files is downloaded first
    - after that completes, the file is parsed for the names of the other files
    - downloading is prepared for each of the listed files
    - all files are downloaded in parallel
    - the files which are smaller and faster to download (typically) complete first
    - after all the files have been downloaded, the function which consumes the files is called

The interesting bit is the downloadFiles method which defines the processing chain
You could do something like this - wrap your call to get() with a CompletableFuture, and then print your result asynchronously as each task completes.
Is your goal to refresh yourself on what you have previously learned/used, or to become up-to-date on the newer features/concepts which you may have not seen before?

What version of Java were you last working with?
6 days ago

sai rama krishna wrote:... any option to format these big payloads in Notepad++


This post may help: StackOverflow: How to reformat JSON in Notepad++
6 days ago

Tim Holloway wrote:But there are websites that do "JSON pretty-printing" that you can paste JSON into, click a button, and copy down the reformatted JSON.


My favourite online formatter is: Curious Concept JSON Formatter & Validator

In addition to being able to paste your content into the a page's form, you can also call its API from you unit/integration tests.
6 days ago
I know this is an old post, but I just responded to this same question on StackOverflow and thought it would be helpful to post here as well.

On the Linux systems that I work with, you can get the user's UID with this:Note that this is the user id associated with the username used to log-in, not effective user id.
1 week ago

Steve Dyke wrote:This does not prevent spaces either


trim() does work, but I don't know about the jQuery bits through or what else is in your if-else blockedit: added check for == ""
2 weeks ago

Steve Dyke wrote:Sorry, I am using Java 8


overrideValue.trim().isEmpty()
2 weeks ago
On the client side, couldn't you just use the JS trim() method?
2 weeks ago

Steve Dyke wrote:How do I check for a space and not allow it?
Would I use a regex in lieu of the jQuery trim method?



Try using isBlank() rather than isEmpty():
2 weeks ago
Try printing/logging the value:
2 weeks ago
What is the value of overrideValue after this is executed?
2 weeks ago
Himai's comment gave me an idea for a better guess of what might be happening.

In your code, you are using try-with-resources to get a (shared) connection reference from the singleton.When using try-with-resources, the resources (including the connection) will automatically be closed.  This is fine except when you have multiple threads sharing the same connection, and one of the threads finishes having try-with-resources close the connection while the other threads are still using it.

I tried this as a test, and was able to reproduce this kind of problem (notice that the stack trace looks the same as what you shared):