Как будет работать одновременная замена строкового буфера в Java? [закрыто] ⇐ JAVA
Как будет работать одновременная замена строкового буфера в Java? [закрыто]
I am just wondering about how I would go about replacing a string concurrently in Java with threads (Callables/Runnables). I am aware that StringBuffer objects are immutable and thread safe, so I assume that would have something to do with it. Basically, I have a string, A, and want to replace some substrings, X and Y. I want to have a thread that deals with replacing substring X and another with substring Y. When both of the threads are done, I want A to have both the X and Y substring.
Right now, I have the threads to replace their substring taking in a StringBuffer object with the string set as A. When thread replacing substring X is done, I want thread substring Y to get the changes that X made to A before the substring Y is replaced. I am doing this for a university project with the purpose of playing around with threads, so I am aware that this might not be the best thing to thread, but I would appreciate any approachs to doing this threaded. I am not so good with threads yet so there is probably a lot I don't know! Thank you for any help
Источник: https://stackoverflow.com/questions/780 ... rk-in-java
I am just wondering about how I would go about replacing a string concurrently in Java with threads (Callables/Runnables). I am aware that StringBuffer objects are immutable and thread safe, so I assume that would have something to do with it. Basically, I have a string, A, and want to replace some substrings, X and Y. I want to have a thread that deals with replacing substring X and another with substring Y. When both of the threads are done, I want A to have both the X and Y substring.
Right now, I have the threads to replace their substring taking in a StringBuffer object with the string set as A. When thread replacing substring X is done, I want thread substring Y to get the changes that X made to A before the substring Y is replaced. I am doing this for a university project with the purpose of playing around with threads, so I am aware that this might not be the best thing to thread, but I would appreciate any approachs to doing this threaded. I am not so good with threads yet so there is probably a lot I don't know! Thank you for any help
Источник: https://stackoverflow.com/questions/780 ... rk-in-java
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Что лучше для динамических запросов String Builder или строкового буфера? [закрыто]
Anonymous » » в форуме JAVA - 0 Ответы
- 17 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Что лучше для динамических запросов String Builder или строкового буфера?
Anonymous » » в форуме JAVA - 0 Ответы
- 14 Просмотры
-
Последнее сообщение Anonymous
-