Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/java/org/apache/cassandra/concurrent/SEPWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ final class SEPWorker extends AtomicReference<SEPWorker.Work> implements Runnabl

private final AtomicReference<Runnable> currentTask = new AtomicReference<>();

private String lastUsedExecutorName;

SEPWorker(ThreadGroup threadGroup, Long workerId, Work initialState, SharedExecutorPool pool)
{
this.pool = pool;
Expand Down Expand Up @@ -128,8 +130,11 @@ public void run()
assigned = get().assigned;
if (assigned == null)
continue;
if (SET_THREAD_NAME)
if (SET_THREAD_NAME && assigned.name != lastUsedExecutorName) // .equals is not used intentionally
{
Thread.currentThread().setName(assigned.name + workerIdThreadSuffix);
lastUsedExecutorName = assigned.name;
}

task = assigned.tasks.poll();
currentTask.lazySet(task);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public enum CassandraRelevantProperties
*/
SEED_COUNT_WARN_THRESHOLD("cassandra.seed_count_warn_threshold"),
SERIALIZATION_EMPTY_TYPE_NONEMPTY_BEHAVIOR("cassandra.serialization.emptytype.nonempty_behavior"),
SET_SEP_THREAD_NAME("cassandra.set_sep_thread_name", "true"),
SET_SEP_THREAD_NAME("cassandra.set_sep_thread_name", "false"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a hot-prop so it can be toggled via JMX?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, yes, it would cost 1 volatile read but I suppose it is an acceptable cost for this place

SHUTDOWN_ANNOUNCE_DELAY_IN_MS("cassandra.shutdown_announce_in_ms", "2000"),
SIMULATOR_SEED("cassandra.simulator.seed"),
SIMULATOR_STARTED("cassandra.simulator.started"),
Expand Down