br.com.objectos.git
public final class GitService extends Object implements GitExecutor
GitCommand instances.
A GitService allows for the execution of Git commands by offering the
required parameters of the
GitCommand.submitAsync(GitCommandExecutor, CpuWorker) method.
Additionally, a GitService allows for configuring a number values
that influence, among others, its memory footprint and concurrency level.
Applications will typically have one instance of this class per JVM.
GitService. It creates a new instance using the default values for
all of the configuration options:
GitService service;
service = GitService.create(cpuArray, ioWorker);
The next example explicitly sets all configuration options with the default values. Therefore, the previous and the next example are equivalent:
GitService service;
service = GitService.create(
cpuArray,
ioWorker,
GitService.bufferSize(4096),
GitService.enginesPerWorker(1),
GitService.logger(NoopLogger.getInstance())
);
| Modifier and Type | Class and Description |
|---|---|
static class |
GitService.Option
A
GitService configuration option. |
| Modifier and Type | Method and Description |
|---|---|
static GitService.Option |
bufferSize(int size)
The size in bytes of the internal buffers of each
GitEngine in
this service. |
static GitService |
create(CpuArray cpuArray,
IoWorker ioWorker,
GitService.Option... options)
Creates a new
GitService instance configured with the provided
values. |
static GitService.Option |
enginesPerWorker(int value)
|
static GitService.Option |
logger(br.com.objectos.logging.Logger logger)
The logger instance to be used by this service (and by all of the
GitEngine instances). |
<V> Computation<V> |
submit(GitCommand<V> command)
Submits the specified command to be executed asynchronously.
|
public static GitService.Option bufferSize(int size)
GitEngine in
this service.size - the size in bytesIllegalArgumentException - if size < 64create(CpuArray, IoWorker, Option...),
GitEngine.bufferSize(int)public static GitService create(CpuArray cpuArray, IoWorker ioWorker, GitService.Option... options)
GitService instance configured with the provided
values.
Options are provided by static methods in this class. The available
options are:
| Method name | Description | Default value |
|---|---|---|
bufferSize |
The size in bytes of the buffers used by each GitEngine in this
service |
4096 |
enginesPerWorker |
The number of GitEngine instances per CpuWorker. It
defines the concurrency level per CpuWorker. |
1 |
logger |
The logger instance to use | NoopLogger.getInstance() |
cpuArray - the CPU worker array to be used by this Git serviceioWorker - the I/O workeroptions - the additional configuration optionsGitService instance configured with the provided
valuespublic static GitService.Option enginesPerWorker(int value)
GitEngine instances per CpuWorker.
For each CpuWorker in the CpuArray used to create this
service, the specified value of GitEngines are created. For
example, if a GitService is created with:
4 cpu workers; and3 engines per worker.
The service will contain a total of 12 GitEngine instances,
three for each thread (cpu worker). Therefore, in this example, each thread
will be able to run, at most, three concurrent Git tasks.
value - the number of engines per worker to setIllegalArgumentException - if value <= 0create(CpuArray, IoWorker, Option...)public static GitService.Option logger(br.com.objectos.logging.Logger logger)
GitEngine instances).logger - the logger instancepublic final <V> Computation<V> submit(GitCommand<V> command)
submit in interface GitExecutorV - the type of the command resultcommand - the command to be executedGitComputation representing the possibly ongoing
execution of the commandCopyright © 2020–2022 Objectos Software LTDA. All rights reserved.