Java Code Examples for org.apache.flink.api.common.state.StateDescriptor#isQueryable()

The following examples show how to use org.apache.flink.api.common.state.StateDescriptor#isQueryable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractQueryableStateOperator.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public AbstractQueryableStateOperator(
		String registrationName,
		StateDescriptor<? extends S, ?> stateDescriptor) {

	this.registrationName = Preconditions.checkNotNull(registrationName, "Registration name");
	this.stateDescriptor = Preconditions.checkNotNull(stateDescriptor, "State descriptor");

	if (stateDescriptor.isQueryable()) {
		String name = stateDescriptor.getQueryableStateName();
		if (!name.equals(registrationName)) {
			throw new IllegalArgumentException("StateDescriptor already marked as " +
					"queryable with name '" + name + "', but created operator with name '" +
					registrationName + "'.");
		} // else: all good, already registered with same name
	} else {
		stateDescriptor.setQueryable(registrationName);
	}
}
 
Example 2
Source File: AbstractQueryableStateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
public AbstractQueryableStateOperator(
		String registrationName,
		StateDescriptor<? extends S, ?> stateDescriptor) {

	this.registrationName = Preconditions.checkNotNull(registrationName, "Registration name");
	this.stateDescriptor = Preconditions.checkNotNull(stateDescriptor, "State descriptor");

	if (stateDescriptor.isQueryable()) {
		String name = stateDescriptor.getQueryableStateName();
		if (!name.equals(registrationName)) {
			throw new IllegalArgumentException("StateDescriptor already marked as " +
					"queryable with name '" + name + "', but created operator with name '" +
					registrationName + "'.");
		} // else: all good, already registered with same name
	} else {
		stateDescriptor.setQueryable(registrationName);
	}
}
 
Example 3
Source File: AbstractQueryableStateOperator.java    From flink with Apache License 2.0 6 votes vote down vote up
public AbstractQueryableStateOperator(
		String registrationName,
		StateDescriptor<? extends S, ?> stateDescriptor) {

	this.registrationName = Preconditions.checkNotNull(registrationName, "Registration name");
	this.stateDescriptor = Preconditions.checkNotNull(stateDescriptor, "State descriptor");

	if (stateDescriptor.isQueryable()) {
		String name = stateDescriptor.getQueryableStateName();
		if (!name.equals(registrationName)) {
			throw new IllegalArgumentException("StateDescriptor already marked as " +
					"queryable with name '" + name + "', but created operator with name '" +
					registrationName + "'.");
		} // else: all good, already registered with same name
	} else {
		stateDescriptor.setQueryable(registrationName);
	}
}
 
Example 4
Source File: AbstractKeyedStateBackend.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private void publishQueryableStateIfEnabled(
	StateDescriptor<?, ?> stateDescriptor,
	InternalKvState<?, ?, ?> kvState) {
	if (stateDescriptor.isQueryable()) {
		if (kvStateRegistry == null) {
			throw new IllegalStateException("State backend has not been initialized for job.");
		}
		String name = stateDescriptor.getQueryableStateName();
		kvStateRegistry.registerKvState(keyGroupRange, name, kvState);
	}
}
 
Example 5
Source File: AbstractKeyedStateBackend.java    From flink with Apache License 2.0 5 votes vote down vote up
private void publishQueryableStateIfEnabled(
	StateDescriptor<?, ?> stateDescriptor,
	InternalKvState<?, ?, ?> kvState) {
	if (stateDescriptor.isQueryable()) {
		if (kvStateRegistry == null) {
			throw new IllegalStateException("State backend has not been initialized for job.");
		}
		String name = stateDescriptor.getQueryableStateName();
		kvStateRegistry.registerKvState(keyGroupRange, name, kvState);
	}
}
 
Example 6
Source File: AbstractKeyedStateBackend.java    From flink with Apache License 2.0 5 votes vote down vote up
private void publishQueryableStateIfEnabled(
	StateDescriptor<?, ?> stateDescriptor,
	InternalKvState<?, ?, ?> kvState) {
	if (stateDescriptor.isQueryable()) {
		if (kvStateRegistry == null) {
			throw new IllegalStateException("State backend has not been initialized for job.");
		}
		String name = stateDescriptor.getQueryableStateName();
		kvStateRegistry.registerKvState(keyGroupRange, name, kvState);
	}
}