se.entra.phantom.server
Class ClientWorker

java.lang.Object
  extended by se.entra.phantom.server.ClientWorker
All Implemented Interfaces:
Runnable

public class ClientWorker
extends Object
implements Runnable

The threaded client session that one clients can connect to.


Nested Class Summary
static interface ClientWorker.ClientWorkerInterface
           
 
Field Summary
static int REPLYTYPE_HTMLAPPEVENT
           
static int REPLYTYPE_SERVERCALLBACK
           
 
Method Summary
 void flagClientEventForProcessing()
          Flags a client change event for processing.
 void flagHostEventForProcessing()
          Flags a host change event for processing.
 Transaction getModalReturnCode(int returnType)
          Waits and gets a modal return code-transaction that is corresponding with a certain return type (such as message box or clip board).
 Object getModalReturnCodeObject(int returnType, long waitDelay)
          Waits and gets a modal return code-object that is corresponding with a certain return type (such as message box or clip board).
 Object invokeAndWait(ServerAction serverAction)
          Invokes the server action in the client worker thread and waits for a reply.
 void invokeLater(ServerAction serverAction)
          Invokes the server action in the client worker thread later and doesn't wait for a reply.
 boolean isEventPosted()
          Check if client event is posted for processing.
 boolean isWorkerThread()
          Checks if the current thread is the worker thread.
 void postHttpClientTransaction(ClientWorker.ClientWorkerInterface cli)
          Posts a HTTP client transaction for processing.
 void run()
          Starts running the threaded client worker.
 Object serverCallbackEvent(boolean waitForReply, Object caller, Object paramObj)
          Post a HTML Application event for callback processing in the main thread.
 void setModalReturnCode(int returnType, Object obj, boolean singleReply)
          Sets the return code for a waiting thread "blocked" on the getModalReturnCode method.
 void setModalReturnCode(Transaction trans)
          Sets the return code for a waiting thread "blocked" on the getModalReturnCode method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REPLYTYPE_SERVERCALLBACK

public static final int REPLYTYPE_SERVERCALLBACK
See Also:
Constant Field Values

REPLYTYPE_HTMLAPPEVENT

public static final int REPLYTYPE_HTMLAPPEVENT
See Also:
Constant Field Values
Method Detail

isWorkerThread

public boolean isWorkerThread()
Checks if the current thread is the worker thread.


run

public void run()
Starts running the threaded client worker.

Specified by:
run in interface Runnable

getModalReturnCode

public Transaction getModalReturnCode(int returnType)
Waits and gets a modal return code-transaction that is corresponding with a certain return type (such as message box or clip board). The modal return code is not returned in any way, but rather must the method setModalReturnCode be used. When this method is called, a waiting thread is released with this return code.

Note: if this is the worker thread, it will continue to process the queued messages and events. If this is another thread, it will be blocked until another thread calls the setModalReturnCode method.


getModalReturnCodeObject

public Object getModalReturnCodeObject(int returnType,
                                       long waitDelay)
Waits and gets a modal return code-object that is corresponding with a certain return type (such as message box or clip board). The modal return code is not returned in any way, but rather must the method setModalReturnCode be used. When this method is called, a waiting thread is released with this return code.

Note: if this is the worker thread, it will continue to process the queued messages and events. If this is another thread, it will be blocked until another thread calls the setModalReturnCode method.


setModalReturnCode

public void setModalReturnCode(int returnType,
                               Object obj,
                               boolean singleReply)
Sets the return code for a waiting thread "blocked" on the getModalReturnCode method.


setModalReturnCode

public void setModalReturnCode(Transaction trans)
Sets the return code for a waiting thread "blocked" on the getModalReturnCode method.


flagHostEventForProcessing

public void flagHostEventForProcessing()
Flags a host change event for processing.


flagClientEventForProcessing

public void flagClientEventForProcessing()
Flags a client change event for processing.


isEventPosted

public boolean isEventPosted()
Check if client event is posted for processing.


postHttpClientTransaction

public void postHttpClientTransaction(ClientWorker.ClientWorkerInterface cli)
Posts a HTTP client transaction for processing.


serverCallbackEvent

public Object serverCallbackEvent(boolean waitForReply,
                                  Object caller,
                                  Object paramObj)
Post a HTML Application event for callback processing in the main thread.


invokeLater

public void invokeLater(ServerAction serverAction)
Invokes the server action in the client worker thread later and doesn't wait for a reply.


invokeAndWait

public Object invokeAndWait(ServerAction serverAction)
Invokes the server action in the client worker thread and waits for a reply. This call is not working also for the AWT thread when the NetPhantom Editor when the DirectInterface is used. If the client or the system closes the client process, a ClientSessionDisposed is thrown. If this method is invoked from the client worker thread or the AWT thread, an InternalError is thrown.

Returns:
the return code from the server action or null if the client process is closed by the user or the system.


Phantom® and NetPhantom® are registered trademarks of Codectica Systems SARL.
© Copyright Codectica Systems SARL, 2008. All rights reserved.