You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/05/20 11:20:04 UTC
[GitHub] [shardingsphere] menghaoranss opened a new pull request #5713: Initialize heart beat module #control-panel-cluster
menghaoranss opened a new pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713
For #5666 .
Changes proposed in this pull request:
- Init heart beat instance & start heart beat task
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] dongzl commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
dongzl commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r428397179
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/event/HeartBeatDetectNoticeEvent.java
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.event;
+
+/**
+ * Heart beat detect notice event.
+ */
+public final class HeartBeatDetectNoticeEvent extends AbstractHeartBeatEvent{
Review comment:
Need a blank character before `{` at end of line.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking merged pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
kimmking merged pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] dongzl commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
dongzl commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r428396991
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/event/AbstractHeartBeatEvent.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.event;
+
+import lombok.Getter;
+
+/**
+ * Abstract heart beat event.
+ */
+@Getter
+public class AbstractHeartBeatEvent implements HeartBeatEvent{
Review comment:
Need a blank character before `{` at end of line.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] dongzl commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
dongzl commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r428399496
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/task/HeartBeatTaskManager.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.task;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Timer;
+
+/**
+ * Heart beat task manager.
+ */
+public final class HeartBeatTaskManager {
+
+ private static final String TIMER_NAME = "ShardingSphere-Cluster-HeartBeat";
+
+ private Integer interval;
+
+ private final Timer timer;
Review comment:
Is `Executors.newSingleThreadScheduledExecutor()` a good way?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#issuecomment-632150399
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=h1) Report
> Merging [#5713](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=desc) into [master](https://codecov.io/gh/apache/shardingsphere/commit/ce9163b4be008ff40659f8ae4d6de4a5fa7c8c7b&el=desc) will **decrease** coverage by `0.16%`.
> The diff coverage is `44.44%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/5713/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #5713 +/- ##
============================================
- Coverage 53.37% 53.20% -0.17%
- Complexity 428 431 +3
============================================
Files 1160 1168 +8
Lines 20475 20572 +97
Branches 3684 3708 +24
============================================
+ Hits 10928 10945 +17
- Misses 8883 8958 +75
- Partials 664 669 +5
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...r/configuration/config/HeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL2NvbmZpZy9IZWFydEJlYXRDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
| [...configuration/yaml/YamlHeartBeatConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3lhbWwvWWFtbEhlYXJ0QmVhdENvbmZpZ3VyYXRpb24uamF2YQ==) | `100.00% <ø> (ø)` | `1.00 <0.00> (ø)` | |
| [...ngsphere/cluster/heartbeat/task/HeartBeatTask.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC90YXNrL0hlYXJ0QmVhdFRhc2suamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...e/cluster/heartbeat/task/HeartBeatTaskManager.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC90YXNrL0hlYXJ0QmVhdFRhc2tNYW5hZ2VyLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...re/cluster/heartbeat/ClusterHeartBeatInstance.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC9DbHVzdGVySGVhcnRCZWF0SW5zdGFuY2UuamF2YQ==) | `44.44% <44.44%> (ø)` | `1.00 <1.00> (?)` | |
| [.../cluster/heartbeat/eventbus/HeartBeatEventBus.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC9ldmVudGJ1cy9IZWFydEJlYXRFdmVudEJ1cy5qYXZh) | `75.00% <75.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...ation/swapper/ClusterConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItY29uZmlndXJhdGlvbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY2x1c3Rlci9jb25maWd1cmF0aW9uL3N3YXBwZXIvQ2x1c3RlckNvbmZpZ3VyYXRpb25ZYW1sU3dhcHBlci5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (ø)` | |
| [...luster/heartbeat/event/AbstractHeartBeatEvent.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC9ldmVudC9BYnN0cmFjdEhlYXJ0QmVhdEV2ZW50LmphdmE=) | `100.00% <100.00%> (ø)` | `1.00 <1.00> (?)` | |
| [...er/heartbeat/event/HeartBeatDetectNoticeEvent.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC9ldmVudC9IZWFydEJlYXREZXRlY3ROb3RpY2VFdmVudC5qYXZh) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
| [...re/cluster/heartbeat/event/HeartBeatEventType.java](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtY29udHJvbC1wYW5lbC9zaGFyZGluZ3NwaGVyZS1jbHVzdGVyL3NoYXJkaW5nc3BoZXJlLWNsdXN0ZXItaGVhcnRiZWF0L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9jbHVzdGVyL2hlYXJ0YmVhdC9ldmVudC9IZWFydEJlYXRFdmVudFR5cGUuamF2YQ==) | `100.00% <100.00%> (ø)` | `0.00 <0.00> (?)` | |
| ... and [18 more](https://codecov.io/gh/apache/shardingsphere/pull/5713/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=footer). Last update [ce9163b...37beaa5](https://codecov.io/gh/apache/shardingsphere/pull/5713?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] dongzl commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
dongzl commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r428397538
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/task/HeartBeatTaskManager.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.task;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Timer;
+
+/**
+ * Heart beat task manager.
+ */
+public final class HeartBeatTaskManager {
+
+ private static final String TIMER_NAME = "ShardingSphere-Cluster-HeartBeat";
+
+ private Integer interval;
+
+ private final Timer timer;
+
+ public HeartBeatTaskManager(final Integer interval) {
+ this.interval = interval;
+ timer = new Timer(TIMER_NAME);
+ }
+
+ /**
+ * Start heart beat task.
+ *
+ * @param heartBeatTask heart beat task
+ */
+ public void start(final HeartBeatTask heartBeatTask) {
+ Preconditions.checkNotNull(heartBeatTask, "task can not be null");
+ timer.schedule(heartBeatTask, interval*1000, interval*1000);
Review comment:
Need a blank character at `*` left and right.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r428449167
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/task/HeartBeatTaskManager.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.task;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Timer;
+
+/**
+ * Heart beat task manager.
+ */
+public final class HeartBeatTaskManager {
+
+ private static final String TIMER_NAME = "ShardingSphere-Cluster-HeartBeat";
+
+ private Integer interval;
+
+ private final Timer timer;
Review comment:
Yes, threadpool is better, i will fix it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking commented on a change in pull request #5713: Initialize heart beat module #control-panel-cluster
Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #5713:
URL: https://github.com/apache/shardingsphere/pull/5713#discussion_r427933323
##########
File path: shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/org/apache/shardingsphere/cluster/heartbeat/event/AbstractHeartBeatEvent.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.shardingsphere.cluster.heartbeat.event;
+
+import lombok.Getter;
+
+/**
+ * Abstract heart beat event.
+ */
+@Getter
+public class AbstractHeartBeatEvent implements HeartBeatEvent{
Review comment:
miss abstract?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org