Skip to content

Commit

Permalink
[INLONG-1593][checkstyle] Add EmptyLineSeparator java code checkstyle…
Browse files Browse the repository at this point in the history
… rule (apache#1594)
  • Loading branch information
leo65535 authored Sep 29, 2021
1 parent e88fee9 commit f757920
Show file tree
Hide file tree
Showing 463 changed files with 12 additions and 932 deletions.
13 changes: 12 additions & 1 deletion codestyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,23 @@
<property name="tokens" value="BLOCK_COMMENT_BEGIN"/>
</module>


<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
<module name="SuppressionXpathFilter">
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
default="checkstyle-xpath-suppressions.xml" />
<property name="optional" value="true"/>
</module>

<module name="EmptyLineSeparator">
<!-- Checks for empty line separator between tokens. The only
excluded token is VARIABLE_DEF, allowing class fields to
be declared on consecutive lines.
-->
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF,
INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF,
CTOR_DEF"/>
</module>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.common;


import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public class AgentConstants {
public static final String JOB_THREAD_RUNNING_CORE = "job.thread.running.core";
public static final int DEFAULT_JOB_THREAD_RUNNING_CORE = 4;


public static final String JOB_MONITOR_INTERVAL = "job.monitor.interval";
public static final int DEFAULT_JOB_MONITOR_INTERVAL = 5;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class CommonConstants {

public static final String PROXY_TID = "proxy.tid";


public static final String PROXY_LOCAL_HOST = "proxy.localHost";
public static final String DEFAULT_PROXY_LOCALHOST = AgentUtils.getLocalIp();

Expand Down Expand Up @@ -122,16 +121,13 @@ public class CommonConstants {
public static final String PULSAR_PRODUCER_BLOCK_QUEUE = "pulsar.producer.block.queue";
public static final boolean DEFAULT_PULSAR_PRODUCER_BLOCK_QUEUE = true;


public static final String FILE_MAX_NUM = "file.max.num";
public static final int DEFAULT_FILE_MAX_NUM = 4096;

public static final String TRIGGER_ID_PREFIX = "trigger_";


public static final String COMMAND_STORE_INSTANCE_NAME = "commandStore";


public static final String AGENT_OS_NAME = "os.name";
public static final String AGENT_NIX_OS = "nix";
public static final String AGENT_NUX_OS = "nux";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.constants;


/**
* Basic config for a single job
*/
Expand All @@ -29,7 +28,6 @@ public class JobConstants extends CommonConstants {
public static final String JOB_IP = "job.ip";
public static final String JOB_RETRY = "job.retry";


public static final String JOB_SOURCE = "job.source";
public static final String JOB_SINK = "job.sink";
public static final String JOB_CHANNEL = "job.channel";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ public KeyValueEntity get(String key) {
return primaryIndex.get(key);
}


@Override
public CommandEntity getCommand(String commandId) {
requireNonNull(commandId);
return commandPrimaryIndex.get(commandId);
}


@Override
public CommandEntity putCommand(CommandEntity entity) {
requireNonNull(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public List<CommandEntity> getUnackedCommands() {
return db.searchCommands(false);
}


/**
* save normal command result for trigger
* @param profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;


@Entity(version = 1)
@Data
@AllArgsConstructor
Expand All @@ -39,7 +38,6 @@ public class CommandEntity {
private String taskId;
private String deliveryTime;


public static String generateCommanid(String taskId, int opType) {
return taskId + opType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
*/
public interface Db extends Closeable {


abstract KeyValueEntity get(String key);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ public JobProfile getJob(StateSearchKey stateSearchKey) {
return null;
}


/**
* get job reading specific file
* @param fileName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/


package org.apache.inlong.agent.db;

import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.db;


import java.util.ArrayList;
import java.util.List;
import org.apache.inlong.agent.conf.TriggerProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class ProxyMessage implements Message {
private final String bid;
private final String tid;


public ProxyMessage(byte[] body, Map<String, String> header) {
this.body = body;
this.header = header;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ private void formatSnapshotList(Object source) {
}
}


private MBeanInfo metricsMetaToInfo() {
// overwrite name, desc from MetricsMeta if not null.
String name = this.module == null ? metricsMeta.getName() : this.module;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public static void register(String module, String aspect, String desc, Object so
}
}


/**
* handle class level annotation
*/
Expand All @@ -95,7 +94,6 @@ private static MetricsMeta handleClassAnnotation(Object source,
return null;
}


private static boolean initFieldByType(Object source, Field field) {
try {
if (field.getType() == CounterInt.class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.metrics.gauge;


import org.apache.inlong.agent.metrics.MutableMetric;

public interface Gauge<T> extends MutableMetric {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
public interface Channel extends Stage {


/**
* write message
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public interface Sink extends Stage {
*/
void write(Message message);


/**
* set source file name where the message is generated
* @param sourceFileName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public AbstractStateWrapper() {
*/
public abstract void addCallbacks();


public AbstractStateWrapper addCallback(State begin, State end, StateCallback callback) {
callBacks.put(new ImmutablePair<>(begin, end), callback);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.state;


public class StateTransferException extends RuntimeException {

public StateTransferException(State begin, State end) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class AgentUtils {
public static final String HOUR_LOW_CASE = "h";
public static final String MINUTE = "m";


/**
* get md5 of file.
* @param file - file name
Expand Down Expand Up @@ -227,7 +226,6 @@ public static String formatCurrentTimeWithOffset(String formatter, int day, int
return DateTimeFormatter.ofPattern(formatter).withLocale(Locale.getDefault()).format(zoned);
}


public static String formatCurrentTimeWithoutOffset(String formatter) {
ZonedDateTime zoned = ZonedDateTime.now().plusDays(0).plusHours(0).plusMinutes(0);
return DateTimeFormatter.ofPattern(formatter).withLocale(Locale.getDefault()).format(zoned);
Expand Down Expand Up @@ -303,7 +301,6 @@ public static Map<String, String> getAdditionAttr(String additionStr) {
return mValueAttrs.getRight();
}


/**
* get m value in additionStr
* @param addictiveAttr
Expand Down Expand Up @@ -356,8 +353,4 @@ private static long parseTimeToMillSec(String time, String pattern) {
return System.currentTimeMillis();
}





}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/


package org.apache.inlong.agent.utils;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public void testDateFormatterWithOffset() {
LOGGER.info("agent time is {}", time);
}


@Test
public void testParseAddictiveStr() {
String addStr = "m=10&__addcol1__worldid=&t=1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.junit.BeforeClass;
import org.junit.Test;


public class TestBerkeleyDBImp {

private static BerkeleyDbImp db;
Expand Down Expand Up @@ -77,7 +76,6 @@ public void testKeyValueDB() {

}


@Test
public void testCommandDb() {
CommandEntity commandEntity = new CommandEntity("1", 0, false, "1", "");
Expand Down Expand Up @@ -123,7 +121,6 @@ public void testDeleteItem() {
Assert.assertNull(entityResult);
}


@Test
public void testFileNameSearch() {
KeyValueEntity entity = new KeyValueEntity("searchKey1", "searchResult1", "test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.core;


import static org.apache.inlong.agent.constants.AgentConstants.AGENT_CONF_PARENT;
import static org.apache.inlong.agent.constants.AgentConstants.DEFAULT_AGENT_CONF_PARENT;
import static org.apache.inlong.agent.constants.JobConstants.JOB_TRIGGER;
Expand Down Expand Up @@ -58,8 +57,6 @@ public class AgentManager extends AbstractDaemon {
// jetty for config operations via http.
private ConfigJetty configJetty;



private final ProfileFetcher fetcher;
private final AgentConfiguration conf;
private final Db db;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.core.job;


import java.util.ArrayList;
import java.util.List;
import org.apache.inlong.agent.conf.JobProfile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.core.job;


import static org.apache.inlong.agent.constants.AgentConstants.DEFAULT_JOB_DB_CACHE_CHECK_INTERVAL;
import static org.apache.inlong.agent.constants.AgentConstants.DEFAULT_JOB_DB_CACHE_TIME;
import static org.apache.inlong.agent.constants.AgentConstants.JOB_DB_CACHE_CHECK_INTERVAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* limitations under the License.
*/


package org.apache.inlong.agent.core.job;

import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.inlong.agent.plugin.Reader;
import org.apache.inlong.agent.plugin.Sink;


/**
* task meta definition which contains reader -> channel -> sink and job config information
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ private Runnable taskPositionFlushThread() {
};
}


private void flushJobProfile(String jobId, JobProfile jobProfile) {
jobTaskPositionMap.get(jobId).forEach(
(fileName, position) -> jobProfile.setLong(fileName + POSITION_SUFFIX, position)
Expand Down Expand Up @@ -137,7 +136,6 @@ public void updateFileSinkPosition(String jobInstanceId, String sourceFilePath,
filePosition.put(sourceFilePath, beforePosition + size);
}


public ConcurrentHashMap<String, Long> getTaskPositionMap(String jobId) {
return jobTaskPositionMap.get(jobId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.inlong.agent.core.task;


import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
Expand Down Expand Up @@ -177,7 +176,6 @@ public void addCallbacks() {
});
}


@Override
public void run() {
try {
Expand Down
Loading

0 comments on commit f757920

Please sign in to comment.