Как будет работать одновременная замена строкового буфера в Java? [закрыто]JAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Как будет работать одновременная замена строкового буфера в Java? [закрыто]

Сообщение Anonymous »


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
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»