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

Address comments for PR #57 #59

Closed
wants to merge 4 commits into from

Conversation

dan-du-car
Copy link
Contributor

@dan-du-car dan-du-car commented May 9, 2024

PR Details

Description

This PR is to address some comments left on PR: #57.
Below is the list of comments to be addressed:

Related GitHub Issue

NA

Related Jira Key

NA

Motivation and Context

NA

How Has This Been Tested?

NA

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@dan-du-car dan-du-car changed the title Address comments for PR https://github.com/usdot-fhwa-stol/carma-cloud/pull/57 Address comments for PR #57 May 9, 2024
@@ -158,7 +158,9 @@ public void init(ServletConfig oConfig)
protected void doGet(HttpServletRequest oRequest, HttpServletResponse oResponse)
throws ServletException, IOException
{
long lNow = System.currentTimeMillis();
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be replaced with the following :

long lNow = TimeSource.getInstance().currentTimeMillis();

@@ -449,7 +451,9 @@ private void addControl(HttpServletRequest oReq, HttpServletResponse oRes)
{
try
{
long lNow = System.currentTimeMillis() - 10;
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long lNow =TimeSource.currentTimeMillis();

@@ -561,7 +565,9 @@ private void saveEdit(HttpServletRequest oReq, HttpServletResponse oRes)
{
try
{
long lNow = System.currentTimeMillis();
Object timeObj = this.getServletContext().getAttribute(TimeSource.class.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

m_oTs.m_lSimTime = lStep;
}
LOGGER.debug(String.format("seq: %d timestep: %d timesource: %d", lSeq, lStep, m_oTs.currentTimeMillis()));
this.getServletContext().setAttribute(TimeSource.class.getName(), m_oTs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to call setAttribute here. We are already setting the value of this member variable.
Also I think we should write a set method for TimeSource which throws an exception when not in simulation mode and maybe a warning when we are setting time backwards. What do you think

<description>OPTIONAL: Network port for simulation ambassador. Leave undefined for normal time operation.</description>
<param-name>ambassadorPort</param-name>
<param-value>1617</param-value>
</init-param>

<init-param>
<description>REQUIRED: Only needed if ambassador address is defined. URL where ambassador sends time sync messages.</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is optional now right

@paulbourelly999 paulbourelly999 marked this pull request as draft May 16, 2024 14:28
@paulbourelly999
Copy link
Contributor

Changes reflected in #57

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.

2 participants