de.mud.jta.plugin

Class Timeout

Implemented Interfaces:
FilterPlugin, PluginListener, Runnable, SocketListener

public class Timeout
extends Plugin
implements FilterPlugin, SocketListener, 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 499 2005-09-29 08:24:54Z leo $
Author:
Matthias L. Jugel, Marcus Mei???ner

Field Summary

protected int
timeout
protected String
timeoutCommand
protected Thread
timeoutThread
protected String
timeoutWarning

Fields inherited from class de.mud.jta.Plugin

bus, id

Constructor Summary

Timeout(PluginBus bus, String id)
Create the new timeout plugin.

Method Summary

void
connect(String host, int port)
Start the timeout countdown.
void
disconnect()
Stop the timeout
FilterPlugin
getFilterSource()
int
read(byte[] b)
void
run()
Sleep for the timeout beeing.
void
setFilterSource(FilterPlugin plugin)
void
write(byte[] b)

Methods inherited from class de.mud.jta.Plugin

error, getId

Field Details

timeout

protected int timeout

timeoutCommand

protected String timeoutCommand

timeoutThread

protected Thread timeoutThread

timeoutWarning

protected String timeoutWarning

Constructor Details

Timeout

public Timeout(PluginBus bus,
               String id)
Create the new timeout plugin.

Method Details

connect

public void connect(String host,
                    int port)
            throws IOException
Start the timeout countdown.
Specified by:
connect in interface SocketListener

disconnect

public void disconnect()
            throws IOException
Stop the timeout
Specified by:
disconnect in interface SocketListener

getFilterSource

public FilterPlugin getFilterSource()
Specified by:
getFilterSource in interface FilterPlugin

read

public int read(byte[] b)
            throws IOException
Specified by:
read in interface FilterPlugin

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.

setFilterSource

public void setFilterSource(FilterPlugin plugin)
Specified by:
setFilterSource in interface FilterPlugin

write

public void write(byte[] b)
            throws IOException
Specified by:
write in interface FilterPlugin