Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

IM
Class IMMyQueue  view IMMyQueue download IMMyQueue.java

java.lang.Object
  extended byjava.lang.Thread
      extended byIM.IMMyQueue
All Implemented Interfaces:
java.lang.Runnable

public class IMMyQueue
extends java.lang.Thread

Thread IMMyQueue services messages which are delivered to Queue on JMS. They are received from queueReceiver object with receive() method. There is reserved place in Vector IMreceivedMessageQueue before receiving message. Received message is being put in IMreceivedMessageQueue, then thread try to reserve place for next message in IMreceivedMessageQueue and if it is possible, it hangs on receive() method of queueReceiver. In other case thread fall asleep for some time (default : 1 s)


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private static int DEFAULT_SLEEP
           
private static int DEFAULT_TIMEOUT
           
private  mobile.jmsapi.Queue queue
           Represents object of Queue class used to service PTP communication
private  java.lang.String queueName
           Keeps name of Queue which is kept on queue attribute.
private  mobile.jmsapi.QueueReceiver queueReceiver
           Represents object of QueueReceiver class which is used to receiving messages
private  boolean stopFlag
           Flag used to order IMTopic to stop work (main thread)
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IMMyQueue(java.lang.String qname)
           Set name of Queue, which will service and run main thread.
 
Method Summary
 mobile.jmsapi.Queue getQueue()
           Do nothing
 java.lang.String getQueueName()
           Do nothing.
 mobile.jmsapi.QueueReceiver getQueueReceiver()
           Do nothing
 void run()
           Main thread which services received messages and makes them available for Instant-Messenger by putting them to vector called IMreceivedMessageQueue stored in im, object of IM class
 void setQueue(mobile.jmsapi.Queue queue)
           Set value of queue attribute to object given in queue parameter
 void setQueueReceiver(mobile.jmsapi.QueueReceiver queueReceiver)
           Set value of queueReceiver attribute to object given in queue parameter
 void startQueue()
           Set value of stopFlag to false, what indicate that main thread have to start its work.
 void stopQueue()
           Set value of stopFlag to true, what indicate that main thread have to stop its work after clean all of composite attributes.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, 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

DEFAULT_SLEEP

private static final int DEFAULT_SLEEP
See Also:
Constant Field Values

DEFAULT_TIMEOUT

private static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values

stopFlag

private boolean stopFlag

Flag used to order IMTopic to stop work (main thread)


queue

private mobile.jmsapi.Queue queue

Represents object of Queue class used to service PTP communication


queueReceiver

private mobile.jmsapi.QueueReceiver queueReceiver

Represents object of QueueReceiver class which is used to receiving messages


queueName

private java.lang.String queueName

Keeps name of Queue which is kept on queue attribute.

Constructor Detail

IMMyQueue

public IMMyQueue(java.lang.String qname)

Set name of Queue, which will service and run main thread.

Method Detail

getQueue

public mobile.jmsapi.Queue getQueue()

Do nothing


setQueue

public void setQueue(mobile.jmsapi.Queue queue)

Set value of queue attribute to object given in queue parameter


getQueueName

public java.lang.String getQueueName()

Do nothing.


getQueueReceiver

public mobile.jmsapi.QueueReceiver getQueueReceiver()

Do nothing


setQueueReceiver

public void setQueueReceiver(mobile.jmsapi.QueueReceiver queueReceiver)

Set value of queueReceiver attribute to object given in queue parameter


stopQueue

public void stopQueue()

Set value of stopFlag to true, what indicate that main thread have to stop its work after clean all of composite attributes.


startQueue

public void startQueue()

Set value of stopFlag to false, what indicate that main thread have to start its work.


run

public void run()

Main thread which services received messages and makes them available for Instant-Messenger by putting them to vector called IMreceivedMessageQueue stored in im, object of IM class