public class AgiServerThread extends Object
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 and Description |
|---|
AgiServerThread()
Creates a new AgiServerThread.
|
AgiServerThread(AgiServer agiServer)
Creates a new AgiServerThread that runs the given
AgiServer. |
| Modifier and Type | Method and Description |
|---|---|
protected 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.
|
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 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 IllegalStateException,
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.
IllegalStateException - if the mandatory property agiServer has not
been set or the AgiServer had already been started.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 Thread createThread()
public void shutdown()
throws IllegalStateException
AgiServer.
The AgiServer must have been started by calling startup() before
you can stop it.
IllegalStateException - if the mandatory property agiServer has not
been set or the AgiServer had already been shut down.AgiServer.shutdown()Copyright © 2004–2020. All rights reserved.