[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Synchronized threads

Posted on 1998-05-12
1
Medium Priority
?
203 Views
Last Modified: 2010-04-16
I have this class that is instantiated multiple times.  Each instance needs to talk to the com port.  The problem I am having is synchronized only works on one object.   So what I am trying to figure out is how get get a group of the objects to be syncronized together.  Each instance will have one com port to be used.  So if two instances are not using the same com port there is no reason to synchronize.  Also instead of a com port it might be a socket.  

In other words how can I group objects together to be synchronized.

0
Comment
Question by:micah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
knollc earned 400 total points
ID: 1220953
Hello,
  Try this:  have a static class that has one synchronized method: sendMsg().  On startup, have the static class grab on to the comm port, and all client objects wishing to send a message to the commport will use the static class' sendMsg() function.  Create one instance of the static class per COMM port that is available (I would name the class that hooks to a COMM port after the comm port it is controlling (ie, COMM1.sendMsg(SomeString), COMM2.sendMsg(SomeString), etc).  I hope this helps.

-Chris

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question