1.0.0

org.eclipse.soda.dk.transport
Class ThreadTransport

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.transport.Transport
          extended by org.eclipse.soda.dk.transport.ThreadTransport
All Implemented Interfaces:
java.lang.Runnable, ConfigurationService, TransportService
Direct Known Subclasses:
ConnectionTransport, UdpTransport

public class ThreadTransport
extends Transport
implements java.lang.Runnable

The ThreadTransport class is an implementation of the TransportService interface. that handles process input on another thread.

Version:
1.0.0
See Also:
Message, EscObject, Transport, MessageService, Runnable, Thread, TransportService

Field Summary
 
Fields inherited from class org.eclipse.soda.dk.transport.Transport
BAD_CHECKSUM_RESOURCE, CLONE_EXCEPTION_RESOURCE, CLOSE_EXCEPTION_RESOURCE, CONFIGURATION_ERROR_RESOURCE, CONFIGURATION_MISMATCH_RESOURCE, CONNECTION_IN_USE_EXCEPTION_RESOURCE, CR, DEFAULT_NO_ACTIVITY_TIMEOUT, DEFAULT_RETRY_TIME, ERROR_OCCURRED_EXCEPTION_RESOURCE, ERROR_ON_BUS_RESOURCE, errorCount, EXCEPTION_NO_RESPONSE_RESOURCE, inputMessageCount, INTERRUPT_BEFORE_WRITE_RESOURCE, INVALID_MESSAGE_RESOURCE, INVALID_SEQUENCE_RESOURCE, LF, MESSAGE_FILTERED_RESOURCE, MESSAGE_RECEIVED_EXCEPTION_RESOURCE, MESSAGE_RECEIVED_RESOURCE, MESSAGE_SENT_RESOURCE, NACK_RECEIVED_RESOURCE, NO_ACTIVITY_RESOURCE, noActivityTimeout, notificationService, PROCESS_INPUT_EXCEPTION_RESOURCE, QUEUE_TOO_BIG_RESOURCE, RECONNECT_RESOURCE, retryTime, RUN_EXCEPTION_RESOURCE, SEND_EXCEPTION_RESOURCE, SEND_NOT_STARTED_EXCEPTION_RESOURCE, sentMessageCount, SHUTDOWN_EXCEPTION_RESOURCE, STARTUP_EXCEPTION_RESOURCE, STARTUP_MESSAGE_RECEIVED_RESOURCE, STATE_STRINGS, stateChanaged, TRANSPORT_ACTIVE_STATE_RESOURCE, TRANSPORT_ALIVE_STATE_RESOURCE, TRANSPORT_CHANGED_EXCEPTION_RESOURCE, TRANSPORT_CONNECTED_STATE_RESOURCE, TRANSPORT_CREATED_STATE_RESOURCE, TRANSPORT_DEAD_STATE_RESOURCE, TRANSPORT_ERROR_RESOURCE, TRANSPORT_STARTED_STATE_RESOURCE, TRANSPORT_STARTUP_EXCEPTION_RESOURCE, TRANSPORT_STATE_RESOURCE_TABLE, UNABLE_TO_CONNECTION_TO_BUS_RESOURCE, UNKNOWN_ERROR, WRITE_EXCEPTION_RESOURCE, WRITE_INTERRUPT_PENDING_RESOURCE, WRITE_INTERRUPT_RESOURCE
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
EMPTY_BYTES, EMPTY_STRING, ID_FILTER_KEY, ID_KEY, ID_KEY_ANY, INTEGER_TABLE, KEY_KEY, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_TRACE, LOG_WARNING, PREFIX_KEY, RESOURCE_BUNDLE, SLEEP_EXCEPTION_RESOURCE, SYSTEM_INFO_RESOURCE, TO_STRING_CONFIGURATION_KEYS, TRACE_LEVEL_HIGH, TRACE_LEVEL_LOW, TRACE_LEVEL_MAX, TRACE_LEVEL_MIN, TRACE_LEVEL_NONE, TRACE_LEVEL_NORMAL, TRACELEVEL_KEY, UNKNOWN_ERROR_RESOURCE
 
Fields inherited from interface org.eclipse.soda.dk.transport.service.TransportService
ACTIVE, ALIVE, CONFIGURATION_DATA_KEY, CONNECTED, CONNECTION_KEY, CREATED, DEAD, DEFAULT_CONNECTION, ERROR_COUNT_DATA_KEY, ID_KEY, INPUT_MESSAGE_COUNT_DATA_KEY, NULL, SERVICE_NAME, SOURCE_DATA_KEY, STARTED, STATE_DATA_KEY, STATE_OLD_DATA_KEY, STATUS_EXTERNAL_KEY, TIMESTAMP_DATA_KEY, VALUE_DATA_KEY, VALUE_OLD_DATA_KEY
 
Constructor Summary
ThreadTransport()
          Constructs a standard ThreadTransport object.
 
Method Summary
 int getBufferSize()
          Gets the int bufferSize property value.
 long getShutdownTimeout()
          Gets the shutdown timeout (long) value.
 java.lang.Thread getThread()
          Gets the Thread thread property value.
 void handleNoData()
          Perform the handleNoData action method.
 void handleNoInput()
          Perform the handleNoInput action method.
 boolean isRunning()
          Gets the boolean running property value.
protected  void processInput()
          Perform the processInput action method.
protected  int processInput(byte[] bytes, int length)
          Process input bytes looking for input message(s).
protected  void processInput(int value)
          Perform the processInput action method.
 void run()
          Perform the run action method.
 void setRunning(boolean running)
          Sets the running property.
 void setThread(java.lang.Thread thread)
          Sets the thread property.
 void shutdown(boolean output)
          Perform the shutdown action method.
 void start()
          Perform the startup action method.
 void stop()
          Stop.
 
Methods inherited from class org.eclipse.soda.dk.transport.Transport
addInterest, addTransportListener, attemptRecoveryFromError, broadcastStatus, close, configure, connect, createController, exit, finalize, fireErrorOccurred, fireMessageReceived, fireTransportChanged, getConfigurationInformation, getConfigurationInformation, getConfigurationService, getConnection, getController, getErrorCount, getErrorSeverity, getInformation, getInputMessageCount, getInterestMask, getKey, getLogDetails4, getLogDetails5, getNoActivityTimeout, getNotificationPriority, getNotificationService, getPriority, getProperties, getQualifiedKey, getResource, getRetryTime, getSentMessageCount, getState, getString, getStyle, getTransportListener, handleError, hasListeners, isActive, isEcho, isReceivingData, isReceivingGoodData, isReceivingInput, isStarted, log, noActivityProcessing, noActivityProcessingMessage, putConfigurationInformation, read, removeInterest, removeTransportListener, restart, restartProcessing, send, send, setActive, setConfigurationInformation, setController, setEcho, setErrorCount, setInformation, setInputMessageCount, setInterestMask, setNoActivityTimeout, setNotificationService, setReceivingData, setReceivingData, setReceivingGoodData, setReceivingGoodData, setReceivingInput, setReceivingInput, setRetryTime, setSentMessageCount, setState, setStyle, setTransportListener, setup, setupCustom, start, startup, startupMessageReceived, toString, updateErrorCount, updateInputMessageCount, updateSentMessageCount, waitStateChange, waitStateChange, write, write, writeAndReport, writeAndReport
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getDefaultResource, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, toStringConfigurationKeys, toStringInfo
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.dk.core.service.ConfigurationService
getBoolean, getFloat, getInt, getLong, getObject
 

Constructor Detail

ThreadTransport

public ThreadTransport()
Constructs a standard ThreadTransport object.

Method Detail

getBufferSize

public int getBufferSize()
Gets the int bufferSize property value. The buffer size is used as the buffer size in the processing input. The buffer size should be larger than the biggest message that can be received.

Returns:
Results of the get buffer size (int) value.

getShutdownTimeout

public long getShutdownTimeout()
Gets the shutdown timeout (long) value.

Returns:
The shutdown timeout (long) value.

getThread

public java.lang.Thread getThread()
Gets the Thread thread property value.

Returns:
Results of the get thread (Thread) value.
See Also:
setThread(Thread)

handleNoData

public void handleNoData()
Perform the handleNoData action method.


handleNoInput

public void handleNoInput()
Perform the handleNoInput action method.


isRunning

public boolean isRunning()
Gets the boolean running property value.

Returns:
Results of the is running (boolean) value.
See Also:
setRunning(boolean)

processInput

protected void processInput()
                     throws java.lang.Exception
Perform the processInput action method.

Throws:
java.lang.Exception
See Also:
handleNoInput(), processInput(byte[],int), processInput(int)

processInput

protected int processInput(byte[] bytes,
                           int length)
                    throws java.lang.Exception
Process input bytes looking for input message(s). All complete messages should be processed and the number of bytes processed should be returned. The default implementation of this to call processInput of each byte and return the specified length. byte[] int

Parameters:
bytes - The bytes (byte[]) parameter.
length - The length (int) parameter.
Returns:
int Return the number of bytes processed
Throws:
java.lang.Exception
See Also:
handleNoInput(), processInput(), processInput(int)

processInput

protected void processInput(int value)
                     throws java.lang.Exception
Perform the processInput action method. int

Parameters:
value - The value (int) parameter.
Throws:
java.lang.Exception
See Also:
handleNoInput(), processInput(), processInput(byte[],int)

run

public void run()
Perform the run action method.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

setRunning

public void setRunning(boolean running)
Sets the running property. The new property value (boolean).

Parameters:
running - The running (boolean) parameter.
See Also:
isRunning()

setThread

public void setThread(java.lang.Thread thread)
Sets the thread property. The new property value (java.lang.Thread).

Parameters:
thread - The thread (Thread) parameter.
See Also:
getThread()

shutdown

public void shutdown(boolean output)
Perform the shutdown action method. This method is called to shutdown the transport. If you overrite this method, you should call you superclass after your shutdown logic. param boolean output If true, then output an errors. The output (boolean) parameter.

Overrides:
shutdown in class Transport
Parameters:
output - The output (boolean) parameter.

start

public void start()
Perform the startup action method. This method is called to startup the transport. If you overrite this method, you should call you superclass before your startup logic. param boolean output If true, then output an errors.

Specified by:
start in interface TransportService
Overrides:
start in class Transport
See Also:
TransportService.start(), Transport.start(boolean)

stop

public void stop()
Stop.

Specified by:
stop in interface TransportService
Overrides:
stop in class Transport
See Also:
TransportService.stop()

1.0.0

Copyright (c) 1999, 2007 IBM