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

Potential issue with changes to src/main/java/JSR353/JSON/YahooFinanceStub.java! #7

Open
neomatrix369 opened this issue Mar 22, 2013 · 4 comments

Comments

@neomatrix369
Copy link
Member

  • 55
  •        // Implementation of JsonObject & JsonObjectBuilder in JSR-353
    
    56
  •        // Returns a Json object with a symbol and price - continuously
    
    57
  •        logger.log(Level.INFO, "JsonObject: {0}", getJSONObjectFromValues(symbol, price));
    
    58
    +
    59
  •        // Then pause for a bit...before starting all over again
    
    60
  •        pauseForABit(1000);
    
    61
  •    }
    
    62
  • }
    63

64

  • public void pauseForABit(int milliSecsToWait) { <===== from here
    65
  •    try {
    
    66
  •        Thread.sleep(milliSecsToWait);
    
    67
    +
    68
  •    } catch (InterruptedException ex) {
    
    69
  •        throw new RuntimeException( ex ); <===== till here
    

@karianna : This will blow out the back of the stack - are you sure you want to do this?

@ghost ghost assigned neomatrix369 Mar 22, 2013
@neomatrix369
Copy link
Member Author

@karianna: Can we use Timer and TimerTask instead of using Thread.sleep() to pause and repeat task?

@karianna
Copy link
Member

karianna commented Apr 5, 2013

You're better off using Threadpools and countdown latches. Timer and TimerTask are older concurrency constructs. Ping Ben for a quick tutorial/explanation

@neomatrix369
Copy link
Member Author

Okay thanks for the tips, is it worth looking at the adv java notes - i do recall these topics being covered!

@karianna
Copy link
Member

karianna commented Apr 6, 2013

I don't think we covered Semaphores in the course.... Nope, not explicitly. Have you got a copy of Java Concurrency in Practice? I'm afraid that my knowledge in this space is more theoretical than based on 10,000 hours of practice, so I'd recommend channeling Brian or chatting to Ben

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants