|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.tranche.commons.DebuggableThread
org.tranche.server.Server
public class Server
This provides a framework for executing a server that uses the custom XML protocol designed for p2p. Each command in the protocol is broken out in to its own sub-class, similar to the strategy used by the command line client.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static long |
DEFAULT_MAX_REQUEST_SIZE
The maximum amount of incoming data allowed buffered in memory. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Server(TrancheServer dfs,
int port)
Creates a new server that uses the Tranche protocol using a socket bound to the specified port. |
|
Server(TrancheServer dfs,
int port,
boolean ssl)
Creates a new server that uses the Tranche protocol optionally tunneled through SSL and using a socket bound to the specified port. |
|
| Method Summary | |
|---|---|
protected void |
finalize()
Ensures that the socket is closed. |
int |
getConnectedClients()
|
java.lang.String |
getHostName()
Determine this server's host name. |
ServerItem |
getItem(java.lang.String command)
|
int |
getMaxConcurrentClients()
|
long |
getMaxRequestSize()
|
int |
getPort()
Returns the port that the Tranche server is bound to. |
static java.io.File |
getRedirectOutputFile()
|
int |
getRejectedClients()
|
ServerStartupThread |
getServerStartupThread()
Returns the ServerStartupThread object used by Server. |
TrancheServer |
getTrancheServer()
|
java.lang.String |
getURL()
|
boolean |
isCore()
|
boolean |
isSSL()
|
boolean |
isStopped()
|
void |
requestShutdown(Signature sig,
byte[] nonce)
|
void |
run()
Override of the run method. |
void |
setMaxRequestSize(int maxRequestSize)
|
static void |
setRedirectOutputFile(java.io.File redirectOutputFile)
|
void |
setRun(boolean run)
Toggles the state of this server. |
void |
waitForStartup(long maxTimeToWaitForStartup)
Wait for startup thread to finish. |
| Methods inherited from class org.tranche.commons.DebuggableThread |
|---|
debugErr, debugErr, debugOut, isDebug, setDebug |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long DEFAULT_MAX_REQUEST_SIZE
The maximum amount of incoming data allowed buffered in memory. Protect against a DoS attack.
Right now, them maximum size is setting meta data, so based on it's maximum value plus a MB of elbow room.
| Constructor Detail |
|---|
public Server(TrancheServer dfs,
int port)
throws java.lang.Exception
Creates a new server that uses the Tranche protocol using a socket bound to the specified port.
dfs - The underlying TrancheServer to use.port - The port that the server's socket should be bound to.
java.lang.Exception - All exceptions are thrown.
public Server(TrancheServer dfs,
int port,
boolean ssl)
throws java.lang.Exception
Creates a new server that uses the Tranche protocol optionally tunneled through SSL and using a socket bound to the specified port.
dfs - The underlying TrancheServer to use.port - The port that the server's socket should be bound to.ssl - true if the Tranche protocol should be piped through SSL. false if not.
java.lang.Exception - All exceptions are thrown.| Method Detail |
|---|
public java.lang.String getURL()
public ServerItem getItem(java.lang.String command)
command -
public TrancheServer getTrancheServer()
public int getConnectedClients()
public int getRejectedClients()
public int getMaxConcurrentClients()
public long getMaxRequestSize()
public void setMaxRequestSize(int maxRequestSize)
maxRequestSize - public boolean isSSL()
public int getPort()
Returns the port that the Tranche server is bound to.
public java.lang.String getHostName()
Determine this server's host name.
public boolean isCore()
public boolean isStopped()
public void requestShutdown(Signature sig,
byte[] nonce)
throws java.lang.Exception
sig - nonce -
java.lang.Exceptionpublic void setRun(boolean run)
Toggles the state of this server. false turns the server off. true turns the server on.
run - false if the server should be taken off-line. true if it should be kept on-line.public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
protected void finalize()
throws java.lang.Throwable
Ensures that the socket is closed.
finalize in class java.lang.Objectjava.lang.Throwablepublic ServerStartupThread getServerStartupThread()
Returns the ServerStartupThread object used by Server.
public void waitForStartup(long maxTimeToWaitForStartup)
Wait for startup thread to finish. If not running, returns immediately.
maxTimeToWaitForStartup - public static java.io.File getRedirectOutputFile()
public static void setRedirectOutputFile(java.io.File redirectOutputFile)
redirectOutputFile -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||