Skip to content

Commit

Permalink
[FLINK-23088] Add flink-rpc-core module
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol authored Jun 30, 2021
1 parent 7cf3783 commit 8d9e02c
Show file tree
Hide file tree
Showing 44 changed files with 127 additions and 10 deletions.
50 changes: 50 additions & 0 deletions flink-rpc/flink-rpc-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-rpc</artifactId>
<version>1.14-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>flink-rpc-core</artifactId>
<name>Flink : RPC : Core</name>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-core</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils-junit</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*
* <h1>Endpoint and Gateway</h1>
*
* To be done...
* <p>To be done...
*
* <h1>Single Threaded Endpoint Execution </h1>
*
Expand Down Expand Up @@ -76,8 +76,8 @@
* not serve RPC requests anymore.
* </ul>
*
* The running state can be queried in a RPC method handler or in the main thread by calling {@link
* #isRunning()} method.
* <p>The running state can be queried in a RPC method handler or in the main thread by calling
* {@link #isRunning()} method.
*/
public abstract class RpcEndpoint implements RpcGateway, AutoCloseableAsync {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
package org.apache.flink.runtime.rpc;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.rpc.akka.AkkaRpcSystem;

import javax.annotation.Nullable;

import java.util.ServiceLoader;

/**
* This interface serves as a factory interface for RPC services, with some additional utilities
* that are reliant on implementation details of the RPC service.
Expand Down Expand Up @@ -73,7 +74,8 @@ RpcServiceBuilder withExecutorConfiguration(
* @return loaded RpcSystem
*/
static RpcSystem load() {
return new AkkaRpcSystem();
final ClassLoader classLoader = RpcSystem.class.getClassLoader();
return ServiceLoader.load(RpcSystem.class, classLoader).iterator().next();
}

/** Descriptor for creating a fork-join thread-pool. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import java.util.concurrent.Callable;

/** Message for asynchronous callable invocations */
/** Message for asynchronous callable invocations. */
public final class CallAsync {

private final Callable<?> callable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface RpcInvocation {
String getMethodName() throws IOException, ClassNotFoundException;

/**
* Returns the method's parameter types
* Returns the method's parameter types.
*
* @return Method's parameter types
* @throws IOException if the rpc invocation message is a remote message and could not be
Expand All @@ -49,7 +49,7 @@ public interface RpcInvocation {
Class<?>[] getParameterTypes() throws IOException, ClassNotFoundException;

/**
* Returns the arguments of the remote procedure call
* Returns the arguments of the remote procedure call.
*
* @return Arguments of the remote procedure call
* @throws IOException if the rpc invocation message is a remote message and could not be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import static org.apache.flink.util.Preconditions.checkArgument;
import static org.apache.flink.util.Preconditions.checkNotNull;

/** Message for asynchronous runnable invocations */
/** Message for asynchronous runnable invocations. */
public final class RunAsync {

private final Runnable runnable;

/** The delay after which the runnable should be called */
/** The delay after which the runnable should be called. */
private final long atTimeNanos;

/**
Expand Down
39 changes: 39 additions & 0 deletions flink-rpc/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.flink</groupId>
<artifactId>flink-parent</artifactId>
<version>1.14-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>flink-rpc</artifactId>
<name>Flink : RPC :</name>
<packaging>pom</packaging>

<modules>
<module>flink-rpc-core</module>
</modules>
</project>
6 changes: 6 additions & 0 deletions flink-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ under the License.
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-rpc-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public long getQueryServiceMessageSizeLimit() {
* Create a metric registry configuration object from the given {@link Configuration}.
*
* @param configuration to generate the metric registry configuration from
* @param maximumFrameSize the maximum message size that the RPC system supports
* @return Metric registry configuration generated from the configuration
*/
public static MetricRegistryConfiguration fromConfiguration(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

org.apache.flink.runtime.rpc.akka.AkkaRpcSystem
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ under the License.
<module>flink-java</module>
<module>flink-scala</module>
<module>flink-filesystems</module>
<module>flink-rpc</module>
<module>flink-runtime</module>
<module>flink-runtime-web</module>
<module>flink-optimizer</module>
Expand Down
2 changes: 2 additions & 0 deletions tools/ci/stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ flink-clients,\
flink-core,\
flink-java,\
flink-optimizer,\
flink-rpc,\
flink-rpc/flink-rpc-core,\
flink-runtime,\
flink-runtime-web,\
flink-scala,\
Expand Down

0 comments on commit 8d9e02c

Please sign in to comment.