Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code implementing awaitTermination() #34

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

HelgeStenstrom
Copy link
Collaborator

As it was, the field future was always null, and therefore the method awaitTermination() didn't do anything. So I removed awaitTermination() and the future field.

They were not used, therefore they were not needed.

If something else is needed (if there is still a need, even if it wasn't fulfilled by the removed method), it's best to write a JUnit testcase that shows how the need is fulfilled by new code.

The logarithmic gain getter gets the gain directly from the SourceDataLine. 
We cannot know for sure that it will be logarithmic, but it seems to behave that way.
 StreamPlayer is no longer printing to System.out. Instead messages are logged.
To be able to log instead of print in StreamPlayerEventLauncher, its constructor signature has been changed, so that the source is a StreamPlayer instead of an Object. The StreamPlayerEventLauncher uses the logger of the source.
As it was, the field future was always null, and therefore the method awaitTermination() didn't do anything. So I removed awaitTermination() and the future field.

They were not used, therefore they were not needed.

If something else is needed (if there is still a need, even if it wasn't fulfilled by the removed method), it's best to write a JUnit testcase that shows how the need is fulfilled by new code.
@HelgeStenstrom
Copy link
Collaborator Author

If merged, this closes issue #2.

@goxr3plus
Copy link
Owner

goxr3plus commented Sep 8, 2019

Wait wait, are you sure about this one, when i wrote Future i used it because it was useful for a multithreading issue. Can you apply the change to your repo and check if the library works correctly with XR3Player, we might have issues in production after this.

@goxr3plus
Copy link
Owner

I specifically remember writing and using this method in XR3Player because i had issues

@goxr3plus
Copy link
Owner

But you might be right after all, let me think.

@goxr3plus
Copy link
Owner

O my gosh i am writing REACT js everyday and i have 1 million thinks in my mind, thanks for detecting important issues, i appreciate you very much ♥

As it was, the field future was always null, and therefore the method awaitTermination() didn't do anything. So I removed awaitTermination() and the future field.

They were not used, therefore they were not needed.

If something else is needed (if there is still a need, even if it wasn't fulfilled by the removed method), it's best to write a JUnit testcase that shows how the need is fulfilled by new code.
@HelgeStenstrom
Copy link
Collaborator Author

Rebased, to remove merge conflict.

@HelgeStenstrom
Copy link
Collaborator Author

See for yourself.

Current master branch, line 657:

But there is no place where future is assigned a value. The default value set on line 145 is null.

So the code in the if-clause will not be executed, and there is nothing else in awaitTermination().
Since awaitTermination() does nothing, the call can be removed, as well as the method itself.

@HelgeStenstrom
Copy link
Collaborator Author

I'm not the first one to see this.
#2 (comment)

Unit tests for gain, new getter for logarithmic gain level.
@goxr3plus
Copy link
Owner

Yes you are right , i had a careful look now , it seems i added it because i wanted to implement something . I need to think , await termination has a role to play , i will remember .

@HelgeStenstrom
Copy link
Collaborator Author

I suggest that you remove the dead code from the master branch now (merge the pull request), and then think about what it was that you wanted to accomplish, do some unit test for it, and then write the code to make them pass.

HelgeStenstrom and others added 20 commits September 10, 2019 08:19
Alphabetically sorted methods
Also extracted flushAndStopOutlet, but it's not tested yet, so it will be moved when it's tested.
Test that paueses, to exercise flushAndStopOutlet()
…treamPlayer

Extract class from stream player
As it was, the field future was always null, and therefore the method awaitTermination() didn't do anything. So I removed awaitTermination() and the future field.

They were not used, therefore they were not needed.

If something else is needed (if there is still a need, even if it wasn't fulfilled by the removed method), it's best to write a JUnit testcase that shows how the need is fulfilled by new code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants