Skip to content

Commit

Permalink
Merge pull request #33 from frankfreedom/feature-change-fastjson2gson
Browse files Browse the repository at this point in the history
Feature change fastjson2gson
  • Loading branch information
SelfImpr001 authored Aug 30, 2020
2 parents 5ddf2cd + 9723cb1 commit 97cb537
Show file tree
Hide file tree
Showing 249 changed files with 1,670 additions and 1,152 deletions.
2 changes: 1 addition & 1 deletion az-core/src/main/java/azkaban/AzkabanCoreModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.codahale.metrics.MetricRegistry;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;


/**
Expand Down
5 changes: 3 additions & 2 deletions az-core/src/main/java/azkaban/metrics/MetricsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import java.lang.reflect.Constructor;
import java.util.function.Supplier;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The singleton class, MetricsManager, is the place to have MetricRegistry and ConsoleReporter in
Expand Down
6 changes: 4 additions & 2 deletions az-core/src/main/java/azkaban/utils/ExecutorServiceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@

package azkaban.utils;

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

import java.time.Duration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Executor service related utilities.
*/
public class ExecutorServiceUtils {

private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceUtils.class);

private static final TimeUnit MILLI_SECONDS_TIME_UNIT = TimeUnit.MILLISECONDS;

/**
Expand Down
7 changes: 4 additions & 3 deletions az-core/src/main/java/azkaban/utils/JSONUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import java.util.Iterator;
import java.util.Map;

import org.apache.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.codehaus.jackson.JsonFactory;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
Expand All @@ -37,7 +38,7 @@

public class JSONUtils {

private static final Logger logger = Logger.getLogger(JSONUtils.class);
private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class);

/**
* The constructor. Cannot construct this class.
Expand Down Expand Up @@ -101,7 +102,7 @@ public static Object parseJSONFromStringQuiet(final String json) {
try {
return parseJSONFromString(json);
} catch (final IOException e) {
logger.error("parse error, caused by: " +e);
logger.error("parse error, caused by: ", e);
return null;
}
}
Expand Down
4 changes: 3 additions & 1 deletion az-core/src/main/java/azkaban/utils/Props.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package azkaban.utils;


import org.slf4j.Logger;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
Expand All @@ -38,7 +41,6 @@
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
import org.apache.log4j.Logger;

/**
* Hashmap implementation of a hierarchical properties with helpful converter functions and
Expand Down
5 changes: 3 additions & 2 deletions az-core/src/main/java/azkaban/utils/PropsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
import org.apache.commons.jexl2.JexlException;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

public class PropsUtils {

private static final Logger logger = Logger.getLogger(PropsUtils.class);
private static final Logger logger = LoggerFactory.getLogger(PropsUtils.class);
private static final Pattern VARIABLE_REPLACEMENT_PATTERN = Pattern
.compile("\\$\\{([a-zA-Z_.0-9]+)\\}");

Expand Down
62 changes: 35 additions & 27 deletions az-core/src/main/java/azkaban/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@

package azkaban.utils;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Days;
import org.joda.time.DurationFieldType;
import org.joda.time.Hours;
import org.joda.time.Minutes;
import org.joda.time.Months;
import org.joda.time.ReadablePeriod;
import org.joda.time.Seconds;
import org.joda.time.Weeks;
import org.joda.time.Years;
import org.quartz.CronExpression;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
Expand All @@ -46,25 +29,35 @@
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Random;
import java.util.TimeZone;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.apache.commons.io.IOUtils;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.Days;
import org.joda.time.DurationFieldType;
import org.joda.time.Hours;
import org.joda.time.Minutes;
import org.joda.time.Months;
import org.joda.time.ReadablePeriod;
import org.joda.time.Seconds;
import org.joda.time.Weeks;
import org.joda.time.Years;
import org.quartz.CronExpression;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;

/**
* A util helper class full of static methods that are commonly used.
*/
public class Utils {

public static final Random RANDOM = new Random();
private static final Logger logger = Logger.getLogger(Utils.class);
private static final Logger logger = LoggerFactory.getLogger(Utils.class);

private static final String TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
private static final String DATE_PATTERN = "yyyy-MM-dd";
Expand Down Expand Up @@ -286,6 +279,21 @@ public static Object callConstructor(final Class<?> c, final Object... args) {
return callConstructor(c, getTypes(args), args);
}

public static Object newConstructor(final Class<?> c, final Class<?>[] classes, final Object... args) {
try {
final Constructor<?> cons = c.getConstructor(classes);
return cons.newInstance(args);
} catch (final InvocationTargetException e) {
throw getCause(e);
} catch (final IllegalAccessException e) {
throw new IllegalStateException(e);
} catch (final NoSuchMethodException e) {
throw new IllegalStateException(e);
} catch (final InstantiationException e) {
throw new IllegalStateException(e);
}
}

/**
* Call the class constructor with the given arguments
*
Expand Down Expand Up @@ -525,7 +533,7 @@ public static List<String> getScheduleTime(Date startDate, Date endDate, String
try {
cronTriggerImpl.setCronExpression(cron);
} catch (ParseException pe){
logger.error("parsing cron expression falied, " + pe);
logger.error("parsing cron expression falied: {}", pe);
return timeList;
}
List<Date> dates = TriggerUtils.computeFireTimesBetween(cronTriggerImpl, null, startDate, endDate);
Expand Down
20 changes: 20 additions & 0 deletions az-webank-alerter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,31 @@
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-common</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-web-server</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;


public class WeBankAlerter implements Alerter {
private static Logger logger = Logger.getLogger(WeBankAlerter.class);
private static Logger logger = LoggerFactory.getLogger(WeBankAlerter.class);
private Props props;
private String alarmServer;
private String alarmPort;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import java.util.List;
import java.util.Set;
import org.apache.commons.codec.binary.Hex;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class IMSAlert {
public static class Result {
Expand Down
20 changes: 20 additions & 0 deletions az-webank-homepage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,31 @@
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-common</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-web-server</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
Expand Down
21 changes: 16 additions & 5 deletions az-webank-system-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,27 @@
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-common</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
<artifactId>azkaban-web-server</artifactId>
<version>${schedulis.version}</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
<groupId>com.alibaba</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.schedulis</groupId>
Expand Down Expand Up @@ -92,11 +108,6 @@
</dependency>


<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.61</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Singleton
public class JdbcSystemUserImpl implements SystemUserLoader {

private static final Logger logger = Logger.getLogger(JdbcSystemUserImpl.class);
private static final Logger logger = LoggerFactory.getLogger(JdbcSystemUserImpl.class);

private final DatabaseOperator dbOperator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


@Singleton
public class SystemManager {

private static final Logger logger = Logger.getLogger(SystemManager.class);
private static final Logger logger = LoggerFactory.getLogger(SystemManager.class);
private final ProjectLoader projectLoader;
private final SystemUserLoader systemUserLoader;
private final JdbcExecutorLoader jdbcExecutorLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
import java.util.Set;
import javax.inject.Inject;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SystemUserManager implements UserManager {

private static final Logger logger = Logger.getLogger(SystemUserManager.class.getName());
private static final Logger logger = LoggerFactory.getLogger(SystemUserManager.class.getName());

private HashMap<String, User> users;
private HashMap<String, String> userPassword;
Expand Down
Loading

0 comments on commit 97cb537

Please sign in to comment.