-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1910 from alibaba/datax_0913
Datax month 9 features
- Loading branch information
Showing
49 changed files
with
2,505 additions
and
609 deletions.
There are no files selected for viewing
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
74 changes: 0 additions & 74 deletions
74
.../src/test/java/com/alibaba/datax/plugin/reader/clickhousereader/ClickhouseReaderTest.java
This file was deleted.
Oops, something went wrong.
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
34 changes: 34 additions & 0 deletions
34
common/src/main/java/com/alibaba/datax/common/util/LimitLogger.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.alibaba.datax.common.util; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author jitongchen | ||
* @date 2023/9/7 9:47 AM | ||
*/ | ||
public class LimitLogger { | ||
|
||
private static Map<String, Long> lastPrintTime = new HashMap<>(); | ||
|
||
public static void limit(String name, long limit, LoggerFunction function) { | ||
if (StringUtils.isBlank(name)) { | ||
name = "__all__"; | ||
} | ||
if (limit <= 0) { | ||
function.apply(); | ||
} else { | ||
if (!lastPrintTime.containsKey(name)) { | ||
lastPrintTime.put(name, System.currentTimeMillis()); | ||
function.apply(); | ||
} else { | ||
if (System.currentTimeMillis() > lastPrintTime.get(name) + limit) { | ||
lastPrintTime.put(name, System.currentTimeMillis()); | ||
function.apply(); | ||
} | ||
} | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
common/src/main/java/com/alibaba/datax/common/util/LoggerFunction.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.alibaba.datax.common.util; | ||
|
||
/** | ||
* @author molin.lxd | ||
* @date 2021-05-09 | ||
*/ | ||
public interface LoggerFunction { | ||
|
||
void apply(); | ||
} |
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
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.