activemq-artemis icon indicating copy to clipboard operation
activemq-artemis copied to clipboard

Register listener

Open somdatta8172 opened this issue 4 years ago • 7 comments

Issue Link: https://issues.apache.org/jira/browse/ARTEMIS-3085?filter=12350956

Hello @clebertsuconic I have added registerIOCriticalErrorListener method to ActiveMQServer Interface,wrote the method's implementation and added IOCriticalErrorListenerTest also,though need suggestions on it. Thank you Somdatta

somdatta8172 avatar Oct 21 '21 23:10 somdatta8172

Please.. rebase against main:

# some people call it upstream
git remote add github https://github.com/apache/activemq-artemis.git
git pull --rebase github main
git push origin register-listener -f

a merge commit on a pull request is never good.. you should always have your pull request against main. and if you update against main, please rebase and push -f

clebertsuconic avatar Oct 22 '21 03:10 clebertsuconic

You should probably squash all your changes Into a single commit.

Also, you are adding the lister to a collection on ActiveMQServer, but you're not doing anything with it. you should register it to the StorageManager when it starts...

ultimately you should just delegate it from the storage manager.

Also: notice the critical error is meant for IO Storage.. not acceptors.. on your test you did an invalid TCP operation, but that wouldn't cause any damage.

We have some tests that are validating the IOCriticalException by simply calling an artificial method, generating a fake failure:

ShutdownOnCriticalIOErrorMoveNextTest was doing that, but that would be a bit convoluted for your test.

As for the change, you will have to change ActiveMQServerImpl a bit further.

Currently the ActiveMQServerImpl is creating a DefaultCriticalErrorListener that will register into the StorageManagers.

I suggest you add this ioCriticalErrorListener to your collection,

and then create a new Listener that will do the following:

ioCriticalErrorListeners.forEach((t) -> t.callitWhateverTheMethodName);

clebertsuconic avatar Oct 22 '21 03:10 clebertsuconic

remember to build with Checkstyle before updating the PR:

mvn -DskipTests=true -Pdev -Derrorprone

The -Pdev will enable checkstyle checks

and the errorprone will be used also if you set the variable on maven.

I like to build without tests (although I recommend running your tests before uploading it).

clebertsuconic avatar Oct 22 '21 03:10 clebertsuconic

You should probably squash all your changes Into a single commit.

@somdatta8172 The workflow i personally use. If its wrong, then, it will be an honor seeing recommendations

git pull --rebase origin <branch_name>  # get all commits pushed on <branch_name> locally
git log --oneline  # To confirm that the commits are present 
git rebase -i HEAD~6  # number of commits you have on your branch on upstream

replace pick with squash from bottom to top, leaving out the first. If you feel like deleting some commit, the replace pick with drop

After a message rebase successful, or its equivalent, git push -f origin <branch_name>

Best wishes this Brendah

nbrendah avatar Oct 22 '21 13:10 nbrendah

@somdatta8172 you still have a merge commit here.. I did the rebase myself and the merge commit disappeared...

also, did you see my points about the other changes?

clebertsuconic avatar Oct 22 '21 17:10 clebertsuconic

you rebased against your origin here:

git pull --rebase origin <branch_name>

you have to rebase against upstream/main

git pull --rebase upstream main git push origin -f

clebertsuconic avatar Oct 22 '21 17:10 clebertsuconic

git pull --rebase origin <branch_name>

Ooohh yes @clebertsuconic, this is a weird hack. You know some times we just edit files and create commits using github instead of using local git. Such commit are on Githib and not the local environment. I use the previous command to get such commits "updated FILE_NAME ........" (sometimes the user changes commit messages)

I think the equivalent command is git fetch --all honestly, i am not so sure. Am not a Linus Torvalds :laughing:

nbrendah avatar Oct 23 '21 18:10 nbrendah

I went ahead and cleaned this up and merged it since it had been sitting idle for so long. Thanks for the contribution, @nbrendah!

jbertram avatar Dec 15 '22 22:12 jbertram