Skip to content

Commit 8168f78

Browse files
rename again
1 parent cd8f340 commit 8168f78

File tree

11 files changed

+91
-84
lines changed

11 files changed

+91
-84
lines changed

temporal-sdk/src/main/java/io/temporal/client/Plugin.java renamed to temporal-sdk/src/main/java/io/temporal/client/ClientPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
* }
6666
* }</pre>
6767
*
68-
* @see io.temporal.worker.Plugin
68+
* @see io.temporal.worker.WorkerPlugin
6969
* @see PluginBase
7070
*/
7171
@Experimental
72-
public interface Plugin extends ClientPluginCallback {
72+
public interface ClientPlugin extends ClientPluginCallback {
7373

7474
/**
7575
* Returns a unique name for this plugin. Used for logging and duplicate detection. Recommended

temporal-sdk/src/main/java/io/temporal/client/WorkflowClientInternalImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ private static WorkflowClientOptions applyClientPluginConfiguration(
787787

788788
WorkflowClientOptions.Builder builder = WorkflowClientOptions.newBuilder(options);
789789
for (Object plugin : plugins) {
790-
if (plugin instanceof Plugin) {
791-
builder = ((Plugin) plugin).configureClient(builder);
790+
if (plugin instanceof ClientPlugin) {
791+
builder = ((ClientPlugin) plugin).configureClient(builder);
792792
}
793793
}
794794
return builder.build();

temporal-sdk/src/main/java/io/temporal/client/WorkflowClientOptions.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ public Builder setQueryRejectCondition(QueryRejectCondition queryRejectCondition
140140
* Sets the plugins to use with this client. Plugins can modify client and worker configuration,
141141
* intercept connection, and wrap execution lifecycle.
142142
*
143-
* <p>Each plugin should implement {@link io.temporal.client.Plugin} and/or {@link
144-
* io.temporal.worker.Plugin}. Plugins that implement both interfaces are automatically
143+
* <p>Each plugin should implement {@link io.temporal.client.ClientPlugin} and/or {@link
144+
* io.temporal.worker.WorkerPlugin}. Plugins that implement both interfaces are automatically
145145
* propagated to workers created from this client.
146146
*
147147
* @param plugins the list of plugins to use (each should implement Plugin)
148148
* @return this builder for chaining
149-
* @see io.temporal.client.Plugin
150-
* @see io.temporal.worker.Plugin
149+
* @see io.temporal.client.ClientPlugin
150+
* @see io.temporal.worker.WorkerPlugin
151151
*/
152152
@Experimental
153153
public Builder setPlugins(List<?> plugins) {
@@ -159,14 +159,14 @@ public Builder setPlugins(List<?> plugins) {
159159
* Adds a plugin to use with this client. Plugins can modify client and worker configuration,
160160
* intercept connection, and wrap execution lifecycle.
161161
*
162-
* <p>The plugin should implement {@link io.temporal.client.Plugin} and/or {@link
163-
* io.temporal.worker.Plugin}. Plugins that implement both interfaces are automatically
162+
* <p>The plugin should implement {@link io.temporal.client.ClientPlugin} and/or {@link
163+
* io.temporal.worker.WorkerPlugin}. Plugins that implement both interfaces are automatically
164164
* propagated to workers created from this client.
165165
*
166166
* @param plugin the plugin to add (should implement Plugin)
167167
* @return this builder for chaining
168-
* @see io.temporal.client.Plugin
169-
* @see io.temporal.worker.Plugin
168+
* @see io.temporal.client.ClientPlugin
169+
* @see io.temporal.worker.WorkerPlugin
170170
*/
171171
@Experimental
172172
public Builder addPlugin(Object plugin) {
@@ -292,9 +292,9 @@ public QueryRejectCondition getQueryRejectCondition() {
292292
/**
293293
* Returns the list of plugins configured for this client.
294294
*
295-
* <p>Each plugin implements {@link io.temporal.client.Plugin} and/or {@link
296-
* io.temporal.worker.Plugin}. Plugins that implement both interfaces are automatically propagated
297-
* to workers created from this client.
295+
* <p>Each plugin implements {@link io.temporal.client.ClientPlugin} and/or {@link
296+
* io.temporal.worker.WorkerPlugin}. Plugins that implement both interfaces are automatically
297+
* propagated to workers created from this client.
298298
*
299299
* @return an unmodifiable list of plugins, never null
300300
*/

temporal-sdk/src/main/java/io/temporal/common/PluginBase.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
package io.temporal.common;
2222

23-
import io.temporal.client.Plugin;
23+
import io.temporal.client.ClientPlugin;
2424
import java.util.Objects;
2525
import javax.annotation.Nonnull;
2626

2727
/**
28-
* Convenience base class for plugins that implement both {@link io.temporal.client.Plugin} and
29-
* {@link io.temporal.worker.Plugin}. All methods have default no-op implementations.
28+
* Convenience base class for plugins that implement both {@link io.temporal.client.ClientPlugin}
29+
* and {@link io.temporal.worker.WorkerPlugin}. All methods have default no-op implementations.
3030
*
3131
* <p>This is the recommended way to create plugins that need to customize both client and worker
3232
* behavior. Plugins that extend this class will automatically be propagated from the client to
@@ -59,11 +59,11 @@
5959
* }
6060
* }</pre>
6161
*
62-
* @see io.temporal.client.Plugin
63-
* @see io.temporal.worker.Plugin
62+
* @see io.temporal.client.ClientPlugin
63+
* @see io.temporal.worker.WorkerPlugin
6464
*/
6565
@Experimental
66-
public abstract class PluginBase implements Plugin, io.temporal.worker.Plugin {
66+
public abstract class PluginBase implements ClientPlugin, io.temporal.worker.WorkerPlugin {
6767

6868
private final String name;
6969

temporal-sdk/src/main/java/io/temporal/common/SimplePluginBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* <p>This builder provides a declarative way to create plugins for common use cases without
4343
* subclassing {@link PluginBase}. The resulting plugin implements both {@link
44-
* io.temporal.client.Plugin} and {@link io.temporal.worker.Plugin}.
44+
* io.temporal.client.ClientPlugin} and {@link io.temporal.worker.WorkerPlugin}.
4545
*
4646
* <p>Example:
4747
*
@@ -58,8 +58,8 @@
5858
* }</pre>
5959
*
6060
* @see PluginBase
61-
* @see io.temporal.client.Plugin
62-
* @see io.temporal.worker.Plugin
61+
* @see io.temporal.client.ClientPlugin
62+
* @see io.temporal.worker.WorkerPlugin
6363
*/
6464
@Experimental
6565
public final class SimplePluginBuilder {
@@ -258,8 +258,8 @@ public SimplePluginBuilder addContextPropagators(ContextPropagator... propagator
258258
/**
259259
* Builds the plugin with the configured settings.
260260
*
261-
* @return a new plugin instance that implements both {@link io.temporal.client.Plugin} and {@link
262-
* io.temporal.worker.Plugin}
261+
* @return a new plugin instance that implements both {@link io.temporal.client.ClientPlugin} and
262+
* {@link io.temporal.worker.WorkerPlugin}
263263
*/
264264
public PluginBase build() {
265265
return new SimplePlugin(

temporal-sdk/src/main/java/io/temporal/worker/WorkerFactory.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ public synchronized Worker newWorker(String taskQueue, WorkerOptions options) {
172172
// Go through the plugins to call plugin initializeWorker hooks (e.g. register workflows,
173173
// activities, etc.)
174174
for (Object plugin : plugins) {
175-
if (plugin instanceof Plugin) {
176-
((Plugin) plugin).initializeWorker(taskQueue, worker);
175+
if (plugin instanceof WorkerPlugin) {
176+
((WorkerPlugin) plugin).initializeWorker(taskQueue, worker);
177177
}
178178
}
179179

@@ -240,9 +240,9 @@ public synchronized void start() {
240240
List<Object> reversed = new ArrayList<>(plugins);
241241
Collections.reverse(reversed);
242242
for (Object plugin : reversed) {
243-
if (plugin instanceof Plugin) {
243+
if (plugin instanceof WorkerPlugin) {
244244
final Runnable next = startChain;
245-
final Plugin workerPlugin = (Plugin) plugin;
245+
final WorkerPlugin workerPlugin = (WorkerPlugin) plugin;
246246
startChain =
247247
() -> {
248248
try {
@@ -273,9 +273,9 @@ private void doStart() {
273273
List<Object> reversed = new ArrayList<>(plugins);
274274
Collections.reverse(reversed);
275275
for (Object plugin : reversed) {
276-
if (plugin instanceof Plugin) {
276+
if (plugin instanceof WorkerPlugin) {
277277
final Runnable next = startChain;
278-
final Plugin workerPlugin = (Plugin) plugin;
278+
final WorkerPlugin workerPlugin = (WorkerPlugin) plugin;
279279
startChain =
280280
() -> {
281281
try {
@@ -375,9 +375,9 @@ private void shutdownInternal(boolean interruptUserTasks) {
375375
List<Object> reversed = new ArrayList<>(plugins);
376376
Collections.reverse(reversed);
377377
for (Object plugin : reversed) {
378-
if (plugin instanceof Plugin) {
378+
if (plugin instanceof WorkerPlugin) {
379379
final Runnable next = shutdownChain;
380-
final Plugin workerPlugin = (Plugin) plugin;
380+
final WorkerPlugin workerPlugin = (WorkerPlugin) plugin;
381381
shutdownChain =
382382
() -> {
383383
try {
@@ -416,9 +416,9 @@ private void doShutdown(boolean interruptUserTasks) {
416416
List<Object> reversed = new ArrayList<>(plugins);
417417
Collections.reverse(reversed);
418418
for (Object plugin : reversed) {
419-
if (plugin instanceof Plugin) {
419+
if (plugin instanceof WorkerPlugin) {
420420
final Runnable next = shutdownChain;
421-
final Plugin workerPlugin = (Plugin) plugin;
421+
final WorkerPlugin workerPlugin = (WorkerPlugin) plugin;
422422
shutdownChain =
423423
() -> {
424424
try {
@@ -522,7 +522,7 @@ private static List<Object> extractWorkerPlugins(List<?> clientPlugins) {
522522

523523
List<Object> workerPlugins = new ArrayList<>();
524524
for (Object plugin : clientPlugins) {
525-
if (plugin instanceof Plugin) {
525+
if (plugin instanceof WorkerPlugin) {
526526
workerPlugins.add(plugin);
527527
}
528528
}
@@ -545,8 +545,8 @@ private static WorkerFactoryOptions applyPluginConfiguration(
545545
: WorkerFactoryOptions.newBuilder(options);
546546

547547
for (Object plugin : plugins) {
548-
if (plugin instanceof Plugin) {
549-
builder = ((Plugin) plugin).configureWorkerFactory(builder);
548+
if (plugin instanceof WorkerPlugin) {
549+
builder = ((WorkerPlugin) plugin).configureWorkerFactory(builder);
550550
}
551551
}
552552
return builder.build();
@@ -566,8 +566,8 @@ private static WorkerOptions applyWorkerPluginConfiguration(
566566
options == null ? WorkerOptions.newBuilder() : WorkerOptions.newBuilder(options);
567567

568568
for (Object plugin : plugins) {
569-
if (plugin instanceof Plugin) {
570-
builder = ((Plugin) plugin).configureWorker(taskQueue, builder);
569+
if (plugin instanceof WorkerPlugin) {
570+
builder = ((WorkerPlugin) plugin).configureWorker(taskQueue, builder);
571571
}
572572
}
573573
return builder.build();

temporal-sdk/src/main/java/io/temporal/worker/Plugin.java renamed to temporal-sdk/src/main/java/io/temporal/worker/WorkerPlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
/**
2828
* Plugin interface for customizing Temporal worker configuration and lifecycle.
2929
*
30-
* <p>Plugins that also implement {@link io.temporal.client.Plugin} are automatically propagated
31-
* from the client to workers created from that client.
30+
* <p>Plugins that also implement {@link io.temporal.client.ClientPlugin} are automatically
31+
* propagated from the client to workers created from that client.
3232
*
3333
* <p>Example implementation:
3434
*
@@ -59,11 +59,11 @@
5959
* }
6060
* }</pre>
6161
*
62-
* @see io.temporal.client.Plugin
62+
* @see io.temporal.client.ClientPlugin
6363
* @see PluginBase
6464
*/
6565
@Experimental
66-
public interface Plugin {
66+
public interface WorkerPlugin {
6767

6868
/**
6969
* Returns a unique name for this plugin. Used for logging and duplicate detection. Recommended

temporal-sdk/src/test/java/io/temporal/client/WorkflowClientOptionsPluginTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public void testSetPlugins() {
4545

4646
List<?> plugins = options.getPlugins();
4747
assertEquals(2, plugins.size());
48-
assertEquals("plugin1", ((Plugin) plugins.get(0)).getName());
49-
assertEquals("plugin2", ((Plugin) plugins.get(1)).getName());
48+
assertEquals("plugin1", ((ClientPlugin) plugins.get(0)).getName());
49+
assertEquals("plugin2", ((ClientPlugin) plugins.get(1)).getName());
5050
}
5151

5252
@Test
@@ -59,8 +59,8 @@ public void testAddPlugin() {
5959

6060
List<?> plugins = options.getPlugins();
6161
assertEquals(2, plugins.size());
62-
assertEquals("plugin1", ((Plugin) plugins.get(0)).getName());
63-
assertEquals("plugin2", ((Plugin) plugins.get(1)).getName());
62+
assertEquals("plugin1", ((ClientPlugin) plugins.get(0)).getName());
63+
assertEquals("plugin2", ((ClientPlugin) plugins.get(1)).getName());
6464
}
6565

6666
@Test
@@ -99,7 +99,7 @@ public void testToBuilder() {
9999
WorkflowClientOptions copy = original.toBuilder().build();
100100

101101
assertEquals(1, copy.getPlugins().size());
102-
assertEquals("plugin", ((Plugin) copy.getPlugins().get(0)).getName());
102+
assertEquals("plugin", ((ClientPlugin) copy.getPlugins().get(0)).getName());
103103
}
104104

105105
@Test
@@ -110,7 +110,7 @@ public void testValidateAndBuildWithDefaults() {
110110
WorkflowClientOptions.newBuilder().addPlugin(plugin).validateAndBuildWithDefaults();
111111

112112
assertEquals(1, options.getPlugins().size());
113-
assertEquals("plugin", ((Plugin) options.getPlugins().get(0)).getName());
113+
assertEquals("plugin", ((ClientPlugin) options.getPlugins().get(0)).getName());
114114
}
115115

116116
@Test

temporal-sdk/src/test/java/io/temporal/common/PluginTest.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public void testPluginBaseNullName() {
5858

5959
@Test
6060
public void testClientPluginDefaultMethods() throws Exception {
61-
io.temporal.client.Plugin plugin =
62-
new io.temporal.client.Plugin() {
61+
io.temporal.client.ClientPlugin plugin =
62+
new io.temporal.client.ClientPlugin() {
6363
@Override
6464
public String getName() {
6565
return "test";
@@ -77,8 +77,8 @@ public String getName() {
7777

7878
@Test
7979
public void testWorkerPluginDefaultMethods() throws Exception {
80-
io.temporal.worker.Plugin plugin =
81-
new io.temporal.worker.Plugin() {
80+
io.temporal.worker.WorkerPlugin plugin =
81+
new io.temporal.worker.WorkerPlugin() {
8282
@Override
8383
public String getName() {
8484
return "test";
@@ -125,8 +125,8 @@ public void testConfigurationPhaseOrder() {
125125
// Simulate configuration phase (forward order)
126126
WorkflowClientOptions.Builder builder = WorkflowClientOptions.newBuilder();
127127
for (Object plugin : plugins) {
128-
if (plugin instanceof io.temporal.client.Plugin) {
129-
builder = ((io.temporal.client.Plugin) plugin).configureClient(builder);
128+
if (plugin instanceof io.temporal.client.ClientPlugin) {
129+
builder = ((io.temporal.client.ClientPlugin) plugin).configureClient(builder);
130130
}
131131
}
132132

@@ -153,9 +153,10 @@ public void testExecutionPhaseReverseOrder() throws Exception {
153153
List<Object> reversed = new ArrayList<>(plugins);
154154
java.util.Collections.reverse(reversed);
155155
for (Object plugin : reversed) {
156-
if (plugin instanceof io.temporal.worker.Plugin) {
156+
if (plugin instanceof io.temporal.worker.WorkerPlugin) {
157157
final Runnable next = chain;
158-
final io.temporal.worker.Plugin workerPlugin = (io.temporal.worker.Plugin) plugin;
158+
final io.temporal.worker.WorkerPlugin workerPlugin =
159+
(io.temporal.worker.WorkerPlugin) plugin;
159160
chain =
160161
() -> {
161162
order.add(workerPlugin.getName() + "-before");
@@ -195,9 +196,10 @@ public void testStartWorkerReverseOrder() throws Exception {
195196
List<Object> reversed = new ArrayList<>(plugins);
196197
java.util.Collections.reverse(reversed);
197198
for (Object plugin : reversed) {
198-
if (plugin instanceof io.temporal.worker.Plugin) {
199+
if (plugin instanceof io.temporal.worker.WorkerPlugin) {
199200
final Runnable next = chain;
200-
final io.temporal.worker.Plugin workerPlugin = (io.temporal.worker.Plugin) plugin;
201+
final io.temporal.worker.WorkerPlugin workerPlugin =
202+
(io.temporal.worker.WorkerPlugin) plugin;
201203
chain =
202204
() -> {
203205
order.add(workerPlugin.getName() + "-startWorker-before");
@@ -242,9 +244,10 @@ public void testShutdownWorkerReverseOrder() {
242244
List<Object> reversed = new ArrayList<>(plugins);
243245
java.util.Collections.reverse(reversed);
244246
for (Object plugin : reversed) {
245-
if (plugin instanceof io.temporal.worker.Plugin) {
247+
if (plugin instanceof io.temporal.worker.WorkerPlugin) {
246248
final Runnable next = chain;
247-
final io.temporal.worker.Plugin workerPlugin = (io.temporal.worker.Plugin) plugin;
249+
final io.temporal.worker.WorkerPlugin workerPlugin =
250+
(io.temporal.worker.WorkerPlugin) plugin;
248251
chain =
249252
() -> {
250253
order.add(workerPlugin.getName() + "-shutdownWorker-before");
@@ -276,9 +279,11 @@ public void testPluginBaseImplementsBothInterfaces() {
276279
};
277280

278281
assertTrue(
279-
"PluginBase should implement client Plugin", plugin instanceof io.temporal.client.Plugin);
282+
"PluginBase should implement client Plugin",
283+
plugin instanceof io.temporal.client.ClientPlugin);
280284
assertTrue(
281-
"PluginBase should implement worker Plugin", plugin instanceof io.temporal.worker.Plugin);
285+
"PluginBase should implement worker Plugin",
286+
plugin instanceof io.temporal.worker.WorkerPlugin);
282287
}
283288

284289
private PluginBase createTrackingPlugin(String name, List<String> order) {

0 commit comments

Comments
 (0)