Skip to content
Advertisement

Tag: multithreading

create a custom log4j2 rolling file appender

I want to create a custom log4j2 rolling file appender. I need to create this custom appender because I want to wrap the file name with current thread name. We are trying to migrate log4j 1.x to recent log4j2 version and previously we had used DailyRollingFileAppender to log all activities of our application. please find the below code. Here we

Can another thread see an effectively immutable object in an inconsistent state if it is published with a volatile reference?

According to Java Concurrency in Action if we have the following class: and we initialise an instance of this class and publish it in a non-safe way (through a simple public field for example), then the assertCorrectness() might indeed throw an AssertionError, if called from another thread. In other words, this means that some another thread might see an up-to-date

Java ParallelStream: several map or single map

Introduction I’m currently developing a program in which I use Java.util.Collection.parallelStream(), and wondering if it’s possible to make it more Multi-threaded. Several small map I was wondering if using multiple map might allow the Java.util.Collection.parallelStream() to distribute the tasks better: Single big map For example a better distribution than: Question Is there one of the solutions that is more suitable

Share an array between threads in java

I’m currently working on my own little boardgame and came across a problem with multithreading. I have one thread that renders the board and one that supplies the data to render. The supply thread writes his data to one array and then the renderer takes this data and renders it on the screen (The render thread never writes something to

Async with single thread in Android

I read some stack overflow answers about sync, async, and threading on post A and post B. The main point I got from the post is “multithreading is only one kind of asynchrony. Threading is about workers; asynchrony is about tasks” from post A and “Technically, the concept of synchronous/asynchronous really does not have anything to do with threads” from

Advertisement