|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AGIReusableProcessor
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:
EITHER
- contains no member fields,
OR
- contains only static member fields,
OR
- 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 agi=null; ... any other cleanup ... }public void processCall(AGIConnection agi) { try { //Use non-static member variable this.agi=agi; ... 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. clean(); } 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 |
---|
processCall |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |