metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickal...@apache.org
Subject [01/30] metron git commit: METRON-1703 Make Core Profiler Components Serializable (nickwallen) closes apache/metron#1145
Date Fri, 28 Sep 2018 13:08:57 GMT
Repository: metron
Updated Branches:
  refs/heads/master 4f0b608d7 -> fbabfcad4


METRON-1703 Make Core Profiler Components Serializable (nickwallen) closes apache/metron#1145


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/4fb92016
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/4fb92016
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/4fb92016

Branch: refs/heads/master
Commit: 4fb9201670acf9960087f004f8858e99c0a87981
Parents: a1e25a4
Author: nickwallen <nick@nickallen.org>
Authored: Wed Aug 15 09:26:42 2018 -0400
Committer: nickallen <nickallen@apache.org>
Committed: Wed Aug 15 09:26:42 2018 -0400

----------------------------------------------------------------------
 .../profiler/DefaultMessageDistributor.java     | 28 +++++++++++---------
 .../metron/profiler/DefaultMessageRouter.java   |  3 ++-
 .../apache/metron/profiler/MessageRoute.java    |  4 ++-
 .../profiler/clock/DefaultClockFactory.java     |  4 ++-
 .../metron/profiler/clock/EventTimeClock.java   |  3 ++-
 5 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/4fb92016/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
----------------------------------------------------------------------
diff --git a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
index 82f7174..c926a70 100644
--- a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
+++ b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java
@@ -20,19 +20,11 @@
 
 package org.apache.metron.profiler;
 
-import static java.lang.String.format;
-
 import com.google.common.base.Ticker;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.RemovalListener;
 import com.google.common.cache.RemovalNotification;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.metron.common.configuration.profiler.ProfileConfig;
 import org.apache.metron.stellar.dsl.Context;
@@ -40,6 +32,16 @@ import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.Serializable;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+import static java.lang.String.format;
+
 /**
  * The default implementation of a {@link MessageDistributor}.
  *
@@ -57,7 +59,7 @@ import org.slf4j.LoggerFactory;
  * lost.
  *
  */
-public class DefaultMessageDistributor implements MessageDistributor {
+public class DefaultMessageDistributor implements MessageDistributor, Serializable {
 
   protected static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
@@ -73,7 +75,7 @@ public class DefaultMessageDistributor implements MessageDistributor {
    * messages.  Once it has not received messages for a period of time, it is
    * moved to the expired cache.
    */
-  private transient Cache<Integer, ProfileBuilder> activeCache;
+  private Cache<Integer, ProfileBuilder> activeCache;
 
   /**
    * A cache of expired profiles.
@@ -84,7 +86,7 @@ public class DefaultMessageDistributor implements MessageDistributor {
    * can flush the state of the expired profile.  If the client does not flush
    * the expired profiles, this state will be lost forever.
    */
-  private transient Cache<Integer, ProfileBuilder> expiredCache;
+  private Cache<Integer, ProfileBuilder> expiredCache;
 
   /**
    * Create a new message distributor.
@@ -287,7 +289,7 @@ public class DefaultMessageDistributor implements MessageDistributor {
   /**
    * A listener that is notified when profiles expire from the active cache.
    */
-  private class ActiveCacheRemovalListener implements RemovalListener<Integer, ProfileBuilder>
{
+  private class ActiveCacheRemovalListener implements RemovalListener<Integer, ProfileBuilder>,
Serializable {
 
     @Override
     public void onRemoval(RemovalNotification<Integer, ProfileBuilder> notification)
{
@@ -305,7 +307,7 @@ public class DefaultMessageDistributor implements MessageDistributor {
   /**
    * A listener that is notified when profiles expire from the active cache.
    */
-  private class ExpiredCacheRemovalListener implements RemovalListener<Integer, ProfileBuilder>
{
+  private class ExpiredCacheRemovalListener implements RemovalListener<Integer, ProfileBuilder>,
Serializable {
 
     @Override
     public void onRemoval(RemovalNotification<Integer, ProfileBuilder> notification)
{

http://git-wip-us.apache.org/repos/asf/metron/blob/4fb92016/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageRouter.java
----------------------------------------------------------------------
diff --git a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageRouter.java
b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageRouter.java
index d1a1a3b..19bfa8c 100644
--- a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageRouter.java
+++ b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageRouter.java
@@ -30,6 +30,7 @@ import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.Serializable;
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
 import java.util.List;
@@ -44,7 +45,7 @@ import static java.lang.String.format;
  * A single telemetry message may need to take multiple routes.  This is the case
  * when a message is needed by more than one profile.
  */
-public class DefaultMessageRouter implements MessageRouter {
+public class DefaultMessageRouter implements MessageRouter, Serializable {
 
   protected static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 

http://git-wip-us.apache.org/repos/asf/metron/blob/4fb92016/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/MessageRoute.java
----------------------------------------------------------------------
diff --git a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/MessageRoute.java
b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/MessageRoute.java
index 7288f03..680e4e8 100644
--- a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/MessageRoute.java
+++ b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/MessageRoute.java
@@ -22,6 +22,8 @@ package org.apache.metron.profiler;
 
 import org.apache.metron.common.configuration.profiler.ProfileConfig;
 
+import java.io.Serializable;
+
 /**
  * Defines the 'route' a message must take through the Profiler.
  *
@@ -33,7 +35,7 @@ import org.apache.metron.common.configuration.profiler.ProfileConfig;
  *
  * @see MessageRouter
  */
-public class MessageRoute {
+public class MessageRoute implements Serializable {
 
   /**
    * The definition of the profile on this route.

http://git-wip-us.apache.org/repos/asf/metron/blob/4fb92016/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/DefaultClockFactory.java
----------------------------------------------------------------------
diff --git a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/DefaultClockFactory.java
b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/DefaultClockFactory.java
index d62e62b..8a574f6 100644
--- a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/DefaultClockFactory.java
+++ b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/DefaultClockFactory.java
@@ -21,6 +21,8 @@ package org.apache.metron.profiler.clock;
 
 import org.apache.metron.common.configuration.profiler.ProfilerConfig;
 
+import java.io.Serializable;
+
 /**
  * Creates a {@link Clock} based on the profiler configuration.
  *
@@ -29,7 +31,7 @@ import org.apache.metron.common.configuration.profiler.ProfilerConfig;
  *
  * <p>The default implementation of a {@link ClockFactory}.
  */
-public class DefaultClockFactory implements ClockFactory {
+public class DefaultClockFactory implements ClockFactory, Serializable {
 
   /**
    * @param config The profiler configuration.

http://git-wip-us.apache.org/repos/asf/metron/blob/4fb92016/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeClock.java
----------------------------------------------------------------------
diff --git a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeClock.java
b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeClock.java
index 5cd574e..c094b7d 100644
--- a/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeClock.java
+++ b/metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/clock/EventTimeClock.java
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
 
 import java.lang.invoke.MethodHandles;
 import java.util.Optional;
+import java.io.Serializable;
 
 /**
  * A {@link Clock} that advances based on event time.
@@ -33,7 +34,7 @@ import java.util.Optional;
  * Event time is advanced by the timestamps contained within telemetry messages, rather
  * than the system clock.
  */
-public class EventTimeClock implements Clock {
+public class EventTimeClock implements Clock, Serializable {
 
   protected static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 


Mime
View raw message