Home / Class/ BufferedStartupStep Class — spring-boot Architecture

BufferedStartupStep Class — spring-boot Architecture

Architecture documentation for the BufferedStartupStep class in BufferedStartupStep.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/main/java/org/springframework/boot/context/metrics/buffering/BufferedStartupStep.java lines 40–138

class BufferedStartupStep implements StartupStep {

	private final String name;

	private final long id;

	private final @Nullable BufferedStartupStep parent;

	private final List<Tag> tags = new ArrayList<>();

	private final Consumer<BufferedStartupStep> recorder;

	private final Instant startTime;

	private final AtomicBoolean ended = new AtomicBoolean();

	BufferedStartupStep(@Nullable BufferedStartupStep parent, String name, long id, Instant startTime,
			Consumer<BufferedStartupStep> recorder) {
		this.parent = parent;
		this.name = name;
		this.id = id;
		this.startTime = startTime;
		this.recorder = recorder;
	}

	@Nullable BufferedStartupStep getParent() {
		return this.parent;
	}

	@Override
	public String getName() {
		return this.name;
	}

	@Override
	public long getId() {
		return this.id;
	}

	Instant getStartTime() {
		return this.startTime;
	}

	@Override
	public @Nullable Long getParentId() {
		return (this.parent != null) ? this.parent.getId() : null;
	}

	@Override
	public Tags getTags() {
		return Collections.unmodifiableList(this.tags)::iterator;
	}

	@Override
	public StartupStep tag(String key, Supplier<String> value) {
		return tag(key, value.get());
	}

	@Override
	public StartupStep tag(String key, String value) {
		Assert.state(!this.ended.get(), "StartupStep has already ended.");
		this.tags.add(new DefaultTag(key, value));
		return this;
	}

	@Override
	public void end() {
		this.ended.set(true);
		this.recorder.accept(this);
	}

	boolean isEnded() {
		return this.ended.get();
	}

	static class DefaultTag implements Tag {

		private final String key;

		private final String value;

		DefaultTag(String key, String value) {
			this.key = key;
			this.value = value;
		}

		@Override
		public String getKey() {
			return this.key;
		}

		@Override
		public String getValue() {
			return this.value;
		}

	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free