Skip to content

Commit 2a9ed13

Browse files
authored
Add generated files to .gitignore (temporalio#195)
* Add generated files to .gitignore * Update HelloPeriodic.java formatting
1 parent 463a938 commit 2a9ed13

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ target
77
.gradle
88
/build
99
/out
10+
.classpath
11+
.project
12+
.settings/
13+
bin/

src/main/java/io/temporal/samples/hello/HelloPeriodic.java

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,29 @@ public void greetPeriodically(String name) {
146146
for (int i = 0; i < SINGLE_WORKFLOW_ITERATIONS; i++) {
147147

148148
// Compute the timing of the next iteration:
149-
int delayMillis = (SCHEDULE_PERIOD_TARGET_SECS * 1000)
150-
+ random.nextInt(SCHEDULE_PERIOD_VARIATION_SECS * 1000)
151-
- (SCHEDULE_PERIOD_VARIATION_SECS * 500);
149+
int delayMillis =
150+
(SCHEDULE_PERIOD_TARGET_SECS * 1000)
151+
+ random.nextInt(SCHEDULE_PERIOD_VARIATION_SECS * 1000)
152+
- (SCHEDULE_PERIOD_VARIATION_SECS * 500);
152153

153154
// Perform some useful work. In this example, we execute a greeting activity:
154-
activities.greet("Hello " + name + "!"
155-
+ " I will sleep for " + delayMillis + " milliseconds and then I will greet you again.");
155+
activities.greet(
156+
"Hello "
157+
+ name
158+
+ "!"
159+
+ " I will sleep for "
160+
+ delayMillis
161+
+ " milliseconds and then I will greet you again.");
156162

157163
// Sleep for the required time period or until an exit signal is received:
158164
Workflow.await(Duration.ofMillis(delayMillis), () -> exitRequested);
159165

160166
if (exitRequested) {
161-
activities.greet("Hello " + name + "!"
162-
+ " It was requested to quit the periodic greetings, so this the last one.");
167+
activities.greet(
168+
"Hello "
169+
+ name
170+
+ "!"
171+
+ " It was requested to quit the periodic greetings, so this the last one.");
163172
return;
164173
}
165174
}
@@ -180,15 +189,17 @@ public void greetPeriodically(String name) {
180189
static class GreetingActivitiesImpl implements GreetingActivities {
181190
@Override
182191
public void greet(String greeting) {
183-
System.out.println("From " + Activity.getExecutionContext().getInfo().getWorkflowId() + ": " + greeting);
192+
System.out.println(
193+
"From " + Activity.getExecutionContext().getInfo().getWorkflowId() + ": " + greeting);
184194
}
185195
}
186196

187197
/**
188198
* With our Workflow and Activities defined, we can now start execution. The main method starts
189199
* the worker and then the workflow.
190200
*/
191-
@SuppressWarnings("CatchAndPrintStackTrace") // in this simple example advanced error logging is not required
201+
@SuppressWarnings(
202+
"CatchAndPrintStackTrace") // in this simple example advanced error logging is not required
192203
public static void main(String[] args) throws InterruptedException {
193204

194205
// Define the workflow service.
@@ -250,9 +261,11 @@ public static void main(String[] args) throws InterruptedException {
250261
System.out.println("Connected to an existing GreetingWorkflow.");
251262
}
252263

253-
// The workflow is running now. In this example, we pause for a few seconds to observe its output.
264+
// The workflow is running now. In this example, we pause for a few seconds to observe its
265+
// output.
254266
final int ObservationPeriodSecs = 20;
255-
System.out.println("Observing the workflow execution for " + ObservationPeriodSecs + " seconds.");
267+
System.out.println(
268+
"Observing the workflow execution for " + ObservationPeriodSecs + " seconds.");
256269

257270
try {
258271
Thread.sleep(ObservationPeriodSecs * 1000);

0 commit comments

Comments
 (0)