org.eclipse.jgit.transport

## Class Daemon

- java.lang.Object
- - org.eclipse.jgit.transport.Daemon

    public class Daemon
    extends Object

Basic daemon for the anonymous `git://` transport protocol.

### Field Summary

Fields
`static int` `DEFAULT_PORT` 9418: IANA assigned port number for Git.

### Constructor Summary

Constructors
Constructor and Description
`Daemon()` Configure a daemon to listen on any available network port.
`Daemon(InetSocketAddress addr)` Configure a new daemon for the specified network address.

### Method Summary

Methods
`InetSocketAddress` `getAddress()`
`PackConfig` `getPackConfig()`
`DaemonService` `getService(String name)` Lookup a supported service so it can be reconfigured.
`int` `getTimeout()`
`boolean` `isRunning()`
`void` `setPackConfig(PackConfig pc)` Set the configuration used by the pack generator.
`void` `setReceivePackFactory(ReceivePackFactory<DaemonClient> factory)` Set the factory to construct and configure per-request ReceivePack.
`void` `setRepositoryResolver(RepositoryResolver<DaemonClient> resolver)` Set the resolver used to locate a repository by name.
`void` `setTimeout(int seconds)` Set the timeout before willing to abort an IO call.
`void` `setUploadPackFactory(UploadPackFactory<DaemonClient> factory)` Set the factory to construct and configure per-request UploadPack.
`void` `start()` Start this daemon on a background thread.
`void` `stop()` Stop this daemon.

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

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

### Field Detail

#### DEFAULT_PORT

    public static final int DEFAULT_PORT

9418: IANA assigned port number for Git.

See Also:
  Constant Field Values

### Constructor Detail

#### Daemon

    public Daemon()

Configure a daemon to listen on any available network port.

#### Daemon

    public Daemon(InetSocketAddress addr)

Configure a new daemon for the specified network address.

Parameters:
  `addr` - address to listen for connections on. If null, any available port will be chosen on all network interfaces.

### Method Detail

#### getAddress

    public InetSocketAddress getAddress()

Returns:
  the address connections are received on.

#### getService

    public DaemonService getService(String name)

Lookup a supported service so it can be reconfigured.

Parameters:
  `name` - name of the service; e.g. "receive-pack"/"git-receive-pack" or "upload-pack"/"git-upload-pack".
Returns:
  the service; null if this daemon implementation doesn't support the requested service type.

#### getTimeout

    public int getTimeout()

Returns:
  timeout (in seconds) before aborting an IO operation.

#### setTimeout

    public void setTimeout(int seconds)

Set the timeout before willing to abort an IO call.

Parameters:
  `seconds` - number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with the connected client.

#### getPackConfig

    public PackConfig getPackConfig()

Returns:
  configuration controlling packing, may be null.

#### setPackConfig

    public void setPackConfig(PackConfig pc)

Set the configuration used by the pack generator.

Parameters:
  `pc` - configuration controlling packing parameters. If null the source repository's settings will be used.

#### setRepositoryResolver

    public void setRepositoryResolver(RepositoryResolver<DaemonClient> resolver)

Set the resolver used to locate a repository by name.

Parameters:
  `resolver` - the resolver instance.

#### setUploadPackFactory

    public void setUploadPackFactory(UploadPackFactory<DaemonClient> factory)

Set the factory to construct and configure per-request UploadPack.

Parameters:
  `factory` - the factory. If null upload-pack is disabled.

#### setReceivePackFactory

    public void setReceivePackFactory(ReceivePackFactory<DaemonClient> factory)

Set the factory to construct and configure per-request ReceivePack.

Parameters:
  `factory` - the factory. If null receive-pack is disabled.

#### start

    public void start()
               throws IOException

Start this daemon on a background thread.

Throws:
  `IOException` - the server socket could not be opened.
  `IllegalStateException` - the daemon is already running.

#### isRunning

    public boolean isRunning()

Returns:
  true if this daemon is receiving connections.

#### stop

    public void stop()

Stop this daemon.