JCH
Java Community | Help. Code. Learn.
We are a Community full of Java developers. Connect with other devs, get help, help others and do much more!
JoinJCH
Java Community | Help. Code. Learn.
We are a Community full of Java developers. Connect with other devs, get help, help others and do much more!
JoinRequests are sent in the wrong order or too fast?
hey guys. i have a question with java spring app. right now i have this situation:
I have cron job that sends request to the bank (gwService.sendCurrentDayStatementRequest()). this request does a call to /account-statements endpoint. then bank does some stuff, and later i can make requests to get my statement. then im calling gwService.getBankStatementResponse() which calls /message endpoint. and finally i call gwService.deleteBankStatement() which deletes the statement from /messages endpoint. its like a queue type of thing.
```java
@Scheduled(cron = "${currentDayStatementCron}")
public void sendCurrentDayStatementRequestScheduled(){...
How do you get the value of how much the app uses your CPU?
I am trying to make a CPU usage counter for my Minestom server, but I can't find any simple way to get the servers CPU usage. Does anyone here know how?
List folder files the fastest way
Hi, currently i'm in need of list all the files in a folder with over 20k files (folder will have more files with the time), and then create a csv file with all the folder file names. But i'm kinda stuck since it need to be the fastest way possible, and all the ways i think about, are basically sequential.
Looking for a Java Backend Engineer who can speak Chinese fluently.
This is gambling project which is related to the live video streaming.
If you have high skills in Java Backend Development and please contact me.
And if you have experiences in working with companies remotely, it would be better.
Mandatory language is Chinese....
what is the fastest way of sorting through thousands of objects?
I need to sort through thousands of objects using some sort of identifier, but im not sure what the fastest way is?
Arraylist
List
Map<string, user>?...
Static Methods Inheritance
I want to use a Parent class called Settings, and this class is never used, it got some methods and one of the method is
...
public static NamespacedKey getKey() {
return null;
}
public static NamespacedKey getKey() {
return null;
}
Pagination vs Streams vs Other approaches
When do you decide it's better to use pagination in this case vs streams vs another approach when you're fetching records from the db?
Is it like if it's only a few thousand records, use pagination. If it's hundreds of thousands of records or more use streams? Or do you think about something else here for your decision?...
Need help with suggestions for a system
So basically in my java project I have a system that I built where I create entities. There is an abstract class called CustomEntity and this is the main class for entities. I want all my custom entities to extend off of this class, but now the problem is that all classes which extend off of it will inherit the single constructor from the CustomEntity class, this constructor takes an entity as a parameter. This is to fully initialize the entity. What I want to do is to be able to override certain methods from the CustomEntity class within the child classes which extend off of it, for example, a boolean method called
canSpawn() which will be called to determine if the custom entity can be spawned. I want to be able to call this method before actually spawning in the custom entity but I cannot do this as I would need to spawn in the entity to pass into the constructor and create the object to call it.
So my idea was to create a blank constructor in the CustomEntity class that is protected and then at the start of the program create a factory of each registered entity type via reflection access on the empty constructor and then use this to make the calls on the overriden methods within each extending class when needed. This would work perfect, but the only problem is that it gives me a no such method exception as reflection seems to not be able to find super class constructors. I don't want to have to create an empty constructor on every single class that extends CustomEntity as this is redundant. Is there any solution to this or am I approaching this the wrong way? Also if possible I would like to create the empty constructor as private/protected so it is not visible for use in the API aside from internally to create the factory. Also I cannot create dummy entities to pass into the classes....java: cannot find symbol
Greetings,
I was doing an approach that I normally do when developing a project and I am encountering an error that I don't know the exact reason for.
I did some research and changing the Java version from 21 to 17 didn't work and this was one of the most standard approaches I've seen in general. Is there a change related to Lombok or IntelliJ that I don't know about?...

Need help with workspace and installing java for VS code.
I've tried many different tutorials from the videos, but to no avail. I decided to ask the community for help. How can I run the first program and what else do I need to download?

Need help pls with this Java ecom desktop app with a personal blog system in IntelliJ
I'm a CS student and a beginner in Java, and I have a university course project in Application Development that involves revising an e-commerce desktop application template and transforming it into our system, which we chose. For my case, I chose a personal blog system in which it aims to make a blog system for business owners in a way it helps them plan their businesses, such as the products they plan to sell etc. It is like a business owner-centered planner, basically combining MS Word and Not...

CodeGen vs native code
Do you use CodeGen at all for enscapsulating things like api clients, creating pojos and SDKs for external apis or you would prefer manual native code approach? What are the pros and cons of each and why do you do what you do?
Example of CodeGen: https://github.com/swagger-api/swagger-codegen...
Spring Boot Microservices Redirection
I made one authentication-service to handle profile management and authentication (login and registering new user) and another home-service for showing the web pages related to home page and other pages etc.
For now i just want to go to the authentication-service once i go to localhost:8079 (port number of api gateway). How to do that?
I'm using consul instead of eureka.
Dependencies installed in authentication-service - spring-cloud-starter-consul-discovery, spring-cloud-starter-openfeign
Dependencies installed in home-service - spring-cloud-starter-config, spring-cloud-starter-consul-discovery, spring-cloud-starter-openfeign...
Android Studio "temporal must not be null"
I'm very new to Java and coding in general (I started last week) and I'm making a calendar app for android. I got the basic calendar running, but when I tried to add a feature it keeps crashing. I believed it's because of line 119 always being null, but I initialised and declared it (I think). Anyways I'm stuck on this and can't work on my app anymore, so I would be very happy to solve this!
Here's the error logcat message :
...
FATAL EXCEPTION: main Process: com.petris.lunor, PID: 2117 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.petris.lunor/com.petris.lunor.MainActivity}: java.lang.NullPointerException: temporal must not be null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4186) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467) with tag AndroidRuntime
FATAL EXCEPTION: main Process: com.petris.lunor, PID: 2117 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.petris.lunor/com.petris.lunor.MainActivity}: java.lang.NullPointerException: temporal must not be null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4186) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4467) with tag AndroidRuntime

Single JVM process architecture
Hi everyone,
I’m working on a Java project that will run entirely in a single JVM (deployed via Docker Compose).
Inside the JVM I will have “services” which will handle the business logic. Each service/replica will run in a separate thread giving me async processing. The architecture which I’m going with will pull data from APIs into rabbitmq queue on a set schedule during the day. ...
Help, target folder saves to src, what should I do?
Hello everyone, I started saving the plugin and for some reason the target folder appears in src. This happened today, I couldn’t fix it, I went to write an anti-cheat and now this is happening again. Can you please help?

Scene Builder
i like to write direct in Fxml file rather then using scene builder.
My question is will i lose good tool if i did not use it and is it irreplaceable?...