Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-4354] [heartbeat] Implement heartbeat logic between TaskManage…
…r and ResourceManager This closes #3591.
- Loading branch information
1 parent
d20fb09
commit fd90672
Showing
22 changed files
with
640 additions
and
102 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/TestingHeartbeatServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,52 @@ | |||
/* | |||
* 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. | |||
*/ | |||
|
|||
package org.apache.flink.runtime.heartbeat; | |||
|
|||
import org.apache.flink.runtime.clusterframework.types.ResourceID; | |||
import org.apache.flink.runtime.concurrent.ScheduledExecutor; | |||
import org.apache.flink.util.Preconditions; | |||
import org.slf4j.Logger; | |||
|
|||
public class TestingHeartbeatServices extends HeartbeatServices { | |||
|
|||
private final ScheduledExecutor scheduledExecutorToUse; | |||
|
|||
public TestingHeartbeatServices(long heartbeatInterval, long heartbeatTimeout, ScheduledExecutor scheduledExecutorToUse) { | |||
super(heartbeatInterval, heartbeatTimeout); | |||
|
|||
this.scheduledExecutorToUse = Preconditions.checkNotNull(scheduledExecutorToUse); | |||
} | |||
|
|||
@Override | |||
public <I, O> HeartbeatManager<I, O> createHeartbeatManagerSender( | |||
ResourceID resourceId, | |||
HeartbeatListener<I, O> heartbeatListener, | |||
ScheduledExecutor scheduledExecutor, | |||
Logger log) { | |||
|
|||
return new HeartbeatManagerSenderImpl<>( | |||
heartbeatInterval, | |||
heartbeatTimeout, | |||
resourceId, | |||
heartbeatListener, | |||
org.apache.flink.runtime.concurrent.Executors.directExecutor(), | |||
scheduledExecutorToUse, | |||
log); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...e/src/main/java/org/apache/flink/runtime/registration/RegistrationConnectionListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,40 @@ | |||
/* | |||
* 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. | |||
*/ | |||
|
|||
package org.apache.flink.runtime.registration; | |||
|
|||
/** | |||
* Classes which want to be notified about the registration result by the {@link RegisteredRpcConnection} | |||
* have to implement this interface. | |||
*/ | |||
public interface RegistrationConnectionListener<Success extends RegistrationResponse.Success> { | |||
|
|||
/** | |||
* This method is called by the {@link RegisteredRpcConnection} when the registration is success. | |||
* | |||
* @param success The concrete response information for successful registration. | |||
*/ | |||
void onRegistrationSuccess(Success success); | |||
|
|||
/** | |||
* This method is called by the {@link RegisteredRpcConnection} when the registration fails. | |||
* | |||
* @param failure The exception which causes the registration failure. | |||
*/ | |||
void onRegistrationFailure(Throwable failure); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.