• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multithreading/Threads necessary? Not sure...  RSS feed

 
James Brooks
Gunslinger
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

OK, for my from-scratch FTP client/server program, I'm going to want the ability to have parallel instances executing at the same time (in a single multiple tabbed window). Should I look into multithreading for my app to have this capability? I'm not 100% sure because my basic/intermediate, as well as my Java Data Structures book tread very lightly on the subject. It looks as if threads are mainly used within the same program, not really for different instances of the same program.

Thanks, as usual!
[ February 04, 2008: Message edited by: Patrick Brooks ]
 
Tarek Khojah
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read this and the other topic concerning threads.

I'm not quiet sure I understand what you're trying to do? How do you want multiple instance to run in the same window?

By "multiple instances", do you mean serve more than one client?

In any case, any server (that I can think of) needs to be multi-threaded.

If you're not comfortable with threads, start with something simple, here's the general idea:

http://en.wikipedia.org/wiki/Thread_pool_pattern

Explicitly create the threads and the data structure (the "queue") and handle the whole thing with .wait() and .notify()

I haven't used executors myself, but they're also something you might want to look into using.
 
James Brooks
Gunslinger
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I guess it would involve a JTabbedPane, and the different tabbed pages would each contain an interface for an FTPServer instance. What I originally thought would be a somewhat difficult project has quickly turned into a nightmare; creating the server was the easy part!
 
Tarek Khojah
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean, each pane will represent a connection with a client, correct?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!