Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.zeroconf
Class ClientThread

java.lang.Object
  extended by java.lang.Thread
      extended by net.java.sip.communicator.impl.protocol.zeroconf.ClientThread
All Implemented Interfaces:
Runnable

public class ClientThread
extends Thread

Class creating a thread responsible for handling the chat with the remote user on the other end of the socket

Author:
Christian Vincenot

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientThread(Socket sock, BonjourService bonjourService)
          Creates a new instance of ClientThread reponsible for handling the conversation with the remote user.
 
Method Summary
 void cleanThread()
          Clean-up the thread to exit
protected  boolean isStreamOpened()
          Says if the stream between the local user and the remote user is in an opened state (greetings are over and we can chat)
 void run()
          Walk?
protected  void sendHello()
          Say hello :)
 void sendMessage(MessageZeroconfImpl msg)
          Send a message to the remote user
protected  void setContact(ContactZeroconfImpl contact)
          Sets the contact with which we're chatting in this ClientThread
protected  void setStreamOpen()
          Set the stream as opened.
 
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
 

Constructor Detail

ClientThread

public ClientThread(Socket sock,
                    BonjourService bonjourService)
Creates a new instance of ClientThread reponsible for handling the conversation with the remote user.

Parameters:
sock - Socket created for chatting
bonjourService - BonjourService which spawned this ClientThread
Method Detail

setContact

protected void setContact(ContactZeroconfImpl contact)
Sets the contact with which we're chatting in this ClientThread

Parameters:
contact - Zeroconf contact with which we're chatting

setStreamOpen

protected void setStreamOpen()
Set the stream as opened. This means that the conversation with the client is really opened from now on (the XML greetings are over)


isStreamOpened

protected boolean isStreamOpened()
Says if the stream between the local user and the remote user is in an opened state (greetings are over and we can chat)

Returns:
Returns true if the stream is "opened" (ie, ready for chat)

sendHello

protected void sendHello()
Say hello :)


sendMessage

public void sendMessage(MessageZeroconfImpl msg)
Send a message to the remote user

Parameters:
msg - Message to send

run

public void run()
Walk?

Specified by:
run in interface Runnable
Overrides:
run in class Thread

cleanThread

public void cleanThread()
Clean-up the thread to exit


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.