Synchronize everything?

I have a singleton class that functions as a gateway to a real (mobile) device. I want to ensure that command sequences to the device happen in the correct order, so I've synchronized almost all methods within the class. Is there a better approach?
[256 byte] By [EvilBroa] at [2007-11-26 19:09:10]
# 1
Don't use threads if you want sequential instead of parallel processing.
CeciNEstPasUnProgrammeura at 2007-7-9 21:03:48 > top of Java-index,Java Essentials,New To Java...
# 2

> I have a singleton class that functions as a gateway

> to a real (mobile) device. I want to ensure that

> command sequences to the device happen in the correct

> order, so I've synchronized almost all methods within

> the class. Is there a better approach?

Sounds like you are waiting for a deadlock to happen.

kajbja at 2007-7-9 21:03:48 > top of Java-index,Java Essentials,New To Java...
# 3

> Don't use threads if you want sequential instead of

> parallel processing.

There are areas that need parallel processing (imho). I don't want to stop monitoring alarmstates just because I'm parsing an Sms message. What I do need to do is ensure 'single' actions that in reality comprise of multiple commands are handled by the class as a single action.

EvilBroa at 2007-7-9 21:03:48 > top of Java-index,Java Essentials,New To Java...
# 4
Shouldn't the class in that case have methods that takes a list or an array of commands as argument?Kaj
kajbja at 2007-7-9 21:03:48 > top of Java-index,Java Essentials,New To Java...