Package ch.qos.logback.classic.net

# Class ReceiverBase

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.classic.net.ReceiverBase

All Implemented Interfaces:
  `ContextAware`, `LifeCycle`

Direct Known Subclasses:
  `ServerSocketReceiver`, `SocketReceiver`

public abstract class ReceiverBase extends ContextAwareBase implements LifeCycle
An abstract base for components that receive logging events from a remote peer and log according to local policy

Author:
  Carl Harris

## Field Summary

### Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

`context`

## Constructor Summary

Constructors
Constructor
Description
`ReceiverBase()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract Runnable`
`getRunnableTask()`
Provides the runnable task this receiver will execute.
`final boolean`
`isStarted()`
`protected abstract void`
`onStop()`
Allows a subclass to participate in receiver shutdown.
`protected abstract boolean`
`shouldStart()`
Determines whether this receiver should start.
`final void`
`start()`
`final void`
`stop()`

### Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ReceiverBase

public ReceiverBase()

## Method Details

### start

public final void start()

Specified by:
  `start` in interface `LifeCycle`

### stop

public final void stop()

Specified by:
  `stop` in interface `LifeCycle`

### isStarted

public final boolean isStarted()

Specified by:
  `isStarted` in interface `LifeCycle`

### shouldStart

protected abstract boolean shouldStart()
Determines whether this receiver should start.

Subclasses will implement this method to do any subclass-specific validation. The subclass's `getRunnableTask()` method will be invoked (and the task returned will be submitted to the executor) if and only if this method returns `true`

Returns:
  flag indicating whether this receiver should start

### onStop

protected abstract void onStop()
Allows a subclass to participate in receiver shutdown.

### getRunnableTask

protected abstract Runnable getRunnableTask()
Provides the runnable task this receiver will execute.

Returns:
  runnable task