public abstract class Daemon extends Object
Modifier and Type | Field and Description |
---|---|
protected static char[] |
hexArray |
Constructor and Description |
---|
Daemon()
Constructs the Daemon.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(DaemonListener listener) |
void |
addShutdownHook(Runnable r) |
protected abstract void |
configure(DaemonContext context)
Called before the server is started so that you can configure the server
to your own requirements.
|
DaemonContext |
getContext()
Get the context for this Daemon.
|
List<DaemonListener> |
getDaemonListeners() |
Throwable |
getLastError()
If startup failed get the last error.
|
static Date |
getReleaseDate()
Returns the release date of the current version.
|
static String |
getVersion()
Returns the current version of the API.
|
boolean |
isStarted()
Get whether the daemon is currently started
|
boolean |
isStarting() |
void |
registerAcceptor(ClientAcceptor acceptor,
ServerSocketChannel socketChannel)
Register a client acceptor with the daemon.
|
void |
registerConnector(ClientConnector connector,
SocketChannel socketChannel)
Register a client connector with the daemon.
|
void |
registerHandler(SocketHandler handler,
SelectableChannel channel) |
void |
registerHandler(SocketHandler handler,
SelectableChannel channel,
ProtocolEngine engine)
Register a socket handler with the daemon.
|
void |
registerHandler(SocketHandler handler,
SelectableChannel channel,
SelectorThread thread) |
void |
registerHandler(SocketHandler handler,
SelectableChannel channel,
SelectorThread thread,
ProtocolEngine engine)
Register a socket handler with the daemon.
|
void |
removeAcceptor(ListeningInterface li) |
void |
removeListener(DaemonListener listener) |
void |
restart() |
void |
restart(boolean graceful,
long forceAfterMs) |
void |
shutdownAsync(boolean graceful,
long forceAfterMs)
Shutdown the server.
|
void |
shutdownNow(boolean graceful,
long forceAfterMs)
This method should be used to shutdown the server from your main thread.
|
boolean |
startAcceptingConnections(boolean propagateErrors) |
protected boolean |
startListeningInterface(ListeningInterface li,
boolean propagateErrors) |
boolean |
startup()
Starts the daemon, first calling the
#configure(ConfigurationContext) method to allow your server to
configure itself. |
boolean |
startup(boolean propagateErrors)
Starts the daemon, first calling the
#configure(ConfigurationContext) method to allow your server to
configure itself. |
void |
stopAcceptingConnections() |
public DaemonContext getContext()
public static String getVersion()
public static Date getReleaseDate()
public boolean isStarting()
public void addShutdownHook(Runnable r)
public boolean startup() throws IOException
#configure(ConfigurationContext)
method to allow your server to
configure itself.IOException
public boolean startup(boolean propagateErrors) throws IOException
#configure(ConfigurationContext)
method to allow your server to
configure itself.propagate
- Do not consume errors.IOException
public boolean startAcceptingConnections(boolean propagateErrors) throws IOException
IOException
public Throwable getLastError()
protected boolean startListeningInterface(ListeningInterface li, boolean propagateErrors) throws IOException
IOException
public void removeAcceptor(ListeningInterface li)
public boolean isStarted()
public void shutdownAsync(boolean graceful, long forceAfterMs)
public void shutdownNow(boolean graceful, long forceAfterMs)
shutdownAsync().
public void stopAcceptingConnections()
public void restart() throws IOException
IOException
public void restart(boolean graceful, long forceAfterMs) throws IOException
IOException
public void registerConnector(ClientConnector connector, SocketChannel socketChannel) throws IOException
connector
- ClientConnectorsocketChannel
- SocketChannelIOException
public void registerAcceptor(ClientAcceptor acceptor, ServerSocketChannel socketChannel) throws IOException
acceptor
- ClientAcceptorsocketChannel
- ServerSocketChannelIOException
public void registerHandler(SocketHandler handler, SelectableChannel channel, ProtocolEngine engine) throws IOException
handler
- SocketHandlerchannel
- SelectableChannelIOException
public void registerHandler(SocketHandler handler, SelectableChannel channel) throws IOException
IOException
public void registerHandler(SocketHandler handler, SelectableChannel channel, SelectorThread thread, ProtocolEngine engine) throws IOException
handler
- SocketHandlerchannel
- SelectableChannelthread
- SelectorThreadIOException
public void registerHandler(SocketHandler handler, SelectableChannel channel, SelectorThread thread) throws IOException
IOException
protected abstract void configure(DaemonContext context) throws IOException, SshException
context
- IOException
SshException
public List<DaemonListener> getDaemonListeners()
public void addListener(DaemonListener listener)
public void removeListener(DaemonListener listener)
Copyright © 2024. All rights reserved.