Jgroup examples - java

Is there a website which shows any jgroup code examples? The tutorial and manual on jgroups.org is not very good, and several cursory searches via Google, does not come up with much. I'm looking for examples of serializing objects and sending them over the channel to another JVM, etc.
Thanks in advance,
--Justin Richard Bleistein

Have you checked out the new tutorial at http://www.jgroups.org/tutorial-3.x/html/index.html ? It shows how to send (string) messages between cluster nodes.

Just a note .. if you are looking for simple and fast 1:N remoting and serialization give
http://code.google.com/p/fast-cast/ a try. I am actively supporting it in case of problems. It's order of a magnitude faster, especially when it comes to remote calls and serialization.

Related

Using Aeron with RSocket

Good morning,
I am trying to use RSocket on top of the Aeron transport protocol. However, it appears that there is no documentation on the topic - did anyone successfully integrate those two technologies together ?
Is it ready to be used or still a work in progress ?
Thank you very much.
I chatted with R-socket authors about Aeron's support. They say it's very deep in work in progress.
Currently, they have a big issue with converting R-socket byte buffers (they reuse Netty bb) to UnsafeByteBuffer from Agrona. So they have to copy from one to another just because there is no obvious copy-free converter.
So, answering your question:
Is it ready to be used or still a work in progress?
It's not ready to be used right now unfortunately =(

OData4J and AppEngine

Does anyone have a very simple example of using OData4J and GAE?
In the OData4J site there is a stub project for use in GAE...but doesn't really show how to expose entities out of the datastore as odata entities.
I may be missing something with that stub project(I'm sure I am)...but just need a little jump start on how to publish my persisted entities.
Thanks
MJD
Take a look at http://code.google.com/p/odata-appengine/
Maybe it's just what you're looking for.
the odata4j-appengine sample project in the repository shows how to expose existing appengine datastore kinds as odata open-typed entities.
See appengine-web.xml for how it's configured.
If you need any additional help, feel free to post to our discussion group at odata4j-discuss.
Thanks,
- John
unfortunately, it looks like no one has written and published such example code yet. google has only 127 results for odata4j "app engine", and the vast majority are unrelated mentions that happen to be on the same page.
so, you may be in unexplored territory here, at least as far as the internet is concerned. if you do end up writing example code yourself, feel free to post it here so others can benefit!

Is there a Java equivalent to libevent?

I've written a high-throughput server that handles each request in its own thread. For requests coming in it is occasionally necessary to do RPCs to one or more back-ends. These back-end RPCs are handled by a separate queue and thread-pool, which provides some bounding on the number of threads created and the maximum number of connections to the back-end (it does some caching to reuse clients and save the overhead of constantly creating connections). Having done all this, though, I'm beginning to think an event-based architecture would be more efficient.
In searching around I haven't found any equivalents to libevent for Java, but maybe I'm not looking in the right place? Mina-statemachine from Apache was the closest thing I found, but it looks more verbose than I need and there's no real release available.
Any suggestions?
I am a bit late but:
Have you looked at Netty?
Or Grizzly.
How about the Light Weight Event System? :) http://www.lwes.org/ and http://sourceforge.net/projects/lwes/files/
The answer seems to be 'no', though it looks like the Ruby EventMachine library provides a Java implementation for JRuby users that might be usable or at least serve as inspiration for writing my own:
http://github.com/eventmachine/eventmachine/tree/master/java/
You might be looking for a workflow engine like
JBPM or any other open source tool listed here.

Java concurrent recursive website download

I need to do a program to download the webpages, that is, I give a webpage to the software and it would download all the files in the website.
I would pass also a level of depth, that is, the level where the software goes download each file of the website.
I will develop this software in Java and I need to use concurrency also.
Please, tell me your opinion about how to do this.
Thanks for the help.
Thanks to everyone for the help.
I need to ask one more thing. How do I do to download a file from the website?
Thaks one more time. =D
A very useful library for spiders and bots: htmlunit
Well, this is a bit hard to answer without knowing how detailed guidance you need, but here's an overview. :)
Java makes such applications quite easy, actually, since both HTTP-requests and threading are readily available. My solution would probably involve a global stack containing new urls, and a farm of a constant number of threads that pop urls from the stack. I'd store the urls as a custom object, so that I could keep track of the depth.
I think your main issue here will be with sites that doesn't respond, or doesn't follow the HTTP standard. I've noticed many times in similiar applications that sometimes these doesn't time out properly, and eventually they end up blocking all the threads. Unfortunately I don't have any good solutions here.
A few useful classes as a starting point:
http://java.sun.com/javase/6/docs/api/java/lang/Thread.html
http://java.sun.com/javase/6/docs/api/java/lang/ThreadGroup.html
http://java.sun.com/javase/6/docs/api/java/net/URL.html
http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html
I would look at this recourses:
http://hc.apache.org/httpclient-3.x/
http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html
http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/package-summary.html
I would have a look at the Java Executors package. You create a set of tasks (Runnables) and pass them to a suitable chosen Executor. You get a Future back and you can then query this for its result.
The Executor will coordinate when this Runnable is executed. Implementations exist for single-threaded executors, executors with a pool of threads etc. So you don't need to worry (too much) wrt. the threading intricacies. The concurrency utilities will look after this for you.
Apache HTTP Client will look after the HTTP querying for you.

Where can I find an AS400 to Java interface?

Does anyone have links and resources to connect to an AS400 from Java?
I remember years ago, somebody told me about a connector that simulates KeyStrokes from the keyboard and other "purest" approach that connected directly.
On the web I have found a lot of links, but I cannot find a complete product to do this (I am probably not using the right keywords).
EDIT
Thanks for the answers:
What we are looking for is a way to access the data inside the AS400 and/or the screens it uses and expose them for other new applications re-use. Either as a webservice of some sort, or directly through Java ( and java will expose the operations using webservices )
Thanks in advance.
EDIT
As per MicSim post, I've also found this link:
http://www.ibm.com/developerworks/library/ws-as400/index.html
What you are looking for is probably the Toolbox for Java™ & JTOpen from IBM. There is also an AS400 class in the toolbox for performing specific AS400 tasks. You can look here and here for more details. Just googled it and hope it's helpful.
IBM's 5250 screen-scraping technology was "WebFacing" - I would post a link but you're probably better off Googling it, since IBM's documentation is so scattered. There are other technologies available too but: Screen-scraping was never anyone's favourite since typically you end up with something which, although it looks more up-to-date, actually is harder to use than a green screen and no more functional. The 5250 is probably the single best data entry platform I've ever used - web forms in a browser are one of the worst.
As mentioned, jt400 is the way to go for most other things. In particular:
JDBC - for all things SQL. If you do it right and address your files as though they really are tables, it's a way to get away from the 400 entirely.
Record-level access - write Java programs using a similar database API to RPGLE (all those chains, setlls that 400 programmers love)
Call programs, system commands, manage resources (data queues, data areas, prints / spools, jobs etc etc)
Good luck
If you just want to run Java on the AS/400 (or iSeries, or System i, or whatever IBM's marketing department has decided to call it this month), that's a supported language. You can access the pseudo-DB2 database directly. Or are you after some other form of integration?
This obviously depends on what you want to do, however if you want to simulate keystrokes across a network connection to an AS400 process then Expect4j may be the library you are looking for.
This is generally a really nasty hack though and there are frequently better ways to achieve your goals. What are you trying to do?
The expect4J library can be found here. Expect was originally a unix command that allowed you to specify a string that you are expecting to see and then a string of characters to return. It was frequently used for automating logins etc and for screen-scraping applications.
Even better is the TN5250j Console, which can be used to extract data from the AS/400.
jacada makes tools to do what your looking for
http://www.jacada.com/

Categories

Resources