• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom events and listeners using a queue event

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I'm learning programming and I'm doing so by writing a program, I chose to write a server and chat client. I'm trying to stick with the MVC model. I have ran into a problem, In my server, I want my packets coming in, to be placed on and event queue. Now I think this is the best way to handle it, because I generate 2 threads for every connection and want to pass packets as events to the main controller. There are a bunch of examples of custom listeners and events using lists. Which I will do, if I can't use a blockingQueue to handle these packets or some form of a queue.

Here are a few questions I have:

1st Is it possible to use a queue? better yet a BlockingQueue?

2nd Can I send a packet from the client to the server (using a serialized packet) which I plan to have extend EventObject, if not, how should I handle this? I plan to have different types of packets don't know if this being passed as an event will create UNKNOWN problems? Example packet plan (if I have it right?)



3rd anyone have a good example of a custom Queue eventListener to help me understand?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic