public abstract class Endpoint extends DataObject
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
protected static boolean |
captureElapsedTime |
static int |
DEFAULT_READ_BUFFER_SIZE |
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
Endpoint() |
Modifier and Type | Method and Description |
---|---|
protected void |
addElapsedtime(long time) |
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
void |
assertClosed()
Asserts that this endpoint has finished reading or writing, otherwise an exception is thrown.
|
void |
assertNotOpened()
Asserts that this endpoint has not yet started reading or writing, otherwise an exception is thrown.
|
void |
assertOpened()
Asserts that this endpoint has started reading or writing, otherwise an exception is thrown.
|
void |
close()
Indicates that this endpoint has finished reading or writing.
|
protected void |
finalize()
Closes this endpoint if it's still open.
|
long |
getClosedOn()
Returns the time in milliseconds when this endpoint was closed or zero (0) if it hasn't yet been closed.
|
String |
getDescription() |
long |
getElapsedTime()
Returns the total time in milliseconds this endpoint spent reading (inside
DataReader.read() )
or writing (inside DataWriter.write(Record) ) if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). |
String |
getElapsedTimeAsString()
Returns the total time (as a human readable string) this endpoint spent reading (inside
DataReader.read() )
or writing (inside DataWriter.write(Record) ) if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). |
Endpoint |
getNestedEndpoint()
Returns the
Endpoint held inside this one or null if there isn't one. |
long |
getOpenedOn()
Returns the time in milliseconds when this endpoint was opened or zero (0) if it hasn't yet been opened.
|
long |
getOpenElapsedTime()
Returns the number of milliseconds this endpoint was (or has been) opened for or zero (0) if it hasn't yet been opened.
|
String |
getOpenElapsedTimeAsString()
Returns the total time (as a human readable string) this endpoint was (or has been) opened for or "0 seconds" if it hasn't yet been opened.
|
Endpoint |
getRootEndpoint()
Returns the deepest, nested
Endpoint held inside this one, otherwise this instance is returned if
there aren't any nested Endpoint s. |
long |
getSelfTime()
Returns the total time in milliseconds this endpoint spent reading (inside
DataReader.read() )
or writing (inside DataWriter.write(Record) ) minus the elapsed time from nested endpoints if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). |
String |
getSelfTimeAsString()
Returns the total time (as a human readable string) this endpoint spent reading (inside
DataReader.read() )
or writing (inside DataWriter.write(Record) ) minus the elapsed time from nested endpoints if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). |
DataEndpoint.State |
getState() |
static boolean |
isCaptureElapsedTime()
Indicates if all endpoints (readers and writers) should record their processing time.
|
boolean |
isClosed()
Indicates if this endpoint has finished transferring data.
|
boolean |
isOpen()
Indicates if this endpoint is ready for reading or writing.
|
void |
open()
Makes this endpoint ready for reading or writing.
|
static void |
setCaptureElapsedTime(boolean captureElapsedTime)
Indicates if all endpoints (readers and writers) should record their processing time.
|
Endpoint |
setDescription(String description) |
String |
toString() |
public static final int BUFFER_SIZE
public static final int DEFAULT_READ_BUFFER_SIZE
protected static boolean captureElapsedTime
public Endpoint getNestedEndpoint()
Endpoint
held inside this one or null
if there isn't one.public Endpoint getRootEndpoint()
Endpoint
held inside this one, otherwise this instance is returned if
there aren't any nested Endpoint
s.public String getDescription()
public long getOpenedOn()
public long getClosedOn()
public long getOpenElapsedTime()
public String getOpenElapsedTimeAsString()
public void open() throws DataException
DataException
public void close() throws DataException
DataException
public DataEndpoint.State getState()
public boolean isOpen()
public boolean isClosed()
public void assertOpened()
public void assertClosed()
public void assertNotOpened()
public DataException addExceptionProperties(DataException exception)
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class DataObject
protected void finalize() throws Throwable
public String toString()
toString
in class DataObject
public static boolean isCaptureElapsedTime()
getElapsedTime()
public long getElapsedTime()
DataReader.read()
)
or writing (inside DataWriter.write(Record)
) if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). By default this method returns zero (0) if the captureElapsedTime flag was not explicitly set.public String getElapsedTimeAsString()
DataReader.read()
)
or writing (inside DataWriter.write(Record)
) if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). By default this method returns "0 seconds" if the captureElapsedTime flag was not explicitly set.protected void addElapsedtime(long time)
public long getSelfTime()
DataReader.read()
)
or writing (inside DataWriter.write(Record)
) minus the elapsed time from nested endpoints if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). By default this method returns zero (0) if the captureElapsedTime flag was not explicitly set.public String getSelfTimeAsString()
DataReader.read()
)
or writing (inside DataWriter.write(Record)
) minus the elapsed time from nested endpoints if the captureElapsedTime flag is set (setCaptureElapsedTime(boolean)
was called with true). By default this method returns "0 seconds" if the captureElapsedTime flag was not explicitly set.public static void setCaptureElapsedTime(boolean captureElapsedTime)
getElapsedTime()
Copyright (c) 2006-2023 North Concepts Inc. All Rights Reserved.