Holger's Java API

## com.antelmann.util.logging
Class LogNetPropagator

    java.lang.Object
      com.antelmann.util.logging.AbstractLogWriter<byte[]>
          com.antelmann.util.logging.LogNetPropagator

All Implemented Interfaces:
  NetConnectionHandler, Filter<LogEntry>, LogWriter

    public class LogNetPropagator

extends AbstractLogWriter<byte[]>
implements NetConnectionHandler

can be registered to listen logging events and then propagates them as serialized byte arrays over its NetConnectionServer.

Author:
  Holger Antelmann
See Also:
  `LogNetReceiver`, `NetConnectionServer`

Field Summary
`static SimpleHandshake` `handshake`

Fields inherited from class com.antelmann.util.logging.AbstractLogWriter
`filter`

Fields inherited from interface com.antelmann.util.Filter
`EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER`

Constructor Summary
`LogNetPropagator(int port)`
`LogNetPropagator(int port, Logger logger)` the server is not started through the constructor

Method Summary
`void` `connectionLost(NetConnection con)` simply removes inactive connections from its server's list
`NetConnectionServer` `getServer()`
`void` `handleMessage(Object msg, NetConnection con)` simply responds with a 'message received' object to enable connection verification and closes the connection on IOException
`void` `writeLogPattern(byte[] msg)` writes the pattern to the log entity.

Methods inherited from class com.antelmann.util.logging.AbstractLogWriter
`accept, getLogFilter, getLogFormatter, setLogFilter, setLogFormatter, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### handshake

    public static final SimpleHandshake handshake

Constructor Detail

### LogNetPropagator

    public LogNetPropagator(int port)
                     throws IOException

Throws:
  `IOException`

### LogNetPropagator

    public LogNetPropagator(int port,
                            Logger logger)
                     throws IOException

  the server is not started through the constructor

  Throws:
    `IOException`
  See Also:
    `getServer()`

Method Detail

### writeLogPattern

    public void writeLogPattern(byte[] msg)

  Description copied from class: `AbstractLogWriter`
  writes the pattern to the log entity. If the LogEntryFormatter is null, the pattern is the LogEntry object itself; otherwise, the pattern is the result of formatting the LogEntry with the given LogEntryFormatter.

  Specified by:
    `writeLogPattern` in class `AbstractLogWriter<byte[]>`

### getServer

    public NetConnectionServer getServer()

### connectionLost

    public void connectionLost(NetConnection con)

  simply removes inactive connections from its server's list

  Specified by:
    `connectionLost` in interface `NetConnectionHandler`

### handleMessage

    public void handleMessage(Object msg,
                              NetConnection con)

  simply responds with a 'message received' object to enable connection verification and closes the connection on IOException

  Specified by:
    `handleMessage` in interface `NetConnectionHandler`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads