Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Node.JS like Functionality in Java  RSS feed

 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the good thing about the Node.JS is, it never idles ( in a single thread too).
For ex: If you're fetching a Url content, Node.JS actually doesn't block on it. It goes on with other execution.
And once the content is fetched, your callback will be invoked.
The good thing is,There is no explicit context switching from the OS as it runs within the VM ( V8 engine).


Is there away to achieve this kind of functionality in Java.
The whole purpose is not to use thread, which causes context switching and synchronization cost.
I've following use case, which I think can benefit from this,

Ex:
There is a Java service ( more like a Facade) and which internally calls other independent remote services and accumulates the data.
It is actually blocks on the response of each service, so the total response is cumulative rather than the highest blocking response of a service.



 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me know if the question is obscure or require more info.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is not the suitable forum, Can this be moved to somewhere else ?
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pratap koritala wrote:If it is not the suitable forum, Can this be moved to somewhere else ?


Can you suggest where? Node.js is based on JavaScript, which is NOT Java, despite the similarity in name.

It's possible that somebody is trying to re-invent this wheel in pure Java, but I don't honestly know what the best of our forums would be. If you'd like to suggest one, I'll be happy to move it for you.

Winston
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not much familiar with node.js, but I do know that one of my ex-colleague is leading the vertx.io project, which I think is similar.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!