|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.asteriskjava.fastagi.AgiServerThread
public class AgiServerThread
Runs an AgiServer in a separate Thread.
You can use this class to run an AgiServer in the background of your application or run it in your servlet container or application server.
By default the thread used by this class is marked as daemon thread, that means it will be destroyed when the last user thread has finished.
Constructor Summary | |
---|---|
AgiServerThread()
Creates a new AgiServerThread. |
|
AgiServerThread(AgiServer agiServer)
Creates a new AgiServerThread that runs the given AgiServer . |
Method Summary | |
---|---|
protected java.lang.Thread |
createThread()
|
void |
setAgiServer(AgiServer agiServer)
Sets the AgiServer to run. |
void |
setDaemon(boolean daemon)
Marks the thread as either a daemon thread or a user thread. |
void |
shutdown()
Stops the AgiServer . |
void |
startup()
Starts the AgiServer in its own thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AgiServerThread()
Before you can run this thread you must set an AgiServer
using
setAgiServer(AgiServer)
.
This constructor is mainly intended for use with setter based dependency injection.
public AgiServerThread(AgiServer agiServer)
AgiServer
.
agiServer
- the AgiServer to run.Method Detail |
---|
public void setAgiServer(AgiServer agiServer)
This property must be set before starting the AgiServerThread by calling startup.
agiServer
- the AgiServer to run.public void setDaemon(boolean daemon)
Default is true
.
daemon
- if false
, marks the thread as a user
thread.Thread.setDaemon(boolean)
public void startup() throws java.lang.IllegalStateException, java.lang.RuntimeException
Note: The AgiServerThread is designed to handle one AgiServer instance at a time so calling this method twice without stopping the AgiServer in between will result in a RuntimeException.
java.lang.IllegalStateException
- if the mandatory property agiServer has not
been set or the AgiServer had already been started.
java.lang.RuntimeException
- if the AgiServer can't be started due to IO
problems, for example because the socket has already been
bound by another process.protected java.lang.Thread createThread()
public void shutdown() throws java.lang.IllegalStateException
AgiServer
.
The AgiServer must have been started by calling startup()
before
you can stop it.
java.lang.IllegalStateException
- if the mandatory property agiServer has not
been set or the AgiServer had already been shut down.AgiServer.shutdown()
|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |