nguyenbahuong / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

Remove duplicate code in CNMIEmulatorProcessor #476

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The CNMI Emulator class and the AsyncMessageProcessor class perform about the 
same action: reading messages from the modem when required to do so.

I propose to modify the code of the CNMI EMulator.  The class no longer reads 
the messages from the modem but signals the AsyncMessageProcessor that it 
should check for new messages

Here is the modified code for the process method of the Cnmi Emulator.  I 
included my additions between // WIm Stevens
The original code has been commented out

public void process() throws Exception
        {
            Logger.getInstance().logDebug("CNMI emulator cycle.", null, getGateway().getGatewayId());
            if ((isConnected()) && (getGateway().getStatus() == GatewayStatuses.STARTED))
            {
                // Wim Stevens
                getAsyncMessageProcessor().setProcess();
                /*
                synchronized (getSYNCInboundReader())
                {
                    this.msgList = new ArrayList<InboundMessage>();
                    getGateway().readMessages(this.msgList, MessageClasses.ALL);
                    for (InboundMessage msg : this.msgList)
                    {
                        switch (msg.getType())
                        {
                            case INBOUND:
                            case STATUSREPORT:
                                Service.getInstance().getNotifyQueueManager().getNotifyQueue().add(new InboundMessageNotification(getGateway(), msg.getType(), msg));
                                break;
                        }
                    }
                    this.msgList.clear();
                }
                */
                // End Wim Stevens
            }
        }

Original issue reported on code.google.com by wim.stev...@gmail.com on 20 Mar 2012 at 10:30

GoogleCodeExporter commented 9 years ago

Original comment by admin@smslib.org on 1 Jan 2014 at 9:25

GoogleCodeExporter commented 9 years ago

Original comment by thana...@smslib.org on 26 Apr 2014 at 10:09