Skip to Content »
online discount medstore
advair diskus for sale
buy advair diskus without prescription
allegra for sale
buy allegra without prescription
aristocort for sale
buy aristocort without prescription
astelin for sale
buy astelin without prescription
atarax for sale
buy atarax without prescription
benadryl for sale
buy benadryl without prescription
buy clarinex without prescription
clarinex for sale
buy claritin without prescription
claritin for sale
buy flonase without prescription
flonase for sale
buy ventolin without prescription
ventolin for sale
amoxil for sale
buy amoxil without prescription
augmentin for sale
buy augmentin without prescription
bactrim for sale
buy bactrim without prescription
biaxin for sale
buy biaxin without prescription
buy cipro without prescription
cipro for sale
buy cleocin without prescription
cleocin for sale
buy dexone without prescription
dexone for sale
buy flagyl without prescription
flagyl for sale
buy levaquin without prescription
levaquin for sale
buy omnicef without prescription
omnicef for sale
amaryl for sale
buy amaryl without prescription
buy cozaar without prescription
cozaar for sale
buy diabecon without prescription
diabecon for sale
buy glucophage without prescription
glucophage for sale
buy glucotrol without prescription
glucotrol for sale
buy glucovance without prescription
glucovance for sale
buy micronase without prescription
micronase for sale
buy prandin without prescription
prandin for sale
buy precose without prescription
precose for sale
buy cialis professional without prescription
cialis professional for sale
buy cialis soft without prescription
cialis soft for sale
buy cialis super active without prescription
cialis super active for sale
buy cialis without prescription
cialis for sale
buy levitra without prescription
levitra for sale
buy viagra professional without prescription
viagra professional for sale
buy viagra soft without prescription
viagra soft for sale
buy viagra super active without prescription
viagra super active for sale
buy viagra super force without prescription
viagra super force for sale
buy viagra without prescription
viagra for sale
buy celebrex without prescription
celebrex for sale
buy colcrys without prescription
colcrys for sale
buy feldene without prescription
feldene for sale
buy imitrex without prescription
imitrex for sale
buy inderal without prescription
inderal for sale
buy indocin without prescription
indocin for sale
buy naprosyn without prescription
naprosyn for sale
buy pletal without prescription
pletal for sale
buy robaxin without prescription
robaxin for sale
buy voltaren without prescription
voltaren for sale

Tech Life of Recht » Fun with JXTA

 Fun with JXTA

  • October 26th, 2009
  • 10:46 pm

Recently, I’ve been messing around with JXTA – one of the things you might have heard about at some point (like JINI, for example), but never really given any thought to. Probably rightly so, because it’s only interesting if you do any kind of P2P. And not just human peers.

Anyways, we’re planning on using JXTA to create a distributed version of one of our big monolithic systems. The data model has been modified to support distribution, and we’ve had a prototype running with hardcoded communication channels. However, JXTA makes everything much more dynamic, and it also introduces the concept of rendezvous and relay nodes so all nodes don’t have to be on the same network – they don’t even have to connect to each other directly. Pretty sweet stuff.

It turns out, however, that the JXTA documentation really doesn’t explain everything, so I have two things I want to share – not that I expect them to be useful to very many people.

The first thing is really just a problem rather than a solution. I develop on a nice Macbook Pro Santa Rosa. I don’t particularly like Apple (as in not at all, actually. Developer-wise, they might even be higher on the hate-list than Microsoft), so I’ve removed OSX entirely and installed Ubuntu instead. Now you might ask why I then use a Macbook at all, but it turns out that they make pretty good hardware, so I go with that. Incidentally, I also have an iMac at home, also running Ubuntu. It turns out that this is a problem in one single regard: When I have the wireless network enabled and start a JXTA application, the kernel will freeze. Every time. And there will be no errors in any log files. Nothing bad happens if I use wired network or a 3G modem – which is my solution until now. Of course, it seems that nobody in the whole world has ever had this problem, so there’s not much chance of getting it fixed (and where do you report such a bug?).

The other thing that’s been consuming quite a lot of my time is JXTASockets. JXTASockets are basically regular Java sockets running over JXTA. Instead of connecting to a specific host on a specific port, you simply ask JXTA to give you a socket to an abstract host identifier. JXTA will then route the request to the appropriate host, and then you can send and receive data. Except for the connect phase, it works just like a normal socket. Except not entirely. In many cases you would do something like on the server side:

[code]
JXTAServerSocket server = new JXTAServerSocket(…);
while (true) {
JXTASocket socket = server.accept();
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();

int b = -1;
while ((b = is.read()) > -1) {
// buffer bytes
}
is.close();

byte[] res = handleRequest(buffer);
os.write(res);
os.close();
socket.close();
}
[/code]

And on the client side something like this:
[code]
Socket socket = new JXTASocket(…);
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();

os.write(generateRequest());
os.close();

readResponse(is);
is.close();
socket.close();
[/code]

Of course, all sorts of error handling, buffering, and other stuff is missing, but the overall procedure should be clear: the client writes to the output stream and closes it. The server reads from the stream until it has been closed. The server then generates a response and writes it back. Add the appropriate resource handling, and this will work using normal sockets, but it will not work with JXTA. And no, it is not obvious why. In fact, I think the plot of “A Serious Man” is more obvious, and if you’ve seen the movie, you’ll probably agree with me that it is, indeed, not obvious at all.
The problem with JXTA turns out to be that both streams must be open all the time. If you, for example, close the output stream on the client side to signal that there is no more data, the server side will simply get a read timeout at some point. This basically means that you cannot use a closed stream to signal the end of the data stream, so instead you have to write the data length to the stream first, and then the data. The receiving side can then read the data length first, and then read the actual data accordingly. Which is not bad, it just sucks when you’ve spent so many hours debugging that read timeout.

6,974 People had this to say...

Gravatar
  • 72-10
  • July 22nd, 2016
  • 2:59 am

鈥?Irika berjalan mendekati mangsanya,鈥?Rizan adalah rakan lama Irika sebelum dia menjadi pembunuh bersiri,鈥?puji ayahnya kepada si Abang Mekanik.Malam semakin larut. Betul ke? Soal Firash dalam keadaan blurr.鈥淓h.awalnyaNi siapa yang nak balik kampung awak atau saya鈥?kata Hayati sambil duduk di sebelah aku鈥淜enapa lambat鈥?tanyaku鈥淓hm alasan seperti biasa trafik jam鈥濃€淢esti gembirakan dapat balik kampung kanSekarang mesti awak tak sabar-sabar nak balik jumpa mak dan ayah awak kan鈥?Hayati hanya senyum sahaja mengiakan kata-kata aku itu 鈥淪o sekarang Hayati macam mana dah okey ke鈥濃€渟emuanya dah okeySaya nak mulakan hidup baru鈥?Azam Hayati 鈥?Selepas ni kita pasti tak akan bertemu lagikan鈥滱ku diam sahajaAku tahu kami tak akan bertemu lagiItu sudah pasti鈥淧asti saya rindukan awakyalah kita kankawanAwak pun sudah banyak menolong sayaSaya tak tahu nak macam mana nak balas budi awak kepada saya鈥?kata-kata itu amat menyedihkan akuSebab sehingga sekarang dia hanya menganggap aku ini adalah kawannya sahajaTidak lebih dari ituWalaupun aku mencintainya kedudukan aku padanya tidak berubahHanya serorang kawan鈥淜alau awak ada masa hantarlah surat atau call ke atau hantar je email lagi senangkan鈥濃€淏etullah鈥?kata Hayati bersetujuSedang kami berbual bus pun sampaiHayati bersiap untuk berangkat pulangSemakin hampir dengan perpisahanHendak sahaja pada masa itu aku luahkan perasaan yang telah aku pendam selama iniKenapa sukar untuk aku menyatakan tiga perkataan itu kepadanya Kenapa sampai sekarag aku masih lagi tak mampu berbuat demikian lidah aku keluNampaknya aku terpaksa melepaskan sahaja Hayati pergiBiarlah dia pergiBiarlah dia bahagia dengan jodohnya nantiCinta aku ini bukanlah untuknyaCintaku ini hanyalah bayangan hayalan semata-mataWalau sekuat mana sekalipun cintaku ini tapi jika dia bukan untukku aku pasrahAku serah sahaja kepada Tuhan kerana dia sahaja yang menentukan segalaHayati sudah berada di dalam bus ituAku pula hanya memerhati Hayati sambil menunggu keajaiban berlaku pada masa ituBas sudah mula bergerak dan beredar dari situHayati melambai-lambai tangan tanda selamat jalanAku pula membalas lambaiannya sambil tersenyum pahitAkhirnya Hayati telah pergiBus itu sudah hilang dari pandangan aku dan kekecewaan yang amat dalam terasa di hatikuSelamat jalan Hayati semoga kau bahagiaAku membuka pintu keretaku dan kala itu aku terima sms dari seseorangIanya dari HayatiAku membukanya dan yang tertera adalah satu pesanan yang ringkas鈥楽aya cintakan awak鈥橦atinya bukan untukku.Kadang-kadang dia juga menolong ibunya menyirami bunga-bunga ini.Qistina banyak menceritakan tentang Adam kepada Reen.
72-10

Gravatar

Tech Life of Recht » Blog Archive » Fun with JXTA
[url=http://www.g4a6qr45ol73hay08v054v0mv59fra07s.org/]ujhizdgsvz[/url]
ajhizdgsvz
jhizdgsvz http://www.g4a6qr45ol73hay08v054v0mv59fra07s.org/

Gravatar

Now there simply no broadening a car or truck if you own a repair service.However sitting on anyone, placed a single hands beneath a person leg at a stretch, and even rise typically the leg further up two or three 鈥? You can expect to believe any reach along at the rearfoot, dropping ott of one鈥檚 bottom.
jordan 72-10

Gravatar
  • Jim
  • July 22nd, 2016
  • 5:36 am

I have been surfing on-line more than three hours lately, yet I never found any attention-grabbing
article like yours. It’s lovely value enough for me.
In my opinion, if all webmasters and bloggers made excellent content as you
did, the internet can be much more useful than ever before.

my web-site: Jim http://www.yahoo.net

Gravatar
Gravatar

I savor, result in I discovered just what I was looking for. You have ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye
Space Jam 11s

Gravatar

leta pi?incredibile di sempreChaque semaine Je vais vous le dire tr猫s calmement, Il a fait jouer les plus grands comme Meryl Streep.
vera bradley

Gravatar

Each of our performers are generally the particular top in the market, and still have designed pictures with regard to customers which include the affluent and celebrities, major real estate investment builders, resorts, eating places, museums and galleries, globally renowned interior designers, and also, most importantly, specific art lovers throughout the world!
vera bradley

Gravatar

Geez just found those Smart Balance Wheel‘s such as rigt nowadays i seemed to be death to be able to suitable a comparison,such as i had produced also !!. It absolutely was the best Smart Balance Wheel we possibly got it is rather comfrarable,fashionable.My friends received individuals i absolutely needed to buy them very .I used as being a couple of my local freinds 10 several and was just a little tight and had been donned within,webpage for myself Tested an example of my counterparts dimension 9 and was actually a tad remove however instant messaging Stil small now your little feet is likely to get bigger a tiny bit. well, i bought 6 though for via the internet the software said to have 10.Though this 9 is giant and so the volume seemed to be kind of challenging,still several other subsequently that I Enjoy it !! I will in addition recomend to receive theSheepskin Guard at first after i spraid individuals i’m reluctant because relating to all the cheasnut color and this received types of darker when i didnt do too much of the particular showering and yet similar 5 minutes doing it went back to its unique coloration.So i’m therefore departed to give these.And might DEFFITATly by way of these folks ,they are woth the charge(:

Want your say?

* Required fields. Your e-mail address will not be published on this site

You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>