executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
distributed-system-bulkheadsImplements the bulkhead pattern to isolate resources and improve fault tolerance in distributed systems using Resilience4j.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: distributed-system-bulkheads description: Implements the bulkhead pattern to isolate resources and improve fault tolerance in distributed systems using Resilience4j. license: MIT compatibility: opencode metadata: version: "1.0.0" domain: coding triggers: bulkhead, resource isolation, resilience4j, distributed systems role: implementation scope: implementation output-format: code archetypes: tactical anti_triggers: generic, vague, low quality response_profile: verbosity: low directive_strength: high abstraction_level: operational related-skills: distributed-system-rate-limiting, distributed-system-circuit-breakers
The bulkhead pattern helps to prevent cascading failures by isolating services into separate pools, thereby improving fault tolerance and system stability.
A simple implementation of the bulkhead pattern using Resilience4j that isolates service requests.
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.bulkhead.BulkheadConfig;
import java.time.Duration;
public class BulkheadExample {
public static void main(String[] args) {
BulkheadConfig config = BulkheadConfig.custom()
.maxConcurrentCalls(10)
.maxWaitDuration(Duration.ofMillis(100))
.build();
Bulkhead bulkhead = Bulkhead.of("myBulkhead", config);
System.out.println("Bulkhead created: " + bulkhead.getName());
}
}
This advanced example shows how to use the bulkhead pattern to manage thread pools effectively and handle requests with custom handlers for monitoring.
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.bulkhead.BulkheadConfig;
import io.github.resilience4j.bulkhead.BulkheadRegistry;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AdvancedBulkheadExample {
public static void main(String[] args) {
BulkheadRegistry registry = BulkheadRegistry.ofDefaults();
Bulkhead bulkhead = registry.bulkhead("advancedBulkhead");
ExecutorService executorService = Executors.newFixedThreadPool(5);
for (int i = 0; i < 20; i++) {
executorService.execute(Bulkhead.decorateRunnable(bulkhead, () -> {
// Simulated service call
System.out.println("Service call executed!");
}));
}
executorService.shutdown();
}
}
Authoritative documentation links for this domain. The model follows markdown links at load time to resolve external references and inline content.