Win a copy of Spring Boot in Practice this week in the Spring forum!

Stephan van Hulst

Saloon Keeper
+ Follow
since Sep 20, 2010
Cologne, Germany
Cows and Likes
Cows
Total received
319
In last 30 days
3
Total given
240
Likes
Total received
3493
Received in last 30 days
17
Total given
627
Given in last 30 days
7
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephan van Hulst

Welcome to CodeRanch!

I'm not sure if this changes anything, but I think it's odd that you initialize and set the default SSL context after you've opened the connection.

Why are you writing such low-level code? You should be using a SOAP client to send and receive SOAP messages, not write all that stuff by hand.
6 hours ago
If your project is a Maven project, it should have a file called pom.xml in its root directory. This is the Maven project descriptor.

In the POM there should be a section <dependencies> to which you can add a <dependency> element for the library that you want to add to your project. The second answer in the StackOverflow page that you linked to has an example of such a dependency.

Before you add any dependencies at all, please tell us why you need Apache POI. If you're not working with Microsoft Office files, then using Apache POI might be overkill if all you intend to do is read a CSV file.
6 hours ago
For what reason are you using fixed durations for years, weeks and days? Why are you not using the java.time.* APIs?
8 hours ago
Did you rebuild and redeploy the application?
1 day ago

Md Zuanyeed Kamal wrote:Could you suggest a method in String that can take 3 parameters .


Piet has already given you a good example, but you can easily find this out for yourself by looking at the API documentation for the String class, and inspecting the signatures of each method. To be compatible with TriFunction, the method must either be an instance method with 2 parameters, or a static method with 3 parameters.

The example that Piet gave is an instance method with 2 parameters. Other instance methods are

  • codePointCount,
  • indexOf,
  • lastIndexOf,
  • replaceAll,
  • replaceFirst,
  • split,
  • startsWith,
  • subSequence, and
  • substring.

  • Static methods with 3 parameters are:

  • copyValueOf,
  • format,
  • valueOf.
  • Two things are wrong:

    Your functional interface has 4 generic type parameters, but you only supplied 3 type arguments.

    String::length hardly represents a function that takes 3 arguments.

    Carey Brown wrote:I don't feel this statement fits all use-cases. There a cases where you create an object which then goes off to handle its own life-cycle and nothing else needs to retain a reference to control it, See my main() example.


    Frank's point is that the stack frame that instantiates the service should almost never be the same stack frame that calls a method on that service. Either you instantiate a service and pass that service deeper into the application, or you call a method on the service, in which case the service should be injected as a constructor or method argument.

    The main() method is a great counter-example, but that's because the main() method doesn't have any stack frame above it to create services for it to use.
    4 days ago
    There is no good reason.

    The method doesn't require instance fields, so it can be static. There is one exception to this rule, and that is when the method implements a declaration in a supertype, but in that case the method can't be private.
    5 days ago

    Campbell Ritchie wrote:What is a property descriptor?


    An object that describes a bean property. In other words, you can use it to perform reflective operations on a property "x", regardless of whether that property is represented by a field x or a getter getX().
    5 days ago
    First explain in your own words what the difference is between a static method an an instance method, and when to use which.
    5 days ago

    Himai Minh wrote:It seems like your Maven compiler is looking for JDK 8 instead of 11.


    The source and target settings only affect the command line arguments that Maven sends to the compiler. They do not decide which compiler Maven uses.

    The compiler that Maven uses is determined by the JAVA_HOME variable.

    tangara goh wrote:I have set it to JDK I am very sure.


    The JDK is on your PATH, but I have the suspicion that your JAVA_HOME variable points somewhere else. Please show us the value of the JAVA_HOME variable.
    Welcome to CodeRanch!

    Tomcat 10 is based on the Jakarta EE 9 specification, not the old Java EE specifications. That means your application needs a dependency on the Jakarta EE 9 API libraries, and you need to refactor your code to use only types from the jakarta namespaces.

    For instance, you code appears to be using javax.servlet.ServletRequestListener, but instead it should be using jakarta.servlet.ServletRequestListener.
    6 days ago

    Pavlos Maragkos wrote:we have 4 JVMs, running exactly the same application/code and the issue appears randomly to one of them


    Randomly on any JVM, or always the same one?

    This issue begin to appear after we changed from blocking IO to non-blocking IO using java Selector.


    Can you elaborate on this? Maybe you can explain to us what the pipeline is being used for, which threads make use of it how and when, and how the selector fits into all of this.

    I updated my initial post to make this clear. In any case, I'm planning to update both questions in case there is any finding or good idea!


    Thank you. :-)
    6 days ago
    Welcome to CodeRanch!

    Sorry, I have no idea what can cause this, other than some weirdness in the JVM or OS version. Does your test environment have the same JVM and OS versions as your production environment?

    It appears that your Pipeline class acts like an input stream that blocks until another thread writes data to its buffer. Couldn't you try to sidestep the entire issue by using a PipedInputStream instead?

    Finally, we ask you to BeForthrightWhenCrossPostingToOtherSites.

    Topic on SO: https://stackoverflow.com/questions/73310224/java-object-notifyall-blocks-for-long-time-while-consuming-high-cpu
    6 days ago