Skip to content

Commit

Permalink
fix improper class/method/field modifiers (#10837)
Browse files Browse the repository at this point in the history
  • Loading branch information
hangc0276 committed Jun 7, 2021
1 parent 10aadcd commit f25b4a5
Show file tree
Hide file tree
Showing 113 changed files with 238 additions and 237 deletions.
2 changes: 1 addition & 1 deletion build/docker/protobuf.patch
Expand Up @@ -604,7 +604,7 @@ index 4c087db5..3ae1c14c 100644
+ " this.handle = handle;\n"
" maybeForceBuilderInitialization();\n"
"}\n"
+ "private final static io.netty.util.Recycler<Builder> RECYCLER = new io.netty.util.Recycler<Builder>() {\n"
+ "private static final io.netty.util.Recycler<Builder> RECYCLER = new io.netty.util.Recycler<Builder>() {\n"
+ " protected Builder newObject(io.netty.util.Recycler.Handle handle) {\n"
+ " return new Builder(handle);\n"
+ " }\n"
Expand Down
1 change: 1 addition & 0 deletions buildtools/src/main/resources/pulsar/checkstyle.xml
Expand Up @@ -425,6 +425,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
<property name="severity" value="error"/>
</module>

<module name="ModifierOrder"/>

</module>
</module>
Expand Up @@ -37,7 +37,7 @@
*/
public class EntryCacheDefaultEvictionPolicy implements EntryCacheEvictionPolicy {

private final static double PercentOfSizeToConsiderForEviction = 0.5;
private static final double PercentOfSizeToConsiderForEviction = 0.5;

@Override
public void doEviction(List<EntryCache> caches, long sizeToFree) {
Expand Down
Expand Up @@ -71,7 +71,7 @@ public String getName() {
return ml.getName();
}

public final static PooledByteBufAllocator ALLOCATOR = new PooledByteBufAllocator(true, // preferDirect
public static final PooledByteBufAllocator ALLOCATOR = new PooledByteBufAllocator(true, // preferDirect
0, // nHeapArenas,
PooledByteBufAllocator.defaultNumDirectArena(), // nDirectArena
PooledByteBufAllocator.defaultPageSize(), // pageSize
Expand Down
Expand Up @@ -138,9 +138,9 @@
import org.slf4j.LoggerFactory;

public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
private final static long MegaByte = 1024 * 1024;
private static final long MegaByte = 1024 * 1024;

protected final static int AsyncOperationTimeoutSeconds = 30;
protected static final int AsyncOperationTimeoutSeconds = 30;

protected final BookKeeper bookKeeper;
protected final String name;
Expand Down Expand Up @@ -198,7 +198,7 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
private final CallbackMutex trimmerMutex = new CallbackMutex();

private final CallbackMutex offloadMutex = new CallbackMutex();
private final static CompletableFuture<PositionImpl> NULL_OFFLOAD_PROMISE = CompletableFuture
private static final CompletableFuture<PositionImpl> NULL_OFFLOAD_PROMISE = CompletableFuture
.completedFuture(PositionImpl.latest);
private volatile LedgerHandle currentLedger;
private long currentLedgerEntries = 0;
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class SaslRoleToken implements Principal {
private static final String EXPIRES = "e";
private static final String SESSION = "i";

private final static Set<String> ATTRIBUTES =
private static final Set<String> ATTRIBUTES =
new HashSet<String>(Arrays.asList(USER_ROLE, EXPIRES, SESSION));

private String userRole;
Expand Down
Expand Up @@ -35,8 +35,8 @@
import java.util.*;

public class AuthenticationProviderBasic implements AuthenticationProvider {
private final static String HTTP_HEADER_NAME = "Authorization";
private final static String CONF_SYSTEM_PROPERTY_KEY = "pulsar.auth.basic.conf";
private static final String HTTP_HEADER_NAME = "Authorization";
private static final String CONF_SYSTEM_PROPERTY_KEY = "pulsar.auth.basic.conf";
private Map<String, String> users;

@Override
Expand Down
Expand Up @@ -50,31 +50,31 @@

public class AuthenticationProviderToken implements AuthenticationProvider {

final static String HTTP_HEADER_NAME = "Authorization";
final static String HTTP_HEADER_VALUE_PREFIX = "Bearer ";
static final String HTTP_HEADER_NAME = "Authorization";
static final String HTTP_HEADER_VALUE_PREFIX = "Bearer ";

// When symmetric key is configured
final static String CONF_TOKEN_SETTING_PREFIX = "";
static final String CONF_TOKEN_SETTING_PREFIX = "";

// When symmetric key is configured
final static String CONF_TOKEN_SECRET_KEY = "tokenSecretKey";
static final String CONF_TOKEN_SECRET_KEY = "tokenSecretKey";

// When public/private key pair is configured
final static String CONF_TOKEN_PUBLIC_KEY = "tokenPublicKey";
static final String CONF_TOKEN_PUBLIC_KEY = "tokenPublicKey";

// The token's claim that corresponds to the "role" string
final static String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";
static final String CONF_TOKEN_AUTH_CLAIM = "tokenAuthClaim";

// When using public key's, the algorithm of the key
final static String CONF_TOKEN_PUBLIC_ALG = "tokenPublicAlg";
static final String CONF_TOKEN_PUBLIC_ALG = "tokenPublicAlg";

// The token audience "claim" name, e.g. "aud", that will be used to get the audience from token.
final static String CONF_TOKEN_AUDIENCE_CLAIM = "tokenAudienceClaim";
static final String CONF_TOKEN_AUDIENCE_CLAIM = "tokenAudienceClaim";

// The token audience stands for this broker. The field `tokenAudienceClaim` of a valid token, need contains this.
final static String CONF_TOKEN_AUDIENCE = "tokenAudience";
static final String CONF_TOKEN_AUDIENCE = "tokenAudience";

final static String TOKEN = "token";
static final String TOKEN = "token";

private static final Counter expiredTokenMetrics = Counter.build()
.name("pulsar_expired_token_count")
Expand Down
Expand Up @@ -47,7 +47,7 @@ public class OverloadShedder implements LoadSheddingStrategy {

private final Multimap<String, String> selectedBundlesCache = ArrayListMultimap.create();

private final static double ADDITIONAL_THRESHOLD_PERCENT_MARGIN = 0.05;
private static final double ADDITIONAL_THRESHOLD_PERCENT_MARGIN = 0.05;

/**
* Attempt to shed some bundles off every broker which is overloaded.
Expand Down
Expand Up @@ -40,7 +40,7 @@ public class ThresholdShedder implements LoadSheddingStrategy {

private final Multimap<String, String> selectedBundlesCache = ArrayListMultimap.create();

private final static double ADDITIONAL_THRESHOLD_PERCENT_MARGIN = 0.05;
private static final double ADDITIONAL_THRESHOLD_PERCENT_MARGIN = 0.05;

private static final double MB = 1024 * 1024;

Expand Down
Expand Up @@ -594,13 +594,13 @@ private void checkRGCreateParams(ResourceGroupConfigInfo rgConfig) throws Pulsar
// set the value to 4.
// Setting this to 0 will make us report in every round.
// Don't set to negative values; behavior will be "undefined".
protected final static int MaxUsageReportSuppressRounds = 5;
protected static final int MaxUsageReportSuppressRounds = 5;

// Convenient shorthand, for MaxUsageReportSuppressRounds converted to a time interval in milliseconds.
protected static long maxIntervalForSuppressingReportsMSecs;

// The percentage difference that is considered "within limits" to suppress usage reporting.
// Setting this to 0 will also make us report in every round.
// Don't set it to negative values; behavior will be "undefined".
protected final static float UsageReportSuppressionTolerancePercentage = 5;
protected static final float UsageReportSuppressionTolerancePercentage = 5;
}
Expand Up @@ -236,7 +236,7 @@ public class BrokerService implements Closeable, ZooKeeperCacheListener<Policies

private DistributedIdGenerator producerNameGenerator;

public final static String PRODUCER_NAME_GENERATOR_PATH = "/counters/producer-name";
public static final String PRODUCER_NAME_GENERATOR_PATH = "/counters/producer-name";

private final BacklogQuotaManager backlogQuotaManager;

Expand Down
Expand Up @@ -66,7 +66,7 @@ public class ReplicatedSubscriptionsController implements AutoCloseable, Topic.P
private final ConcurrentMap<String, ReplicatedSubscriptionsSnapshotBuilder> pendingSnapshots =
new ConcurrentHashMap<>();

private final static Gauge pendingSnapshotsMetric = Gauge
private static final Gauge pendingSnapshotsMetric = Gauge
.build("pulsar_replicated_subscriptions_pending_snapshots",
"Counter of currently pending snapshots")
.register();
Expand Down
Expand Up @@ -53,7 +53,7 @@ public class ReplicatedSubscriptionsSnapshotBuilder {

private final Clock clock;

private final static Summary snapshotMetric = Summary.build("pulsar_replicated_subscriptions_snapshot_ms",
private static final Summary snapshotMetric = Summary.build("pulsar_replicated_subscriptions_snapshot_ms",
"Time taken to create a consistent snapshot across clusters").register();

public ReplicatedSubscriptionsSnapshotBuilder(ReplicatedSubscriptionsController controller,
Expand Down
Expand Up @@ -25,7 +25,7 @@
* A schema validator that always reports as compatible.
*/
class AlwaysSchemaValidator implements SchemaValidator {
final static AlwaysSchemaValidator INSTANCE = new AlwaysSchemaValidator();
static final AlwaysSchemaValidator INSTANCE = new AlwaysSchemaValidator();

@Override
public void validate(Schema toValidate, Iterable<Schema> existing) {
Expand Down
Expand Up @@ -28,8 +28,8 @@
* An avro schema validator that always reports as incompatible, if there is an existing schema.
*/
class NeverSchemaValidator implements SchemaValidator {
private final static Logger log = LoggerFactory.getLogger(NeverSchemaValidator.class);
final static NeverSchemaValidator INSTANCE = new NeverSchemaValidator();
private static final Logger log = LoggerFactory.getLogger(NeverSchemaValidator.class);
static final NeverSchemaValidator INSTANCE = new NeverSchemaValidator();

@Override
public void validate(Schema toValidate, Iterable<Schema> existing)
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class ClusterReplicationMetrics {
private final List<Metrics> metricsList;
private final String localCluster;
private final ConcurrentOpenHashMap<String, ReplicationMetrics> metricsMap;
public final static String SEPARATOR = "_";
public static final String SEPARATOR = "_";
public final boolean metricsEnabled;

public ClusterReplicationMetrics(String localCluster, boolean metricsEnabled) {
Expand Down
Expand Up @@ -34,15 +34,15 @@
@Slf4j
public class TransactionAggregator {

private final static FastThreadLocal<AggregatedTransactionCoordinatorStats> localTransactionCoordinatorStats =
private static final FastThreadLocal<AggregatedTransactionCoordinatorStats> localTransactionCoordinatorStats =
new FastThreadLocal<AggregatedTransactionCoordinatorStats>() {
@Override
protected AggregatedTransactionCoordinatorStats initialValue() throws Exception {
return new AggregatedTransactionCoordinatorStats();
}
};

private final static FastThreadLocal<ManagedLedgerStats> localManageLedgerStats =
private static final FastThreadLocal<ManagedLedgerStats> localManageLedgerStats =
new FastThreadLocal<ManagedLedgerStats>() {
@Override
protected ManagedLedgerStats initialValue() throws Exception {
Expand Down
Expand Up @@ -41,7 +41,7 @@ public class TransactionTimeoutTrackerImpl implements TransactionTimeoutTracker,
private final long tickTimeMillis;
private final Clock clock;
private Timeout currentTimeout;
private final static long INITIAL_TIMEOUT = 1L;
private static final long INITIAL_TIMEOUT = 1L;

private volatile long nowTaskTimeoutTime = INITIAL_TIMEOUT;
private final long tcId;
Expand Down
Expand Up @@ -77,7 +77,7 @@ public ByteBuf serialize() {
return buf;
}

static public RawMessage deserializeFrom(ByteBuf buffer) {
public static RawMessage deserializeFrom(ByteBuf buffer) {
int idSize = buffer.readInt();

MessageIdData id = new MessageIdData();
Expand Down
Expand Up @@ -44,7 +44,7 @@

public class RawReaderImpl implements RawReader {

final static int DEFAULT_RECEIVER_QUEUE_SIZE = 1000;
static final int DEFAULT_RECEIVER_QUEUE_SIZE = 1000;
private final ConsumerConfigurationData<byte[]> consumerConfiguration;
private RawConsumerImpl consumer;

Expand Down
Expand Up @@ -49,9 +49,9 @@
import org.slf4j.LoggerFactory;

public class CompactedTopicImpl implements CompactedTopic {
final static long NEWER_THAN_COMPACTED = -0xfeed0fbaL;
final static long COMPACT_LEDGER_EMPTY = -0xfeed0fbbL;
final static int DEFAULT_STARTPOINT_CACHE_SIZE = 100;
static final long NEWER_THAN_COMPACTED = -0xfeed0fbaL;
static final long COMPACT_LEDGER_EMPTY = -0xfeed0fbbL;
static final int DEFAULT_STARTPOINT_CACHE_SIZE = 100;

private final BookKeeper bk;

Expand Down
Expand Up @@ -32,7 +32,7 @@
import org.slf4j.LoggerFactory;

public class MockAuthentication implements Authentication {
private final static Logger log = LoggerFactory.getLogger(MockAuthentication.class);
private static final Logger log = LoggerFactory.getLogger(MockAuthentication.class);
private final String user;

public MockAuthentication(String user) {
Expand Down
Expand Up @@ -32,9 +32,9 @@
@Test(groups = "broker")
public class OwnerShipCacheForCurrentServerTest extends OwnerShipForCurrentServerTestBase {

private final static String TENANT = "ownership";
private final static String NAMESPACE = TENANT + "/ns1";
private final static String TOPIC_TEST = NAMESPACE + "/test";
private static final String TENANT = "ownership";
private static final String NAMESPACE = TENANT + "/ns1";
private static final String TOPIC_TEST = NAMESPACE + "/test";

@BeforeMethod
protected void setup() throws Exception {
Expand Down
Expand Up @@ -61,7 +61,7 @@
@Slf4j
public class OwnerShipForCurrentServerTestBase {

public final static String CLUSTER_NAME = "test";
public static final String CLUSTER_NAME = "test";

@Setter
private int brokerCount = 3;
Expand Down
Expand Up @@ -87,8 +87,8 @@ public abstract class ReplicatorTestBase extends TestRetrySupport {

static final int TIME_TO_CHECK_BACKLOG_QUOTA = 5;

protected final static String TLS_SERVER_CERT_FILE_PATH = "./src/test/resources/certificate/server.crt";
protected final static String TLS_SERVER_KEY_FILE_PATH = "./src/test/resources/certificate/server.key";
protected static final String TLS_SERVER_CERT_FILE_PATH = "./src/test/resources/certificate/server.crt";
protected static final String TLS_SERVER_KEY_FILE_PATH = "./src/test/resources/certificate/server.key";

// Default frequency
public int getBrokerServicePurgeInactiveFrequency() {
Expand Down
Expand Up @@ -50,9 +50,9 @@
@Test(groups = "broker")
public class MessageDuplicationTest {

private final static int BROKER_DEDUPLICATION_ENTRIES_INTERVAL = 10;
private final static int BROKER_DEDUPLICATION_MAX_NUMBER_PRODUCERS = 10;
private final static String REPLICATOR_PREFIX = "foo";
private static final int BROKER_DEDUPLICATION_ENTRIES_INTERVAL = 10;
private static final int BROKER_DEDUPLICATION_MAX_NUMBER_PRODUCERS = 10;
private static final String REPLICATOR_PREFIX = "foo";

@Test
public void testIsDuplicate() {
Expand Down
Expand Up @@ -55,24 +55,24 @@ public class SchemaServiceTest extends MockedPulsarServiceBaseTest {
private static final Clock MockClock = Clock.fixed(Instant.EPOCH, ZoneId.systemDefault());

private final String schemaId1 = "1/2/3/4";
private final static String userId = "user";
private static final String userId = "user";

private final static String schemaJson1 =
private static final String schemaJson1 =
"{\"type\":\"record\",\"name\":\"DefaultTest\",\"namespace\":\"org.apache.pulsar.broker.service.schema" +
".AvroSchemaCompatibilityCheckTest\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"}]}";
private final static SchemaData schemaData1 = getSchemaData(schemaJson1);
private static final SchemaData schemaData1 = getSchemaData(schemaJson1);

private final static String schemaJson2 =
private static final String schemaJson2 =
"{\"type\":\"record\",\"name\":\"DefaultTest\",\"namespace\":\"org.apache.pulsar.broker.service.schema" +
".AvroSchemaCompatibilityCheckTest\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"}," +
"{\"name\":\"field2\",\"type\":\"string\",\"default\":\"foo\"}]}";
private final static SchemaData schemaData2 = getSchemaData(schemaJson2);
private static final SchemaData schemaData2 = getSchemaData(schemaJson2);

private final static String schemaJson3 =
private static final String schemaJson3 =
"{\"type\":\"record\",\"name\":\"DefaultTest\",\"namespace\":\"org.apache.pulsar.broker.service.schema" +
".AvroSchemaCompatibilityCheckTest\",\"fields\":[{\"name\":\"field1\",\"type\":\"string\"}," +
"{\"name\":\"field2\",\"type\":\"string\"}]}";
private final static SchemaData schemaData3 = getSchemaData(schemaJson3);
private static final SchemaData schemaData3 = getSchemaData(schemaJson3);

private SchemaRegistryServiceImpl schemaRegistryService;

Expand Down
Expand Up @@ -72,13 +72,13 @@
@Slf4j
public class TopicTransactionBufferRecoverTest extends TransactionTestBase {

private final static String TENANT = "tnx";
private final static String NAMESPACE1 = TENANT + "/ns1";
private final static String RECOVER_COMMIT = NAMESPACE1 + "/recover-commit";
private final static String RECOVER_ABORT = NAMESPACE1 + "/recover-abort";
private final static String SUBSCRIPTION_NAME = "test-recover";
private final static String TAKE_SNAPSHOT = NAMESPACE1 + "/take-snapshot";
private final static String ABORT_DELETE = NAMESPACE1 + "/abort-delete";
private static final String TENANT = "tnx";
private static final String NAMESPACE1 = TENANT + "/ns1";
private static final String RECOVER_COMMIT = NAMESPACE1 + "/recover-commit";
private static final String RECOVER_ABORT = NAMESPACE1 + "/recover-abort";
private static final String SUBSCRIPTION_NAME = "test-recover";
private static final String TAKE_SNAPSHOT = NAMESPACE1 + "/take-snapshot";
private static final String ABORT_DELETE = NAMESPACE1 + "/abort-delete";

@BeforeMethod
protected void setup() throws Exception {
Expand Down
Expand Up @@ -45,7 +45,7 @@

public class TransactionClientReconnectTest extends TransactionTestBase {

private final static String RECONNECT_TOPIC = "persistent://public/txn/txn-client-reconnect-test";
private static final String RECONNECT_TOPIC = "persistent://public/txn/txn-client-reconnect-test";

@BeforeMethod(alwaysRun = true)
public void setup() throws Exception {
Expand Down
Expand Up @@ -59,9 +59,9 @@
@Test(groups = "broker")
public class TransactionConsumeTest extends TransactionTestBase {

private final static String CONSUME_TOPIC = "persistent://public/txn/txn-consume-test";
private final static String NORMAL_MSG_CONTENT = "Normal - ";
private final static String TXN_MSG_CONTENT = "Txn - ";
private static final String CONSUME_TOPIC = "persistent://public/txn/txn-consume-test";
private static final String NORMAL_MSG_CONTENT = "Normal - ";
private static final String TXN_MSG_CONTENT = "Txn - ";

@BeforeMethod(alwaysRun = true)
public void setup() throws Exception {
Expand Down

0 comments on commit f25b4a5

Please sign in to comment.