org.w3c.www.protocol.http.cache.push
Class PushCacheHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.w3c.www.protocol.http.cache.push.PushCacheHandler
All Implemented Interfaces:
java.lang.Runnable

public class PushCacheHandler
extends java.lang.Thread

PushCacheHandler Created by PushCacheListener to handle a dialogue with a client

See Also:
PushCacheProtocol

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
 
Constructor Summary
PushCacheHandler(PushCacheListener l, java.net.Socket s)
          Construct a PushCacheHandler
 
Method Summary
protected  void add()
          Handle "ADD" packet
protected  void clean()
          Handle "CLN" packet
protected  void cleanup()
          Close sockets, etc.
protected  void del()
          Handle "DEL" packet
protected  void nop()
          Handle "NOP" packet (reply OK)
protected  void present()
          Handle "PRS" packet
 void printBuffer(byte[] buf, int len)
          Debugging aid, displays buffer to stderr
protected  void readPayload()
          Read data based on the contents of the remain_len field
protected  void reply_error(java.lang.String message)
          Send an "ERR" message back to client
protected  void reply_no()
          Send a "NO" message back to client
protected  void reply_ok()
          Send an "OK" message back to client
 void run()
          Handle dialogue with client
 void stopRunning()
          Request that Handler gracefully cease execution
 
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
 

Constructor Detail

PushCacheHandler

public PushCacheHandler(PushCacheListener l,
                        java.net.Socket s)
                 throws java.io.IOException
Construct a PushCacheHandler

Parameters:
socket - Socket through which Handler will communicate with client
Throws:
java.io.IOException
Method Detail

reply_ok

protected void reply_ok()
                 throws java.io.IOException
Send an "OK" message back to client

Throws:
java.io.IOException

reply_no

protected void reply_no()
                 throws java.io.IOException
Send a "NO" message back to client

Throws:
java.io.IOException

reply_error

protected void reply_error(java.lang.String message)
Send an "ERR" message back to client


stopRunning

public void stopRunning()
Request that Handler gracefully cease execution


cleanup

protected void cleanup()
Close sockets, etc.


printBuffer

public void printBuffer(byte[] buf,
                        int len)
Debugging aid, displays buffer to stderr


readPayload

protected void readPayload()
                    throws java.io.IOException
Read data based on the contents of the remain_len field

Throws:
java.io.IOException

add

protected void add()
            throws java.io.IOException
Handle "ADD" packet

Throws:
java.io.IOException

del

protected void del()
            throws java.lang.Exception
Handle "DEL" packet

Throws:
java.lang.Exception

clean

protected void clean()
              throws java.lang.Exception
Handle "CLN" packet

Throws:
java.lang.Exception

present

protected void present()
                throws java.lang.Exception
Handle "PRS" packet

Throws:
java.lang.Exception

nop

protected void nop()
            throws java.lang.Exception
Handle "NOP" packet (reply OK)

Throws:
java.lang.Exception

run

public void run()
Handle dialogue with client

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