-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature/carma messenger ambassador #228
Conversation
...ain/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstanceManager.java
Outdated
Show resolved
Hide resolved
...ava/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerRegistrationReceiver.java
Outdated
Show resolved
Hide resolved
...java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerRegistrationMessage.java
Outdated
Show resolved
Hide resolved
this.rxMessageIpAddress = rxMessageIpAddress; | ||
this.rxMessagePort = rxMessagePort; | ||
this.rxTimeSyncPort = rxTimeSyncPort; | ||
this.messengerEmergencyState = messengerEmergencyState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we receive the messengerEmergencyState when the CARMA Messenger sends its registration to the CARMA Messenger Ambassador?
...java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstanceManagerTest.java
Outdated
Show resolved
Hide resolved
...java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstanceManagerTest.java
Outdated
Show resolved
Hide resolved
rxMsgsSocket = new DatagramSocket(); | ||
} | ||
|
||
public String getCarmaVehicleId() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still use the function name same with CARMA Ambassador or we can change to something like "carmaMessengerVehicleId"?
...r/src/main/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstance.java
Outdated
Show resolved
Hide resolved
I'm a bit concerned about the amount of duplication in this one, it looks like a lot of this is the same as the CARMA Platform ambassador, which is fine and expected. But rather than simply duplicating the code, we should be looking at how to refactor it to minimize duplication. Can we inherit directly from the CARMAPlatformAmbassador class and override the specific functions we need to change to support messenger? Are there parts of the CARMA Platform Ambassador that should be refactored out into a base-class that both Platform and Messenger ambassadors inherit from? Should some of the existing classes just be renamed and reused as-is instead of duplicated? |
...r/src/main/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstance.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstance.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstanceManager.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/mosaic/fed/carmamessenger/ambassador/CarmaMessengerInstanceManager.java
Outdated
Show resolved
Hide resolved
refactored the common class and carma messenger part, carma ambassador not added yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me! I've got a few minor nitpicks that you can choose to take a look at or ignore, but I think this is a good approach overall!
public class CarmaMessengerInstanceManager extends CommonInstanceManager<CarmaMessengerInstance, CarmaMessengerRegistrationMessage>{ | ||
|
||
|
||
// TODO: Verify actual port for CARMA Platform NS-3 adapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still an open todo item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Kyle, I must have missed this part, will delete it right away
// simulation time step | ||
return; | ||
} | ||
log.info("Common message ambassador processing timestep to {}.", time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At runtime, will the formatting for this logger show the actual inheriting class or will all log messages now seem to come form "CommonMessageAmbassador"? Might be confusing to wade through if all the CARMA ambassador's log statements get mixed together, worth considering if we can add the subclass name to these log statements somehow. There's got to be a way. My java's a bit rusty so I'm not sure what this.getClass()
would return here, whether that'd give the superclass or the subclass, but something along those lines has to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually tested with this.getClass(), the only problem I potentially see it's maybe it too long and complicate for a log, so I use this.getClass().getSimpleName() instead, it ouputs the class name but not the package name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I remember that method now. getSimpleName() should work great for what we're looking for. I just wasn't sure whether it'd return "CommonMessengerAmbassador" or the name of the actual subclass, but if it does actually return the subclass name then that's exactly what we'd want!
Quality Gate failedFailed conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes look good to me, there might be some further cleanup that could be done w.r.t. the class names being used in logging, but I don't think that's worth holding this merge up. If you want to add the class name more broadly to the log statements as a prefix "<CLASS_NAME>: New instance registered of type ...." etc. then please do so, but I'll leave that up to you. I'll approve for now so you can merge whenever you're ready.
PR Details
Description
Implement carma messenger ambassador
Related GitHub Issue
Related Jira Key
CXC-88
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: