Skip to content

Commit 8be0486

Browse files
committed
Add lint and format all the files
Signed-off-by: Maayan Shani <maayan.shani@mail.huji.ac.il>
1 parent e8b322b commit 8be0486

File tree

1,050 files changed

+216758
-197679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,050 files changed

+216758
-197679
lines changed

.github/workflows/lint.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Java Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-*
8+
pull_request:
9+
branches:
10+
- main
11+
- release-*
12+
workflow_dispatch:
13+
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up JDK
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: 17
27+
distribution: "temurin"
28+
cache: "maven"
29+
30+
- name: Run Spotless Check
31+
run: ./mvnw spotless:check

examples/boot-telemetry/src/main/java/example/boottelemetry/SpringBootTelemetryExample.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
import org.springframework.boot.autoconfigure.SpringBootApplication;
88

99
/**
10-
* Minimal Spring Boot example that demonstrates OpenTelemetry integration
11-
* with Valkey-GLIDE via {@link StringValkeyTemplate}.
10+
* Minimal Spring Boot example that demonstrates OpenTelemetry integration with Valkey-GLIDE via
11+
* {@link StringValkeyTemplate}.
1212
*
13-
* <p>This example exists to verify and showcase that Valkey commands executed
14-
* through Spring Data Valkey automatically emit OpenTelemetry signals when
15-
* OpenTelemetry is enabled via application properties.</p>
13+
* <p>This example exists to verify and showcase that Valkey commands executed through Spring Data
14+
* Valkey automatically emit OpenTelemetry signals when OpenTelemetry is enabled via application
15+
* properties.
1616
*
17-
* <p>Telemetry is emitted while the application runs and Valkey commands are
18-
* executed. Traces can be inspected via the configured OpenTelemetry backend,
19-
* for example by viewing the collector logs:</p>
17+
* <p>Telemetry is emitted while the application runs and Valkey commands are executed. Traces can
18+
* be inspected via the configured OpenTelemetry backend, for example by viewing the collector logs:
2019
*
2120
* <pre>
2221
* docker logs -f boot-telemetry-otel-collector-1
@@ -25,8 +24,7 @@
2524
@SpringBootApplication
2625
public class SpringBootTelemetryExample implements CommandLineRunner {
2726

28-
@Autowired
29-
private StringValkeyTemplate valkeyTemplate;
27+
@Autowired private StringValkeyTemplate valkeyTemplate;
3028

3129
public static void main(String[] args) {
3230
SpringApplication.run(SpringBootTelemetryExample.class, args);

examples/cache/src/main/java/example/cache/CacheExample.java

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,79 +18,77 @@
1818
import io.valkey.springframework.data.valkey.cache.ValkeyCacheConfiguration;
1919
import io.valkey.springframework.data.valkey.cache.ValkeyCacheManager;
2020
import io.valkey.springframework.data.valkey.connection.valkeyglide.ValkeyGlideConnectionFactory;
21+
import java.time.Duration;
2122
import org.springframework.cache.annotation.Cacheable;
2223
import org.springframework.cache.annotation.EnableCaching;
2324
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
2425
import org.springframework.context.annotation.Bean;
2526
import org.springframework.context.annotation.Configuration;
2627
import org.springframework.stereotype.Service;
2728

28-
import java.time.Duration;
29-
30-
/**
31-
* Example demonstrating Spring Cache abstraction with Valkey.
32-
*/
29+
/** Example demonstrating Spring Cache abstraction with Valkey. */
3330
public class CacheExample {
3431

35-
public static void main(String[] args) {
32+
public static void main(String[] args) {
3633

37-
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Config.class);
38-
UserService userService = context.getBean(UserService.class);
34+
AnnotationConfigApplicationContext context =
35+
new AnnotationConfigApplicationContext(Config.class);
36+
UserService userService = context.getBean(UserService.class);
3937

40-
System.out.println("First call (cache miss):");
41-
long start = System.currentTimeMillis();
42-
System.out.println(userService.getUserById("1"));
43-
System.out.println("Time: " + (System.currentTimeMillis() - start) + "ms");
38+
System.out.println("First call (cache miss):");
39+
long start = System.currentTimeMillis();
40+
System.out.println(userService.getUserById("1"));
41+
System.out.println("Time: " + (System.currentTimeMillis() - start) + "ms");
4442

45-
System.out.println("\nSecond call (cache hit):");
46-
start = System.currentTimeMillis();
47-
System.out.println(userService.getUserById("1"));
48-
System.out.println("Time: " + (System.currentTimeMillis() - start) + "ms");
43+
System.out.println("\nSecond call (cache hit):");
44+
start = System.currentTimeMillis();
45+
System.out.println(userService.getUserById("1"));
46+
System.out.println("Time: " + (System.currentTimeMillis() - start) + "ms");
4947

50-
// Cleanup
51-
context.getBean(ValkeyCacheManager.class).getCacheNames()
52-
.forEach(name -> context.getBean(ValkeyCacheManager.class).getCache(name).clear());
48+
// Cleanup
49+
context
50+
.getBean(ValkeyCacheManager.class)
51+
.getCacheNames()
52+
.forEach(name -> context.getBean(ValkeyCacheManager.class).getCache(name).clear());
5353

54-
context.close();
55-
}
54+
context.close();
55+
}
5656

57-
@Configuration
58-
@EnableCaching
59-
static class Config {
57+
@Configuration
58+
@EnableCaching
59+
static class Config {
6060

61-
@Bean
62-
public ValkeyGlideConnectionFactory connectionFactory() {
63-
return new ValkeyGlideConnectionFactory();
64-
}
61+
@Bean
62+
public ValkeyGlideConnectionFactory connectionFactory() {
63+
return new ValkeyGlideConnectionFactory();
64+
}
6565

66-
@Bean
67-
public ValkeyCacheManager cacheManager(ValkeyGlideConnectionFactory connectionFactory) {
68-
ValkeyCacheConfiguration config = ValkeyCacheConfiguration.defaultCacheConfig()
69-
.entryTtl(Duration.ofMinutes(10));
70-
return ValkeyCacheManager.builder(connectionFactory)
71-
.cacheDefaults(config)
72-
.build();
73-
}
66+
@Bean
67+
public ValkeyCacheManager cacheManager(ValkeyGlideConnectionFactory connectionFactory) {
68+
ValkeyCacheConfiguration config =
69+
ValkeyCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(10));
70+
return ValkeyCacheManager.builder(connectionFactory).cacheDefaults(config).build();
71+
}
7472

75-
@Bean
76-
public UserService userService() {
77-
return new UserService();
78-
}
79-
}
73+
@Bean
74+
public UserService userService() {
75+
return new UserService();
76+
}
77+
}
8078

81-
@Service
82-
static class UserService {
79+
@Service
80+
static class UserService {
8381

84-
@Cacheable("users")
85-
public String getUserById(String id) {
86-
System.out.println("Fetching user from database...");
87-
// Simulate slow database query
88-
try {
89-
Thread.sleep(100);
90-
} catch (InterruptedException e) {
91-
Thread.currentThread().interrupt();
92-
}
93-
return "User-" + id;
94-
}
95-
}
82+
@Cacheable("users")
83+
public String getUserById(String id) {
84+
System.out.println("Fetching user from database...");
85+
// Simulate slow database query
86+
try {
87+
Thread.sleep(100);
88+
} catch (InterruptedException e) {
89+
Thread.currentThread().interrupt();
90+
}
91+
return "User-" + id;
92+
}
93+
}
9694
}

examples/cluster/src/main/java/example/cluster/ClusterExample.java

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,64 +20,65 @@
2020
import io.valkey.springframework.data.valkey.connection.valkeyglide.ValkeyGlideClientConfiguration;
2121
import io.valkey.springframework.data.valkey.connection.valkeyglide.ValkeyGlideConnectionFactory;
2222
import io.valkey.springframework.data.valkey.core.StringValkeyTemplate;
23-
2423
import java.util.Arrays;
2524
import java.util.List;
2625

27-
/**
28-
* Example demonstrating Spring Data Valkey with a Valkey cluster.
29-
*/
26+
/** Example demonstrating Spring Data Valkey with a Valkey cluster. */
3027
public class ClusterExample {
3128

32-
public static void main(String[] args) {
29+
public static void main(String[] args) {
3330

34-
// Configure cluster nodes (matches Makefile cluster configuration)
35-
ValkeyClusterConfiguration clusterConfig = new ValkeyClusterConfiguration();
36-
List<ValkeyNode> nodes = Arrays.asList(
37-
new ValkeyNode("127.0.0.1", 7379),
38-
new ValkeyNode("127.0.0.1", 7380),
39-
new ValkeyNode("127.0.0.1", 7381),
40-
new ValkeyNode("127.0.0.1", 7382)
41-
);
42-
clusterConfig.setClusterNodes(nodes);
31+
// Configure cluster nodes (matches Makefile cluster configuration)
32+
ValkeyClusterConfiguration clusterConfig = new ValkeyClusterConfiguration();
33+
List<ValkeyNode> nodes =
34+
Arrays.asList(
35+
new ValkeyNode("127.0.0.1", 7379),
36+
new ValkeyNode("127.0.0.1", 7380),
37+
new ValkeyNode("127.0.0.1", 7381),
38+
new ValkeyNode("127.0.0.1", 7382));
39+
clusterConfig.setClusterNodes(nodes);
4340

44-
ValkeyGlideConnectionFactory connectionFactory = new ValkeyGlideConnectionFactory(
45-
clusterConfig, ValkeyGlideClientConfiguration.defaultConfiguration());
46-
connectionFactory.afterPropertiesSet();
47-
System.out.println("Connected to cluster with " + clusterConfig.getClusterNodes().size() + " nodes");
41+
ValkeyGlideConnectionFactory connectionFactory =
42+
new ValkeyGlideConnectionFactory(
43+
clusterConfig, ValkeyGlideClientConfiguration.defaultConfiguration());
44+
connectionFactory.afterPropertiesSet();
45+
System.out.println(
46+
"Connected to cluster with " + clusterConfig.getClusterNodes().size() + " nodes");
4847

49-
try {
50-
StringValkeyTemplate template = new StringValkeyTemplate(connectionFactory);
48+
try {
49+
StringValkeyTemplate template = new StringValkeyTemplate(connectionFactory);
5150

52-
// Use hash tags to keep keys on same cluster node
53-
String key1 = "{user:123}:profile";
54-
String key2 = "{user:123}:settings";
55-
String key3 = "{user:123}:session";
51+
// Use hash tags to keep keys on same cluster node
52+
String key1 = "{user:123}:profile";
53+
String key2 = "{user:123}:settings";
54+
String key3 = "{user:123}:session";
5655

57-
// String operations
58-
template.opsForValue().set(key1, "John Doe");
59-
template.opsForValue().set(key2, "theme=dark,lang=en");
60-
template.opsForValue().set(key3, "active");
56+
// String operations
57+
template.opsForValue().set(key1, "John Doe");
58+
template.opsForValue().set(key2, "theme=dark,lang=en");
59+
template.opsForValue().set(key3, "active");
6160

62-
System.out.println("\nStored user data:");
63-
System.out.println("Profile: " + template.opsForValue().get(key1));
64-
System.out.println("Settings: " + template.opsForValue().get(key2));
65-
System.out.println("Session: " + template.opsForValue().get(key3));
61+
System.out.println("\nStored user data:");
62+
System.out.println("Profile: " + template.opsForValue().get(key1));
63+
System.out.println("Settings: " + template.opsForValue().get(key2));
64+
System.out.println("Session: " + template.opsForValue().get(key3));
6665

67-
// Hash operations
68-
String hashKey = "{user:123}:metadata";
69-
template.opsForHash().put(hashKey, "created", "2025-01-01");
70-
template.opsForHash().put(hashKey, "lastLogin", "2025-01-15");
71-
template.opsForHash().put(hashKey, "loginCount", "42");
66+
// Hash operations
67+
String hashKey = "{user:123}:metadata";
68+
template.opsForHash().put(hashKey, "created", "2025-01-01");
69+
template.opsForHash().put(hashKey, "lastLogin", "2025-01-15");
70+
template.opsForHash().put(hashKey, "loginCount", "42");
7271

73-
System.out.println("\nUser metadata:");
74-
template.opsForHash().entries(hashKey).forEach((field, value) ->
75-
System.out.println(field + ": " + value));
72+
System.out.println("\nUser metadata:");
73+
template
74+
.opsForHash()
75+
.entries(hashKey)
76+
.forEach((field, value) -> System.out.println(field + ": " + value));
7677

77-
// Cleanup
78-
template.delete(Arrays.asList(key1, key2, key3, hashKey));
79-
} finally {
80-
connectionFactory.destroy();
81-
}
82-
}
78+
// Cleanup
79+
template.delete(Arrays.asList(key1, key2, key3, hashKey));
80+
} finally {
81+
connectionFactory.destroy();
82+
}
83+
}
8384
}

0 commit comments

Comments
 (0)