Interface AGIReusableProcessor

All Superinterfaces:
All Known Implementing Classes:
ExampleProcessor, OrderlyQExample

public interface AGIReusableProcessor
extends AGIProcessor

You can develop proprietary applications by creating your own classes that implement this interface. Put the business logic in these classes.

These classes remain your property, and do not need to be disclosed to us, or released as open source.

On the other hand, if you find you need to modify or extend the other classes in this package, please do let us know.

We're also always very happy to hear how people are using this software, so please do consider telling us (confidentially) so we can stick a pin in our map - you'll make our day!

Objects implementing the AGIReusableProcessor interface are pooled and reused by the framework, resulting in greater performance.

Thread Safety
AGIReusableProcessors *DO NOT* need to be thread safe as the framework ensures that each processor is only called by one thread at a time (pooled threads and processors are used).

However, if you intend to implement this interface, you *DO* need to pay some attention to your member variables.

You should ensure that your class:

- contains no member fields,

- contains only static member fields,

- reinitialises all non-static member variables when processCall exits.

This can be achieved with a try-catch block enclosing all processCall statements as follows:

 public class MyReusableProcessor implements AGIReusableProcessor {
        AGIConnection agi = null;
 public void clean() {
                //Reinitialise all non-static variables
                ... any other cleanup ...
        }public void processCall(AGIConnection agi) {
                try {
                        //Use non-static member variable
                        ... start of process ...
                        //We might not wish to execute the whole process
                        if(some condition)
                                return; //early
                        ... rest of process ...
                } catch (Exception e) {
                        //handle exception (always a good idea in case the caller hangs up)
                } finally {
                        //This gets executed whether we return
                        //early or not.  
                return;         //normally
Please note that AGIReusableProcessors are NOT responsible for returning themselves to the ObjectPool; this is done for you by the AGIServer.

Method Summary
Methods inherited from interface com.orderlysoftware.orderlycalls.asterisk.agi.AGIProcessor