CS4B Spring 2007

Class FruitThreadServer

java.lang.Object
  extended by java.lang.Thread
      extended by FruitThreadServer
All Implemented Interfaces:
java.lang.Runnable

public class FruitThreadServer
extends java.lang.Thread

Create a ServerSocket wait for someone to connect on port 56789 start up a client thread in threadGroup FruitClients and wait for request. System parse first word of request to determine what to call, any request may be sent, but here is a list of supported first word requests...

Server sends back the MySQL response, followed by an string ETX on its own line. Each set of commands above have their own private helper methods, For example, select, describe and show use private method executeQuery( String Query, PrinWriter toClient );

A client only needs to connect to the IP/Port=56789 and then write to the server using standard SQL commands.

See Also:
Select, SelectController, InventoryController

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static void main(java.lang.String[] args)
          Load database driver, create connection, create ServerSocket wait for client, when client connects start up thread using FruitThreadServer constructor
 void run()
          Just connect to the IP/Port and then send requests Constructor creates socket and SQL statement, thread run creates server I/O for socket, and then waits for Client request
 
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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
Load database driver, create connection, create ServerSocket wait for client, when client connects start up thread using FruitThreadServer constructor


run

public void run()
Just connect to the IP/Port and then send requests Constructor creates socket and SQL statement, thread run creates server I/O for socket, and then waits for Client request

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

CS4B Spring 2007