de.mud.jta.plugin
Class Timeout
java.lang.Object
|
+--de.mud.jta.Plugin
|
+--de.mud.jta.plugin.Timeout
- All Implemented Interfaces:
- FilterPlugin, PluginListener, java.lang.Runnable, SocketListener
- public class Timeout
- extends Plugin
- implements FilterPlugin, SocketListener, java.lang.Runnable
The timeout plugin looks at the incoming and outgoing data stream and
tries to close the connection gracefully if the timeout occured or if
not graceful exit command was configured simply closed the connection.
Maintainer: Matthias L. Jugel
- Version:
- $Id: Timeout.java,v 2.6 2002/05/06 07:24:20 leo Exp $
- Author:
- Matthias L. Jugel, Marcus Meißner
Constructor Summary |
Timeout(PluginBus bus,
java.lang.String id)
Create the new timeout plugin. |
Method Summary |
void |
connect(java.lang.String host,
int port)
Start the timeout countdown. |
void |
disconnect()
Stop the timeout |
FilterPlugin |
getFilterSource()
|
int |
read(byte[] b)
Read a block of data from the back end. |
void |
run()
Sleep for the timeout beeing. |
void |
setFilterSource(FilterPlugin plugin)
Set the source plugin where we get our data from and where the data
sink (write) is. |
void |
write(byte[] b)
Write a block of data to the back end. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
timeout
protected int timeout
timeoutCommand
protected java.lang.String timeoutCommand
timeoutWarning
protected java.lang.String timeoutWarning
timeoutThread
protected java.lang.Thread timeoutThread
Timeout
public Timeout(PluginBus bus,
java.lang.String id)
- Create the new timeout plugin.
run
public void run()
- Sleep for the timeout beeing. The thread gets interrupted if data
is transmitted and will shutdown the connection as soon as the
timeout wakes up normally.
- Specified by:
run
in interface java.lang.Runnable
connect
public void connect(java.lang.String host,
int port)
throws java.io.IOException
- Start the timeout countdown.
- Specified by:
connect
in interface SocketListener
disconnect
public void disconnect()
throws java.io.IOException
- Stop the timeout
- Specified by:
disconnect
in interface SocketListener
setFilterSource
public void setFilterSource(FilterPlugin plugin)
- Description copied from interface:
FilterPlugin
- Set the source plugin where we get our data from and where the data
sink (write) is. The actual data handling should be done in the
read() and write() methods.
- Specified by:
setFilterSource
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
source
- the data source
getFilterSource
public FilterPlugin getFilterSource()
- Specified by:
getFilterSource
in interface FilterPlugin
read
public int read(byte[] b)
throws java.io.IOException
- Description copied from interface:
FilterPlugin
- Read a block of data from the back end.
- Specified by:
read
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
b
- the buffer to read the data into- Returns:
- the amount of bytes actually read
write
public void write(byte[] b)
throws java.io.IOException
- Description copied from interface:
FilterPlugin
- Write a block of data to the back end.
- Specified by:
write
in interface FilterPlugin
- Following copied from interface:
de.mud.jta.FilterPlugin
- Parameters:
b
- the buffer to be sent