Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DUBBO-3137]: move MetadataReportConstants back into metata-report-api module #4049

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,24 +180,6 @@ public class Constants {
public static final String ACCEPT_FOREIGN_IP = "qos.accept.foreign.ip";
// END dubbo-congfig-api

// BEGIN dubbo-metadata-report-api
public static final String METADATA_REPORT_KEY = "metadata";

public static final String RETRY_TIMES_KEY = "retry.times";

public static final Integer DEFAULT_METADATA_REPORT_RETRY_TIMES = 100;

public static final String RETRY_PERIOD_KEY = "retry.period";

public static final Integer DEFAULT_METADATA_REPORT_RETRY_PERIOD = 3000;

public static final String SYNC_REPORT_KEY = "sync.report";

public static final String CYCLE_REPORT_KEY = "cycle.report";

public static final Boolean DEFAULT_METADATA_REPORT_CYCLE_REPORT = true;
// END dubbo-metadata-report-api

// BEGIN dubbo-filter-cache
public static final String CACHE_KEY = "cache";
// END dubbo-filter-cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.dubbo.metadata.integration;

import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.URLBuilder;
import org.apache.dubbo.common.constants.RemotingConstants;
Expand All @@ -42,6 +41,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.metadata.support.Constants.METADATA_REPORT_KEY;

/**
* @since 2.7.0
Expand All @@ -58,11 +58,11 @@ public class MetadataReportService {
URL metadataReportUrl;

MetadataReportService(URL metadataReportURL) {
if (Constants.METADATA_REPORT_KEY.equals(metadataReportURL.getProtocol())) {
String protocol = metadataReportURL.getParameter(Constants.METADATA_REPORT_KEY, DEFAULT_DIRECTORY);
if (METADATA_REPORT_KEY.equals(metadataReportURL.getProtocol())) {
String protocol = metadataReportURL.getParameter(METADATA_REPORT_KEY, DEFAULT_DIRECTORY);
metadataReportURL = URLBuilder.from(metadataReportURL)
.setProtocol(protocol)
.removeParameter(Constants.METADATA_REPORT_KEY)
.removeParameter(METADATA_REPORT_KEY)
.build();
}
this.metadataReportUrl = metadataReportURL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.dubbo.metadata.support;

import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
Expand Down Expand Up @@ -56,6 +55,13 @@
import static org.apache.dubbo.common.constants.CommonConstants.FILE_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
import static org.apache.dubbo.metadata.support.Constants.CYCLE_REPORT_KEY;
import static org.apache.dubbo.metadata.support.Constants.DEFAULT_METADATA_REPORT_CYCLE_REPORT;
import static org.apache.dubbo.metadata.support.Constants.DEFAULT_METADATA_REPORT_RETRY_PERIOD;
import static org.apache.dubbo.metadata.support.Constants.DEFAULT_METADATA_REPORT_RETRY_TIMES;
import static org.apache.dubbo.metadata.support.Constants.RETRY_PERIOD_KEY;
import static org.apache.dubbo.metadata.support.Constants.RETRY_TIMES_KEY;
import static org.apache.dubbo.metadata.support.Constants.SYNC_REPORT_KEY;

/**
*
Expand Down Expand Up @@ -102,11 +108,11 @@ public AbstractMetadataReport(URL reportServerURL) {
}
this.file = file;
loadProperties();
syncReport = reportServerURL.getParameter(Constants.SYNC_REPORT_KEY, false);
metadataReportRetry = new MetadataReportRetry(reportServerURL.getParameter(Constants.RETRY_TIMES_KEY, Constants.DEFAULT_METADATA_REPORT_RETRY_TIMES),
reportServerURL.getParameter(Constants.RETRY_PERIOD_KEY, Constants.DEFAULT_METADATA_REPORT_RETRY_PERIOD));
syncReport = reportServerURL.getParameter(SYNC_REPORT_KEY, false);
metadataReportRetry = new MetadataReportRetry(reportServerURL.getParameter(RETRY_TIMES_KEY, DEFAULT_METADATA_REPORT_RETRY_TIMES),
reportServerURL.getParameter(RETRY_PERIOD_KEY, DEFAULT_METADATA_REPORT_RETRY_PERIOD));
// cycle report the data switch
if (reportServerURL.getParameter(Constants.CYCLE_REPORT_KEY, Constants.DEFAULT_METADATA_REPORT_CYCLE_REPORT)) {
if (reportServerURL.getParameter(CYCLE_REPORT_KEY, DEFAULT_METADATA_REPORT_CYCLE_REPORT)) {
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("DubboMetadataReportTimer", true));
scheduler.scheduleAtFixedRate(this::publishAll, calculateStartTime(), ONE_DAY_IN_MIll, TimeUnit.MILLISECONDS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.dubbo.common.constants;
package org.apache.dubbo.metadata.support;

public interface MetadataReportConstants {
public interface Constants {
String METADATA_REPORT_KEY = "metadata";

String RETRY_TIMES_KEY = "retry.times";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
import java.util.HashMap;
import java.util.Map;

import static org.apache.dubbo.common.Constants.SYNC_REPORT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
import static org.apache.dubbo.metadata.support.Constants.SYNC_REPORT_KEY;

/**
* 2018/10/9
Expand Down