|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
server.ConnectionHandlerThread
public class ConnectionHandlerThread
This class instantiates threads in charge of answering requests made via socket channels. It is the server side of the implementation of a DAO.
| 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 |
| Fields inherited from interface server.DAO |
|---|
ADD, DELETE, GET, HOST, PORT, SIZE, UPDATE |
| Constructor Summary | |
|---|---|
ConnectionHandlerThread(java.net.Socket newSocket,
java.util.Map<java.lang.Long,java.io.Serializable> newDatabase)
Creates a new handler. |
|
| Method Summary | |
|---|---|
void |
add(java.lang.Long key,
java.io.Serializable value)
Adds a new Serializable object into the database. |
void |
delete(java.lang.Long key)
Removes an object from the database. |
java.io.Serializable |
get(java.lang.Long key)
Returns a reference to an object in the database. |
void |
run()
Runs the thread that is in charge of answering client requests. |
int |
size()
Informs the number of elements currently stored in the database. |
void |
update(java.lang.Long key,
java.io.Serializable value)
Updates an object in the database. |
| 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 |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionHandlerThread(java.net.Socket newSocket,
java.util.Map<java.lang.Long,java.io.Serializable> newDatabase)
newSocket - the network connection where this handler will be listening.newDatabase - the database of students.| Method Detail |
|---|
public final void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
public final void add(java.lang.Long key,
java.io.Serializable value)
add in interface DAO<java.lang.Long,java.io.Serializable>key - the key of the new object.value - the value that is going to be inserted into the database.public final void delete(java.lang.Long key)
delete in interface DAO<java.lang.Long,java.io.Serializable>key - the id of the object that will be removed.public final java.io.Serializable get(java.lang.Long key)
get in interface DAO<java.lang.Long,java.io.Serializable>key - the id of the object that is being looked up.
public final void update(java.lang.Long key,
java.io.Serializable value)
update in interface DAO<java.lang.Long,java.io.Serializable>key - the id of the object that will be replaced.value - the value of the new object.public final int size()
size in interface DAO<java.lang.Long,java.io.Serializable>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||