org.otfeed.protocol.request
Class AbstractSessionRequest

java.lang.Object
  extended by org.otfeed.protocol.request.AbstractRequest
      extended by org.otfeed.protocol.request.AbstractSessionRequest
Direct Known Subclasses:
BookStreamExRequest, CancelRequest, DividendRequest, EquityInitRequest, HistBookRequest, HistDataRequest, HistTicksRequest, ListExchangesRequest, ListSymbolsExRequest, LogoutRequest, OptionChainRequest, OptionChainSnapshotRequest, OptionInitRequest, SnapshotRequest, SplitRequest, TickStreamExRequest, TodaysOHLRequest

public abstract class AbstractSessionRequest
extends AbstractRequest

Common base for all OpenTick session requests. Note that only LoginRequest does not have session context, and therefore is not derived from this class. All other requests are session requests.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.otfeed.protocol.request.AbstractRequest
AbstractRequest.JobStatus
 
Method Summary
 void fireCompleted(OTError error)
          Internal method: used to wake up threads sleeping in waitForCompletion().
 CommandEnum getCancelCommand()
          Returns cancel command type.
 OTError getError()
           
 java.lang.String getSessionId()
          Gets session id string.
 boolean isCompleted()
           
 void setSessionId(java.lang.String val)
          Sets session id string.
 void waitForCompletion()
          Convenience method: blocks calling thread until request finishes.
 boolean waitForCompletion(long millis)
          Convenience method: blocks calling thread until request finishes, or the specified number of milliseconds elapses.
 void writeRequest(java.nio.ByteBuffer out)
          Writes out the request header and session string.
 
Methods inherited from class org.otfeed.protocol.request.AbstractRequest
getCommand, getRequestId, handleMessage, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSessionId

public java.lang.String getSessionId()
Gets session id string.

Returns:
session id string.

setSessionId

public void setSessionId(java.lang.String val)
Sets session id string.

Parameters:
val - session id string.

writeRequest

public void writeRequest(java.nio.ByteBuffer out)
Writes out the request header and session string. Subclasses must override this if needed, and their implementation must call this method as the first operation.

Overrides:
writeRequest in class AbstractRequest
Parameters:
out - output buffer.

getCancelCommand

public CommandEnum getCancelCommand()
Returns cancel command type. Some requests can be cancelled by sending a CancelRequest to the server. Such requests must override this method to return the cancel command type.


getError

public final OTError getError()

fireCompleted

public final void fireCompleted(OTError error)
Internal method: used to wake up threads sleeping in waitForCompletion().


isCompleted

public final boolean isCompleted()

waitForCompletion

public final boolean waitForCompletion(long millis)
Convenience method: blocks calling thread until request finishes, or the specified number of milliseconds elapses. Note that if request was not submitted, this method returns immediately with no error.

Parameters:
millis - how long to wait for completion.

waitForCompletion

public final void waitForCompletion()
Convenience method: blocks calling thread until request finishes. Note that if request was not submitted, this method returns immediately with no error.



Copyright © 2007 Mike Kroutikov. All Rights Reserved.