File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Node.JS like Functionality in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Node.JS like Functionality in Java" Watch "Node.JS like Functionality in Java" New topic
Author

Node.JS like Functionality in Java

Pratap koritala
Ranch Hand

Joined: Sep 27, 2006
Posts: 252
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.



Pratap koritala
Ranch Hand

Joined: Sep 27, 2006
Posts: 252
Let me know if the question is obscure or require more info.
Pratap koritala
Ranch Hand

Joined: Sep 27, 2006
Posts: 252
If it is not the suitable forum, Can this be moved to somewhere else ?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8418
    
  23

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


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10288
    
168

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.

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Node.JS like Functionality in Java