Package org.eclipse.jgit.transport
Class Daemon
java.lang.Object
org.eclipse.jgit.transport.Daemon
Basic daemon for the anonymous
git://
transport protocol.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Daemon.Acceptor
private static final int
static final int
9418: IANA assigned port number for Git.private InetSocketAddress
private PackConfig
private final ThreadGroup
(package private) ReceivePackFactory<DaemonClient>
private RepositoryResolver<DaemonClient>
private final DaemonService[]
private int
(package private) UploadPackFactory<DaemonClient>
-
Constructor Summary
ConstructorsConstructorDescriptionDaemon()
Configure a daemon to listen on any available network port.Daemon
(InetSocketAddress addr) Configure a new daemon for the specified network address. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Get the address connections are received on.Get configuration controlling packing, may be null.Get the factory used to construct per-request ReceivePack.getService
(String name) Lookup a supported service so it can be reconfigured.int
Get timeout (in seconds) before aborting an IO operation.boolean
Whether this daemon is receiving connections.(package private) DaemonService
matchService
(String cmd) (package private) Repository
openRepository
(DaemonClient client, String name) void
Set the configuration used by the pack generator.void
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
Set the factory to construct and configure per-request UploadPack.void
start()
Start this daemon on a background thread.(package private) void
void
stop()
Stop this daemon.void
Stops this daemon and waits until it's acceptor thread has finished.
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT9418: IANA assigned port number for Git.- See Also:
-
BACKLOG
private static final int BACKLOG- See Also:
-
myAddress
-
services
-
processors
-
acceptThread
-
timeout
private int timeout -
packConfig
-
repositoryResolver
-
uploadPackFactory
-
receivePackFactory
-
-
Constructor Details
-
Daemon
public Daemon()Configure a daemon to listen on any available network port. -
Daemon
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 Details
-
getAddress
Get the address connections are received on.- Returns:
- the address connections are received on.
-
getService
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()Get timeout (in seconds) before aborting an IO operation.- 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
Get configuration controlling packing, may be null.- Returns:
- configuration controlling packing, may be null.
-
setPackConfig
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
Set the resolver used to locate a repository by name.- Parameters:
resolver
- the resolver instance.
-
setUploadPackFactory
Set the factory to construct and configure per-request UploadPack.- Parameters:
factory
- the factory. If null upload-pack is disabled.
-
getReceivePackFactory
Get the factory used to construct per-request ReceivePack.- Returns:
- the factory.
- Since:
- 4.3
-
setReceivePackFactory
Set the factory to construct and configure per-request ReceivePack.- Parameters:
factory
- the factory. If null receive-pack is disabled.
-
start
Start this daemon on a background thread.- Throws:
IOException
- the server socket could not be opened.IllegalStateException
- the daemon is already running.
-
clearThread
private void clearThread() -
isRunning
public boolean isRunning()Whether this daemon is receiving connections.- Returns:
true
if this daemon is receiving connections.
-
stop
public void stop()Stop this daemon. -
stopAndWait
Stops this daemon and waits until it's acceptor thread has finished.- Throws:
InterruptedException
- if waiting for the acceptor thread is interrupted- Since:
- 4.9
-
startClient
-
matchService
-
openRepository
- Throws:
ServiceMayNotContinueException
-