All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.clustering.server.infinispan.scheduler.ScheduleCommand Maven / Gradle / Ivy

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.clustering.server.infinispan.scheduler;

/**
 * Command that scheduled an entry.
 * @param  the scheduled entry identifier type
 * @param  the scheduled entry metadata type
 * @author Paul Ferraro
 */
public class ScheduleCommand extends AbstractPrimaryOwnerCommand {

	private final M metaData;

	ScheduleCommand(I id) {
		this(id, null);
	}

	ScheduleCommand(I id, M metaData) {
		super(id);
		this.metaData = metaData;
	}

	protected M getMetaData() {
		return this.metaData;
	}

	@Override
	public Void execute(Scheduler scheduler) {
		I id = this.getId();
		if (this.metaData != null) {
			scheduler.schedule(id, this.metaData);
		} else {
			scheduler.schedule(id);
		}
		return null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy