org.apache.flink.queryablestate.network.stats.KvStateRequestStats Java Examples

The following examples show how to use org.apache.flink.queryablestate.network.stats.KvStateRequestStats. 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: AbstractServerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
TestClient(
		String clientName,
		int numEventLoopThreads,
		MessageSerializer<TestMessage, TestMessage> serializer,
		KvStateRequestStats stats) {
	super(clientName, numEventLoopThreads, serializer, stats);
}
 
Example #2
Source File: AbstractServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
AsyncRequestTask(
		final AbstractServerHandler<REQ, RESP> handler,
		final ChannelHandlerContext ctx,
		final long requestId,
		final REQ request,
		final KvStateRequestStats stats) {

	this.handler = Preconditions.checkNotNull(handler);
	this.ctx = Preconditions.checkNotNull(ctx);
	this.requestId = requestId;
	this.request = Preconditions.checkNotNull(request);
	this.stats = Preconditions.checkNotNull(stats);
	this.creationNanos = System.nanoTime();
}
 
Example #3
Source File: AbstractServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler.
 *
 * @param serializer the serializer used to (de-)serialize messages
 * @param stats statistics collector
 */
public AbstractServerHandler(
		final AbstractServerBase<REQ, RESP> server,
		final MessageSerializer<REQ, RESP> serializer,
		final KvStateRequestStats stats) {

	this.server = Preconditions.checkNotNull(server);
	this.serializer = Preconditions.checkNotNull(serializer);
	this.queryExecutor = server.getQueryExecutor();
	this.stats = Preconditions.checkNotNull(stats);
}
 
Example #4
Source File: AbstractServerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
TestClient(
		String clientName,
		int numEventLoopThreads,
		MessageSerializer<TestMessage, TestMessage> serializer,
		KvStateRequestStats stats) {
	super(clientName, numEventLoopThreads, serializer, stats);
}
 
Example #5
Source File: KvStateServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateServerImpl}.
 *
 * @param server the {@link KvStateServerImpl} using the handler.
 * @param kvStateRegistry registry to query.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateServerHandler(
		final KvStateServerImpl server,
		final KvStateRegistry kvStateRegistry,
		final MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(server, serializer, stats);
	this.registry = Preconditions.checkNotNull(kvStateRegistry);
}
 
Example #6
Source File: KvStateClientProxyHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateClientProxyImpl}.
 *
 * @param proxy the {@link KvStateClientProxyImpl proxy} using the handler.
 * @param queryExecutorThreads the number of threads used to process incoming requests.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateClientProxyHandler(
		final KvStateClientProxyImpl proxy,
		final int queryExecutorThreads,
		final MessageSerializer<KvStateRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(proxy, serializer, stats);
	this.proxy = Preconditions.checkNotNull(proxy);
	this.kvStateClient = createInternalClient(queryExecutorThreads);
}
 
Example #7
Source File: AbstractServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
AsyncRequestTask(
		final AbstractServerHandler<REQ, RESP> handler,
		final ChannelHandlerContext ctx,
		final long requestId,
		final REQ request,
		final KvStateRequestStats stats) {

	this.handler = Preconditions.checkNotNull(handler);
	this.ctx = Preconditions.checkNotNull(ctx);
	this.requestId = requestId;
	this.request = Preconditions.checkNotNull(request);
	this.stats = Preconditions.checkNotNull(stats);
	this.creationNanos = System.nanoTime();
}
 
Example #8
Source File: AbstractServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler.
 *
 * @param serializer the serializer used to (de-)serialize messages
 * @param stats statistics collector
 */
public AbstractServerHandler(
		final AbstractServerBase<REQ, RESP> server,
		final MessageSerializer<REQ, RESP> serializer,
		final KvStateRequestStats stats) {

	this.server = Preconditions.checkNotNull(server);
	this.serializer = Preconditions.checkNotNull(serializer);
	this.queryExecutor = server.getQueryExecutor();
	this.stats = Preconditions.checkNotNull(stats);
}
 
Example #9
Source File: KvStateClientProxyHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateClientProxyImpl}.
 *
 * @param proxy the {@link KvStateClientProxyImpl proxy} using the handler.
 * @param queryExecutorThreads the number of threads used to process incoming requests.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateClientProxyHandler(
		final KvStateClientProxyImpl proxy,
		final int queryExecutorThreads,
		final MessageSerializer<KvStateRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(proxy, serializer, stats);
	this.proxy = Preconditions.checkNotNull(proxy);
	this.kvStateClient = createInternalClient(queryExecutorThreads);
}
 
Example #10
Source File: KvStateServerHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateServerImpl}.
 *
 * @param server the {@link KvStateServerImpl} using the handler.
 * @param kvStateRegistry registry to query.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateServerHandler(
		final KvStateServerImpl server,
		final KvStateRegistry kvStateRegistry,
		final MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(server, serializer, stats);
	this.registry = Preconditions.checkNotNull(kvStateRegistry);
}
 
Example #11
Source File: KvStateClientProxyHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateClientProxyImpl}.
 *
 * @param proxy the {@link KvStateClientProxyImpl proxy} using the handler.
 * @param queryExecutorThreads the number of threads used to process incoming requests.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateClientProxyHandler(
		final KvStateClientProxyImpl proxy,
		final int queryExecutorThreads,
		final MessageSerializer<KvStateRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(proxy, serializer, stats);
	this.proxy = Preconditions.checkNotNull(proxy);
	this.kvStateClient = createInternalClient(queryExecutorThreads);
}
 
Example #12
Source File: AbstractServerHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
AsyncRequestTask(
		final AbstractServerHandler<REQ, RESP> handler,
		final ChannelHandlerContext ctx,
		final long requestId,
		final REQ request,
		final KvStateRequestStats stats) {

	this.handler = Preconditions.checkNotNull(handler);
	this.ctx = Preconditions.checkNotNull(ctx);
	this.requestId = requestId;
	this.request = Preconditions.checkNotNull(request);
	this.stats = Preconditions.checkNotNull(stats);
	this.creationNanos = System.nanoTime();
}
 
Example #13
Source File: AbstractServerHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler.
 *
 * @param serializer the serializer used to (de-)serialize messages
 * @param stats statistics collector
 */
public AbstractServerHandler(
		final AbstractServerBase<REQ, RESP> server,
		final MessageSerializer<REQ, RESP> serializer,
		final KvStateRequestStats stats) {

	this.server = Preconditions.checkNotNull(server);
	this.serializer = Preconditions.checkNotNull(serializer);
	this.queryExecutor = server.getQueryExecutor();
	this.stats = Preconditions.checkNotNull(stats);
}
 
Example #14
Source File: AbstractServerTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
TestClient(
		String clientName,
		int numEventLoopThreads,
		MessageSerializer<TestMessage, TestMessage> serializer,
		KvStateRequestStats stats) {
	super(clientName, numEventLoopThreads, serializer, stats);
}
 
Example #15
Source File: KvStateServerHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Create the handler used by the {@link KvStateServerImpl}.
 *
 * @param server the {@link KvStateServerImpl} using the handler.
 * @param kvStateRegistry registry to query.
 * @param serializer the {@link MessageSerializer} used to (de-) serialize the different messages.
 * @param stats server statistics collector.
 */
public KvStateServerHandler(
		final KvStateServerImpl server,
		final KvStateRegistry kvStateRegistry,
		final MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer,
		final KvStateRequestStats stats) {

	super(server, serializer, stats);
	this.registry = Preconditions.checkNotNull(kvStateRegistry);
}
 
Example #16
Source File: AbstractServerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
TestServer(String name, KvStateRequestStats stats, Iterator<Integer> bindPort) throws UnknownHostException {
	super(name, InetAddress.getLocalHost(), bindPort, 1, 1);
	this.requestStats = stats;
}
 
Example #17
Source File: KvStateServerHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Tests that large responses are chunked.
 */
@Test
public void testChunkedResponse() throws Exception {
	KvStateRegistry registry = new KvStateRegistry();
	KvStateRequestStats stats = new AtomicKvStateRequestStats();

	MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer =
			new MessageSerializer<>(new KvStateInternalRequest.KvStateInternalRequestDeserializer(), new KvStateResponse.KvStateResponseDeserializer());

	KvStateServerHandler handler = new KvStateServerHandler(testServer, registry, serializer, stats);
	EmbeddedChannel channel = new EmbeddedChannel(getFrameDecoder(), handler);

	int numKeyGroups = 1;
	AbstractStateBackend abstractBackend = new MemoryStateBackend();
	DummyEnvironment dummyEnv = new DummyEnvironment("test", 1, 0);
	dummyEnv.setKvStateRegistry(registry);
	AbstractKeyedStateBackend<Integer> backend = createKeyedStateBackend(registry, numKeyGroups, abstractBackend, dummyEnv);

	final TestRegistryListener registryListener = new TestRegistryListener();
	registry.registerListener(dummyEnv.getJobID(), registryListener);

	// Register state
	ValueStateDescriptor<byte[]> desc = new ValueStateDescriptor<>("any", BytePrimitiveArraySerializer.INSTANCE);
	desc.setQueryable("vanilla");

	ValueState<byte[]> state = backend.getPartitionedState(
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE,
			desc);

	// Update KvState
	byte[] bytes = new byte[2 * channel.config().getWriteBufferHighWaterMark()];

	byte current = 0;
	for (int i = 0; i < bytes.length; i++) {
		bytes[i] = current++;
	}

	int key = 99812822;
	backend.setCurrentKey(key);
	state.update(bytes);

	// Request
	byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace(
			key,
			IntSerializer.INSTANCE,
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE);

	long requestId = Integer.MAX_VALUE + 182828L;

	assertTrue(registryListener.registrationName.equals("vanilla"));

	KvStateInternalRequest request = new KvStateInternalRequest(registryListener.kvStateId, serializedKeyAndNamespace);
	ByteBuf serRequest = MessageSerializer.serializeRequest(channel.alloc(), requestId, request);

	// Write the request and wait for the response
	channel.writeInbound(serRequest);

	Object msg = readInboundBlocking(channel);
	assertTrue("Not ChunkedByteBuf", msg instanceof ChunkedByteBuf);
}
 
Example #18
Source File: KvStateServerHandlerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
/**
 * Tests that large responses are chunked.
 */
@Test
public void testChunkedResponse() throws Exception {
	KvStateRegistry registry = new KvStateRegistry();
	KvStateRequestStats stats = new AtomicKvStateRequestStats();

	MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer =
			new MessageSerializer<>(new KvStateInternalRequest.KvStateInternalRequestDeserializer(), new KvStateResponse.KvStateResponseDeserializer());

	KvStateServerHandler handler = new KvStateServerHandler(testServer, registry, serializer, stats);
	EmbeddedChannel channel = new EmbeddedChannel(getFrameDecoder(), handler);

	int numKeyGroups = 1;
	AbstractStateBackend abstractBackend = new MemoryStateBackend();
	DummyEnvironment dummyEnv = new DummyEnvironment("test", 1, 0);
	dummyEnv.setKvStateRegistry(registry);
	AbstractKeyedStateBackend<Integer> backend = createKeyedStateBackend(registry, numKeyGroups, abstractBackend, dummyEnv);

	final TestRegistryListener registryListener = new TestRegistryListener();
	registry.registerListener(dummyEnv.getJobID(), registryListener);

	// Register state
	ValueStateDescriptor<byte[]> desc = new ValueStateDescriptor<>("any", BytePrimitiveArraySerializer.INSTANCE);
	desc.setQueryable("vanilla");

	ValueState<byte[]> state = backend.getPartitionedState(
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE,
			desc);

	// Update KvState
	byte[] bytes = new byte[2 * channel.config().getWriteBufferHighWaterMark()];

	byte current = 0;
	for (int i = 0; i < bytes.length; i++) {
		bytes[i] = current++;
	}

	int key = 99812822;
	backend.setCurrentKey(key);
	state.update(bytes);

	// Request
	byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace(
			key,
			IntSerializer.INSTANCE,
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE);

	long requestId = Integer.MAX_VALUE + 182828L;

	assertTrue(registryListener.registrationName.equals("vanilla"));

	KvStateInternalRequest request = new KvStateInternalRequest(registryListener.kvStateId, serializedKeyAndNamespace);
	ByteBuf serRequest = MessageSerializer.serializeRequest(channel.alloc(), requestId, request);

	// Write the request and wait for the response
	channel.writeInbound(serRequest);

	Object msg = readInboundBlocking(channel);
	assertTrue("Not ChunkedByteBuf", msg instanceof ChunkedByteBuf);
}
 
Example #19
Source File: AbstractServerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
TestServer(String name, KvStateRequestStats stats, Iterator<Integer> bindPort) throws UnknownHostException {
	super(name, InetAddress.getLocalHost(), bindPort, 1, 1);
	this.requestStats = stats;
}
 
Example #20
Source File: KvStateServerHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Tests that large responses are chunked.
 */
@Test
public void testChunkedResponse() throws Exception {
	KvStateRegistry registry = new KvStateRegistry();
	KvStateRequestStats stats = new AtomicKvStateRequestStats();

	MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer =
			new MessageSerializer<>(new KvStateInternalRequest.KvStateInternalRequestDeserializer(), new KvStateResponse.KvStateResponseDeserializer());

	KvStateServerHandler handler = new KvStateServerHandler(testServer, registry, serializer, stats);
	EmbeddedChannel channel = new EmbeddedChannel(getFrameDecoder(), handler);

	int numKeyGroups = 1;
	AbstractStateBackend abstractBackend = new MemoryStateBackend();
	DummyEnvironment dummyEnv = new DummyEnvironment("test", 1, 0);
	dummyEnv.setKvStateRegistry(registry);
	AbstractKeyedStateBackend<Integer> backend = createKeyedStateBackend(registry, numKeyGroups, abstractBackend, dummyEnv);

	final TestRegistryListener registryListener = new TestRegistryListener();
	registry.registerListener(dummyEnv.getJobID(), registryListener);

	// Register state
	ValueStateDescriptor<byte[]> desc = new ValueStateDescriptor<>("any", BytePrimitiveArraySerializer.INSTANCE);
	desc.setQueryable("vanilla");

	ValueState<byte[]> state = backend.getPartitionedState(
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE,
			desc);

	// Update KvState
	byte[] bytes = new byte[2 * channel.config().getWriteBufferHighWaterMark()];

	byte current = 0;
	for (int i = 0; i < bytes.length; i++) {
		bytes[i] = current++;
	}

	int key = 99812822;
	backend.setCurrentKey(key);
	state.update(bytes);

	// Request
	byte[] serializedKeyAndNamespace = KvStateSerializer.serializeKeyAndNamespace(
			key,
			IntSerializer.INSTANCE,
			VoidNamespace.INSTANCE,
			VoidNamespaceSerializer.INSTANCE);

	long requestId = Integer.MAX_VALUE + 182828L;

	assertTrue(registryListener.registrationName.equals("vanilla"));

	KvStateInternalRequest request = new KvStateInternalRequest(registryListener.kvStateId, serializedKeyAndNamespace);
	ByteBuf serRequest = MessageSerializer.serializeRequest(channel.alloc(), requestId, request);

	// Write the request and wait for the response
	channel.writeInbound(serRequest);

	Object msg = readInboundBlocking(channel);
	assertTrue("Not ChunkedByteBuf", msg instanceof ChunkedByteBuf);
	((ChunkedByteBuf) msg).close();
}
 
Example #21
Source File: AbstractServerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
TestServer(String name, KvStateRequestStats stats, Iterator<Integer> bindPort) throws UnknownHostException {
	super(name, InetAddress.getLocalHost().getHostName(), bindPort, 1, 1);
	this.requestStats = stats;
}
 
Example #22
Source File: KvStateClientProxyImpl.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the Queryable State Client Proxy.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)
 * QueryableStateUtils.createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param stats the statistics collector.
 */
public KvStateClientProxyImpl(
		final InetAddress bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRequestStats stats) {

	super("Queryable State Proxy Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	Preconditions.checkArgument(numQueryThreads >= 1, "Non-positive number of query threads.");
	this.queryExecutorThreads = numQueryThreads;
	this.stats = Preconditions.checkNotNull(stats);

	this.kvStateLocationOracles = new ConcurrentHashMap<>(4);
}
 
Example #23
Source File: KvStateClientProxyImpl.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the Queryable State Client Proxy.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)
 * QueryableStateUtils.createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param stats the statistics collector.
 */
public KvStateClientProxyImpl(
		final InetAddress bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRequestStats stats) {

	super("Queryable State Proxy Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	Preconditions.checkArgument(numQueryThreads >= 1, "Non-positive number of query threads.");
	this.queryExecutorThreads = numQueryThreads;
	this.stats = Preconditions.checkNotNull(stats);

	this.kvStateLocationOracles = new ConcurrentHashMap<>(4);
}
 
Example #24
Source File: KvStateServerImpl.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the state server.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateServer(InetAddress, Iterator, int, int, KvStateRegistry, KvStateRequestStats)
 * QueryableStateUtils.createKvStateServer(InetAddress, Iterator, int, int, KvStateRegistry, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param kvStateRegistry {@link KvStateRegistry} to query for state instances.
 * @param stats the statistics collector.
 */
public KvStateServerImpl(
		final InetAddress bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRegistry kvStateRegistry,
		final KvStateRequestStats stats) {

	super("Queryable State Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	this.stats = Preconditions.checkNotNull(stats);
	this.kvStateRegistry = Preconditions.checkNotNull(kvStateRegistry);
}
 
Example #25
Source File: KvStateServerImpl.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the state server.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateServer(String, Iterator, int, int, KvStateRegistry, KvStateRequestStats)
 * QueryableStateUtils.createKvStateServer(InetAddress, Iterator, int, int, KvStateRegistry, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param kvStateRegistry {@link KvStateRegistry} to query for state instances.
 * @param stats the statistics collector.
 */
public KvStateServerImpl(
		final String bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRegistry kvStateRegistry,
		final KvStateRequestStats stats) {

	super("Queryable State Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	this.stats = Preconditions.checkNotNull(stats);
	this.kvStateRegistry = Preconditions.checkNotNull(kvStateRegistry);
}
 
Example #26
Source File: KvStateClientProxyImpl.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the Queryable State Client Proxy.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateClientProxy(String, Iterator, int, int, KvStateRequestStats)
 * QueryableStateUtils.createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param stats the statistics collector.
 */
public KvStateClientProxyImpl(
		final String bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRequestStats stats) {

	super("Queryable State Proxy Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	Preconditions.checkArgument(numQueryThreads >= 1, "Non-positive number of query threads.");
	this.queryExecutorThreads = numQueryThreads;
	this.stats = Preconditions.checkNotNull(stats);

	this.kvStateLocationOracles = new ConcurrentHashMap<>(4);
}
 
Example #27
Source File: KvStateServerImpl.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the state server.
 *
 * <p>The server is instantiated using reflection by the
 * {@link org.apache.flink.runtime.query.QueryableStateUtils#createKvStateServer(InetAddress, Iterator, int, int, KvStateRegistry, KvStateRequestStats)
 * QueryableStateUtils.createKvStateServer(InetAddress, Iterator, int, int, KvStateRegistry, KvStateRequestStats)}.
 *
 * <p>The server needs to be started via {@link #start()} in order to bind
 * to the configured bind address.
 *
 * @param bindAddress the address to listen to.
 * @param bindPortIterator the port range to try to bind to.
 * @param numEventLoopThreads number of event loop threads.
 * @param numQueryThreads number of query threads.
 * @param kvStateRegistry {@link KvStateRegistry} to query for state instances.
 * @param stats the statistics collector.
 */
public KvStateServerImpl(
		final InetAddress bindAddress,
		final Iterator<Integer> bindPortIterator,
		final Integer numEventLoopThreads,
		final Integer numQueryThreads,
		final KvStateRegistry kvStateRegistry,
		final KvStateRequestStats stats) {

	super("Queryable State Server", bindAddress, bindPortIterator, numEventLoopThreads, numQueryThreads);
	this.stats = Preconditions.checkNotNull(stats);
	this.kvStateRegistry = Preconditions.checkNotNull(kvStateRegistry);
}