Link to home
Start Free TrialLog in
Avatar of krakatoa
krakatoaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Threads.

Is there any difference for the calling class, in run()ning a Runnable, or start()ing a Thread? By which I mean, is there any difference in the conditions under which control returns to the calling class between a Thread and a Runnable.
ASKER CERTIFIED SOLUTION
Avatar of TimYates
TimYates
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Because you have to add a Runnable to a Thread, which is basically the same as subclassing a Thread and running it
And if you are using Java 1.5, there are the new Executor classes as well :-)

http://www.ftponline.com/javapro/2004_08/online/bgoetz_08_04_04/
Nothing to add to that beyond chipping in with something irrelevant - done much JSF yet Tim? (sorry krak ;-))
Not yet...it's on my list of things to do, but I haven't got past Struts at the moment :-/  Any good?
Actually i *do* have something to add: it's acctually better for design reasons to use Runnable, as, for reasons i'm not going into now, it's better to use interfaces than to create subclasses. So prefer implements Runnable over extends Thread

>>Any good?

Well i was hoping you could tell me - perhaps we'd better continue this (briefly) offline? c j AT p r o t e a n i t DOT n e t
Avatar of krakatoa

ASKER

OK - I was asking mostly for return of control reasons, as I said, but also to remind myself (lol), why I'd done this :

Thread fileProcessThread = new Thread(new USender(filetogo));

instead of

Runnable fileProcessThread = new Runnable(new USender(filetogo));

where USender is a class implementing Runnable.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
8-)
Hey Tim!

(looks like I caught the "second-agenda" bug from CEHJ  : ))      ) ......


I don't know if you recall a longish time ago now I was looking around for people to help on a few things with an IM client I was putting together. You expressed some interest, but laughed at the port / firewall conundrum that you would face if you attempted to run it - which was fine and understandable, and it was left there.

I just wanted to ask you now though, since you are behind those firewalls, if you might have any idea about how I would go about getting my app working in a typical commercial environment with similar security / firewall restrictions, in case one day the app ends up in such a setting. Would I need proxies, or ... well... I can't guess really. Any thoughts you might have would be much appreciated ....

And I am still developing it BTW (;)) , kicking it around with one or two programmers now and again ... ;)

(Sorry about the "mini-spam" from this CEHJ ) ;)

and thanks Tim. ;).
( You must need some relief from your DNA layout manager by now !? ;))  )
I think what you would need, is for your IM application to have the ability to connect on Port 80 (instead of the usual port you are using).

This would mean that you would need to run a public proxy on port 80 at some publically available address...  This could either be a standalone server, or a servlet.  Then, the end user would fire up their IM, it would connect to the servlet, and the servlet would connect them to the chat server (and pass-through any data sent to or from the client straight to the correct client, or the server)

then I believe it all should work (as port 80 is usually open)...  The only problem you may then hit is that some people (here included) have web monitoring/blocking software installed, so the packets may get blocked if the IT admin staff believe them to be bad/non work related...

But that's another story, and there's not much you can do about that...

>  You must need some relief from your DNA layout manager by now !? ;))

Hehehe, ta ;-)  Yeah, got all that finished, and wrapped up as a JComponent/JavaTag so I can just embed it into JSPs as I fancy :-)  Now time to write the Hibernate layer for our big sequence alignment database :-)  (and see how Hibernate copes with it before possibly scrapping it and going for plain SQL) :-D ;-)

Hope I helped a bit?

Tim
>> Hope I helped a bit?  ...

of course you did; many thanks.

It's not an area I have ever delved into (proxies et al I mean) but then again, I know so little anyway that I could say that about most things I do. LOL! ;)

For one thing, I assume you mean a publicly available proxy being a server / let outside of the 'client's' space? If it were a servlet, I further assume you mean that it would do some translation of clients' requests and ensure they go to the right port(s) on the IM server?

Ooh , sheep and lambs and hanging ! .... could a similar thing be done straight from the IM server itself by recoding to do "http tunnelling" - or am I just using jargon I don't understand ? lol.
Good to hear about your work.


thanks again

k.
HttpTunneling is exactly what the servlet would do :-)

> For one thing, I assume you mean a publicly available proxy being a server / let outside of the 'client's' space?

Yeah, so hosted by you, allowing IM instances to connect to it on Port 80 :-)

I only suggested a servlet, as you may already have a webserver running on port 80 of your machine, so putting a servlet into it would be less hassle (perhaps) ;-)

If this is not the case, then maybe the IM server could listen on port 80?
>> If this is not the case, then maybe the IM server could listen on port 80? ...

I guess it could, indeed.

(I already have visions of bedlam when I think about the amount of redirection I'd need to do though).

I have to start to look at it, because it seems it would be a requirement. Thanks for all your help; maybe I can repay you a little by giving some of my DNA to play with? Nah ... if you've got a nematode lying around somewhere, you can get the same from it instead. ;))

Best regs

k.

CEHJ : - To make up for the spam , and as I see you like chat clients, please feel free to have a go with mine ! Ha, ha! ;)
> if you've got a nematode lying around somewhere, you can get the same from it instead. ;))

Hehehehehe! :-D

Good luck with it! :-D

Tim
Tim .....   (he said, speaking softly and in whispers (so that's really quiet)),

I don't suppose sometime, somehow, or other, you be willing, even able, to take a shuftee at my app with us by chance? I'd really truly appreciate your thoughts on what you see and what it does as I know how skilled you are in this whole science, and its many arts. ;)

I have been on and off using it with our mutual friend (the one above in this present Question, y'know, he of #2 fame) ;) It would be really great if you could spare a half hour sometime or other!

I have a 'publicly available' point of contact, viz: wwwDOTfuturemindsDOTcom if you like.

Otherwise, thanks v much again, and kind regards.

k.
Yeah sure :-)  I'm a bit busy at the moment though, trying to get another website launched (and hibernate is playing silly buggers) ;-) But I'll try and help if I can :-D

Email sent :-)

Tim
:) ... Ok Tim ... anytime will do!

rgs.,

k.
Are you still in the middle of your Hibernate snafu Tim or are you there? ;-)
Hehe, had to move back to bugfixing the other webapp...  Mmmmm...DHTML and applets...  

I think my brain is about to leak out of my head ;-)  

Hibernate to javascript to servlet comms in 30 minutes == mind boggling ;-)