nl.justobjects.pushlet.test
Class PushletPingApplication

java.lang.Object
  extended by java.lang.Thread
      extended by nl.justobjects.pushlet.test.PushletPingApplication
All Implemented Interfaces:
java.lang.Runnable, PushletClientListener, Protocol

public class PushletPingApplication
extends java.lang.Thread
implements PushletClientListener, Protocol

Tester to demonstrate Pushlet use in Java applications. This program does two things: (1) it subscribes to the subject "test/ping" (2) it publishes an Event with subject "/test/ping" every few seconds.

Version:
$Id: PushletPingApplication.java,v 1.15 2005/02/21 16:59:17 justb Exp $
Author:
Just van den Broecke - Just Objects ©

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.lang.String host
           
private  int port
           
private static long PUBLISH_INTERVAL_MILLIS
           
private  PushletClient pushletClient
           
private static java.lang.String SUBJECT
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface nl.justobjects.pushlet.core.Protocol
DEFAULT_SERVLET_URI, E_ABORT, E_DATA, E_HEARTBEAT, E_HEARTBEAT_ACK, E_JOIN, E_JOIN_ACK, E_JOIN_LISTEN, E_JOIN_LISTEN_ACK, E_LEAVE, E_LEAVE_ACK, E_LISTEN, E_LISTEN_ACK, E_NACK, E_PUBLISH, E_PUBLISH_ACK, E_REFRESH, E_REFRESH_ACK, E_SUBSCRIBE, E_SUBSCRIBE_ACK, E_UNSUBSCRIBE, E_UNSUBSCRIBE_ACK, FORMAT_JAVASCRIPT, FORMAT_SERIALIZED_JAVA_OBJECT, FORMAT_XML, FORMAT_XML_STRICT, MODE_POLL, MODE_PULL, MODE_STREAM, P_EVENT, P_FORMAT, P_FROM, P_ID, P_MODE, P_REASON, P_SEQ, P_SUBJECT, P_SUBSCRIPTION_ID, P_SUBSCRIPTION_LABEL, P_TIME, P_TO, P_URL, P_WAIT, SUBJECT_META, SUBJECT_META_JOINS, SUBJECT_META_SUBS
 
Constructor Summary
PushletPingApplication(java.lang.String aHost, int aPort)
           
 
Method Summary
static void main(java.lang.String[] args)
          Main program.
 void onAbort(Event theEvent)
          Abort event from server.
 void onData(Event theEvent)
          Data event from server.
 void onError(java.lang.String message)
          Error occurred.
 void onHeartbeat(Event theEvent)
          Heartbeat event from server.
 void p(java.lang.String s)
          Generic print.
 void run()
           
 
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
 

Field Detail

pushletClient

private PushletClient pushletClient

host

private java.lang.String host

port

private int port

SUBJECT

private static final java.lang.String SUBJECT
See Also:
Constant Field Values

PUBLISH_INTERVAL_MILLIS

private static final long PUBLISH_INTERVAL_MILLIS
See Also:
Constant Field Values
Constructor Detail

PushletPingApplication

public PushletPingApplication(java.lang.String aHost,
                              int aPort)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

onError

public void onError(java.lang.String message)
Error occurred.

Specified by:
onError in interface PushletClientListener

onAbort

public void onAbort(Event theEvent)
Abort event from server.

Specified by:
onAbort in interface PushletClientListener

onData

public void onData(Event theEvent)
Data event from server.

Specified by:
onData in interface PushletClientListener

onHeartbeat

public void onHeartbeat(Event theEvent)
Heartbeat event from server.

Specified by:
onHeartbeat in interface PushletClientListener

p

public void p(java.lang.String s)
Generic print.


main

public static void main(java.lang.String[] args)
Main program.



Copyright 2000-2003 - Just Objects B.V.