Arthur Jackson

Greenhorn
+ Follow
since May 08, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arthur Jackson

Paul Clapham wrote:

Arthur Jackson wrote:And im gathering the objects so I can poll less in the GUI thread and then draw them all at once, to minimize freezing/lag.



Did you make that change (from one object at a time to 20) based on what you saw when you sent one object at a time? And did sending 20 make a difference?



I raised the 20 to 60, but yes I tried the sending one by one as well and there is a noticable difference.
1 month ago

Paul Clapham wrote:

Arthur Jackson wrote:I replaced the .clear() method with making a new ArrayList



Is there a reason why your List variable isn't a local variable in the read() method? (It's also confusing to have its name start with a capital letter, so it looks like a class name. Call it list instead.)


And personally I wouldn't gather the CustomObjects into groups before adding the groups to the queue, I would just add each CustomObject to the queue. (That's assuming that the task which removes objects from the queue takes them out of the groups and processes them individually.) That simplifies the programming, and it also avoids the situation where the code you posted ends abruptly with a half-filled list which is not yet added to the queue.



Actually now that I think about it, it doesn't have to be global indeed. And im gathering the objects so I can poll less in the GUI thread and then draw them all at once, to minimize freezing/lag.
1 month ago



That is what I had, it cleared the list after putting it in queue.

I replaced the .clear() method with making a new ArrayList

1 month ago
Sorry for the late reply, took a break from programming for a day, but got the error fixed!

Tim Holloway wrote:

This is one reason why having data come in faster than you can draw it shouldn't be much of a problem. The paint operation takes whatever data has been drawn up to that point. If more comes in, well, there's always the next paint cycle.



A lot of data at once freezes the application, that's the problem.

Paul Clapham wrote:
As for your list which is mysteriously getting emptied, my guess is that something in another thread is emptying the list. My wild guess is that the process which adds lists to the blocking queue reuses a single list which it empties, rather than creating new lists all the time. Just a wild guess, though.



And you were completely correct, I wouldn't have come up with that myself, thank you.
1 month ago
Hello!

I have a problem. I have a JavaFX application class, where I am polling(.take() ) Lists from a BlockingQueue(information is entered in another thread) for recent information(Inside a Task and a Platform.RunLater). And after getting the List, I need to forward it
to a method inside the same(JavaFX application) class.
The problem seems, that when I add the List to the BlockingQueue outside javafx thread, it has all the elements inside of it, when I retrieve it in inside platform.RunLater, it also has all the needed elements,
but now when I call out a method with said List, and check the List size in that method, it is 0 i.e null. I'm not sure even how to call this problem.

My code:


Also a problem - my application gets about 40 objects with data in a second. I need to parse the data and then display it in a X Y chart. As I understand updating GUI that fast, isn't a possibility, so I thought i'd send
packets(Lists) of data with the platform.RunLater and then foreach through the list and display the new data all almost at once. And so every 500ms or depending on how much I set the Thread.Sleep().
If you have any better ideas or suggestions how to handle a lot of data, i'd be really happy to hear them, because it seems the application still freezes up at periods.








1 month ago