Hi, 1 -> too time consuming. Forget it. 2 -> ok. SMSServer works this way. 3 -> won't work. One serial port can't be used by >1 parties - access is exclusive.
On 22 March 2010 21:14, najgor++ <[email protected]> wrote: > I have two threads: the first one periodically checks for new messages > and stores them in DB; and the second one periodically sends prepared > messages from DB (if there is any). Sleep time for each thread is like > 60 seconds. I am using modem connected on serial port (huawey e1550). > > There should be one Service instance per application (as stated in the > doc). > > Would you be so kind to tell me what would be the best practice in > your opinion: > > 1) to start/stop service each time one of the threads wants to check/ > send sms; and to have a lock on this service instance so it can not be > shared? > > 2) to have one service and add one gateway that will be used by both > threads? Is this possible, or should I also add a lock on single- > gateway usage? This also means that while one thread is running the > other one will not work. > > 3) to have one service and have two gateways, one for each thread - > one for sending, one for receiving; no additional locking is needed... > This also means that it may happens that two thread access the server > (and therefore the port) in the same time and that might not be ok. > > So, would it be #1, #2, or #3? > > > > -- > You received this message because you are subscribed to the Google Groups > "SMSLib User Group" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<smslib%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/smslib?hl=en. > > -- You received this message because you are subscribed to the Google Groups "SMSLib User Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/smslib?hl=en.
