Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Chapter 7, Question 17  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the code of question 17, I chagne 100 bu 10000000 in the for loop.
And guess what happened?
i got this!!!
9947604 9948034
If someone can explain me this.
Thank you

 
Sheriff
Posts: 23963
50
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You print those values before you call the service's shutdown() method, so it's possible that the service hasn't processed all of its executions yet.

At least... I'm answering one question you didn't ask, namely why isn't either of the values 10000000? Another question you didn't ask is why aren't the two values the same, but I chose not to answer that.

It's impossible to answer why the first value is 9947604 and not some other value, for example 9947623. I think you actually asked that question, but it's quite likely you meant to ask one of the other questions which I chose.

Also, if you're asking about a question in a certification exam, please tell us which exam and post the whole question.
 
vincent Lepore
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Thank you for your answer.

It was the Question 7 from chapter 7 of the OCP study guide written by Jeanne BOyarsky and scott Selikoff.

The value numbers were not so important.

I just wanted to know why i didn't get 10000000 10000000 .
And you gave me th e explanation

Thank you very much.
Vincent

 
vincent Lepore
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul,

I updated the code, putting in comment the line below.
//if(service != null) service.shutdown();
Of course, it hanged at runtime.

But it didn't display 10000000 10000000.
It display values lower than 10000000 and different for sheepCount1 and sheepCount2.

So it seems that the service.shutdown() would not be the explaination of this result.

If someone has an idea.
Thanks
Vincent
 
Master Rancher
Posts: 3036
106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Vincent,

this question was raised before. Have a look at this topic:
same question
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!