• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    RejectedExecutionException

    BACnet4J general discussion
    4
    7
    4.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      codemonkey
      last edited by

      Hi
      I found an exception in my application log:

      java.util.concurrent.RejectedExecutionException
      at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.reject(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.execute(Unknown Source)
      at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.run(IpMessageControl.java:431)

      Maybe just need to add catch for that exception, it occured when multiple threads were asking one device.

      1 Reply Last reply Reply Quote 0
      • R
        robert bouwens
        last edited by

        hi,
        if you just add that particlar catch block then you loose messages.
        you need to 'keep' the message and issue a simple sanity sleep.
        a third of the timeout in the ipMessageControl !?!

        it is hard to reproduce errors ...
        a few hours back a segment ack was not send for one reason...

        maybe you tell us what hw & sw environment you use

        robert

        1 Reply Last reply Reply Quote 0
        • M
          mlohbihler
          last edited by

          Robert is correct: you want to know about those errors. The only reason an execution would be rejected is because the thread pool was full. This is curious since the implementation uses a default pool constructor that sets the maximum pool size to Integer.MAX_VALUE, which would be difficult to reach.

          Best regards,
          Matthew

          1 Reply Last reply Reply Quote 0
          • R
            robert bouwens
            last edited by

            hi codemonkey,

            give the folowing snippet a try:

            
             
                // For receiving
                @Override
                public void run() {
                    boolean bProcessed;
                    int loopCounter;
                    IncomingMessageExecutor messageExecutor;
                    byte[] buffer = new byte[MESSAGE_LENGTH];
             
                    DatagramPacket p = new DatagramPacket(buffer, buffer.length);
            
                    while (!socket.isClosed()) {
                        try {
                            loopCounter = 0;
                            bProcessed = false;
                            
                            socket.receive(p);
                            messageExecutor = new IncomingMessageExecutor(p);
                            while(!bProcessed && loopCounter < 3)
                            {
                            	try
                            	{
                            		loopCounter++;
                            		incomingExecutorService.execute(messageExecutor);
                            		bProcessed = true;
                            	}
                                catch (RejectedExecutionException ex)
                           		{
                                	ex.printStackTrace();
                                	try
            						{
            							Thread.sleep(timeout / 3);
            						}
            						catch (InterruptedException e)
            						{
            							e.printStackTrace();
            						}
                           		}
                            }
                            p.setData(buffer);
                        }
                        catch (IOException e) {
                            // no op. This happens if the socket gets closed by the destroy method.
                        }
                    }
                }
            
            

            it is the the modified procedure run in the ipmessagecontrol.java file.

            can you post the results of your tests here?

            thanks
            robert

            1 Reply Last reply Reply Quote 0
            • C
              codemonkey
              last edited by

              Thank you for replying.
              I'm testing latest bacnet4j version from CVS with BACnet Simulator.
              I will test this code and post reply when exception appear.

              1 Reply Last reply Reply Quote 0
              • G
                gogularajasekhar
                last edited by

                Did anyone tried this solution from Robert? If yes, please let me know.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post