You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/04/07 07:58:30 UTC

[maven-surefire] 01/03: removed unused methods in CommandReader.java

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch maven2surefire-jvm-communication
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 7b97b49ed6a703e8dd0459e4b12698561791aaa1
Author: tibordigana <ti...@apache.org>
AuthorDate: Tue Apr 7 00:52:02 2020 +0200

    removed unused methods in CommandReader.java
---
 .../surefire/providerapi/CommandChainReader.java   |  4 ---
 .../maven/surefire/booter/CommandReader.java       | 41 +++-------------------
 2 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/CommandChainReader.java b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/CommandChainReader.java
index 2c94e9d..1710246 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/CommandChainReader.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/providerapi/CommandChainReader.java
@@ -29,11 +29,7 @@ public interface CommandChainReader
     boolean awaitStarted()
         throws TestSetFailedException;
 
-    void addTestsFinishedListener( CommandListener listener );
-
     void addSkipNextTestsListener( CommandListener listener );
 
     void addShutdownListener( CommandListener listener );
-
-    void removeListener( CommandListener listener );
 }
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/CommandReader.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
index 28766f5..f875240 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/CommandReader.java
@@ -35,21 +35,19 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.atomic.AtomicReference;
 
-import static java.util.Objects.requireNonNull;
+import static java.lang.StrictMath.max;
 import static java.lang.Thread.State.NEW;
 import static java.lang.Thread.State.RUNNABLE;
 import static java.lang.Thread.State.TERMINATED;
-import static java.lang.StrictMath.max;
+import static java.util.Objects.requireNonNull;
 import static org.apache.maven.surefire.booter.Command.toShutdown;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.BYE_ACK;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.NOOP;
-import static org.apache.maven.surefire.booter.MasterProcessCommand.RUN_CLASS;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.SHUTDOWN;
 import static org.apache.maven.surefire.booter.MasterProcessCommand.SKIP_SINCE_NEXT_TEST;
-import static org.apache.maven.surefire.booter.MasterProcessCommand.TEST_SET_FINISHED;
-import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
 import static org.apache.maven.surefire.shared.utils.StringUtils.isBlank;
 import static org.apache.maven.surefire.shared.utils.StringUtils.isNotBlank;
+import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
 
 /**
  * Reader of commands coming from plugin(master) process.
@@ -113,31 +111,13 @@ public final class CommandReader implements CommandChainReader
         }
     }
 
-    /**
-     * @param listener listener called with <b>Any</b> {@link MasterProcessCommand command type}
-     */
-    public void addListener( CommandListener listener )
-    {
-        listeners.add( new BiProperty<MasterProcessCommand, CommandListener>( null, listener ) );
-    }
-
-    public void addTestListener( CommandListener listener )
-    {
-        addListener( RUN_CLASS, listener );
-    }
-
-    @Override
-    public void addTestsFinishedListener( CommandListener listener )
-    {
-        addListener( TEST_SET_FINISHED, listener );
-    }
-
     @Override
     public void addSkipNextTestsListener( CommandListener listener )
     {
         addListener( SKIP_SINCE_NEXT_TEST, listener );
     }
 
+    @Override
     public void addShutdownListener( CommandListener listener )
     {
         addListener( SHUTDOWN, listener );
@@ -158,19 +138,6 @@ public final class CommandReader implements CommandChainReader
         listeners.add( new BiProperty<>( cmd, listener ) );
     }
 
-    @Override
-    public void removeListener( CommandListener listener )
-    {
-        for ( Iterator<BiProperty<MasterProcessCommand, CommandListener>> it = listeners.iterator(); it.hasNext(); )
-        {
-            BiProperty<MasterProcessCommand, CommandListener> listenerWrapper = it.next();
-            if ( listener == listenerWrapper.getP2() )
-            {
-                it.remove();
-            }
-        }
-    }
-
     /**
      * @return test classes which have been retrieved by
      * {@link CommandReader#getIterableClasses(MasterProcessChannelEncoder)}.