lezione2.multithread.client
Class ClientThread

java.lang.Object
  extended by java.lang.Thread
      extended by lezione2.multithread.client.ClientThread
All Implemented Interfaces:
java.lang.Runnable

public class ClientThread
extends java.lang.Thread

Thread usato da EchoMultiClient.

Author:
Raffaele Giordanelli
See Also:
Socket, Thread, EchoMultiClient

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private static int counter
          Contatore dei Threads creati.
private  int id
          ID del Thread corrente.
private  java.io.BufferedReader in
          BufferedReader creato dal Socket.
private  java.io.PrintWriter out
          PrintWriter creato dal Socket.
private  java.net.Socket socket
          Socket usato dal Thread.
private static int threadcount
          Contatore dei Threads ATTUALMENTE in esecuzione.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientThread(java.net.InetAddress addr)
          Costruttore del Thread.
 
Method Summary
 void run()
          Attività del Thread.
static int threadCount()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

private java.net.Socket socket
Socket usato dal Thread.


in

private java.io.BufferedReader in
BufferedReader creato dal Socket.


out

private java.io.PrintWriter out
PrintWriter creato dal Socket.


counter

private static int counter
Contatore dei Threads creati.


id

private int id
ID del Thread corrente.


threadcount

private static int threadcount
Contatore dei Threads ATTUALMENTE in esecuzione.

Constructor Detail

ClientThread

public ClientThread(java.net.InetAddress addr)
Costruttore del Thread.

Parameters:
addr - l'indirizzo del server
Method Detail

threadCount

public static int threadCount()
Returns:
il numero dei Threads ATTUALMENTE in esecuzione.

run

public void run()
Attività del Thread. Invia 10 messaggi al server e attende le relative risposte.

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