|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectbr.com.objectos.git.GitService
public final class GitService
A class for supporting the execution of 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())
);
| Nested Class Summary | |
|---|---|
static class |
GitService.Option
A GitService configuration option. |
| Method Summary | ||
|---|---|---|
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)
The number of GitEngine instances per CpuWorker. |
|
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). |
|
|
submit(GitCommand<V> command)
Submits the specified command to be executed asynchronously. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static GitService.Option bufferSize(int size)
GitEngine in
this service.
size - the size in bytes
IllegalArgumentException - 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 options
GitService 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 set
IllegalArgumentException - if value <= 0create(CpuArray, IoWorker, Option...)public static GitService.Option logger(br.com.objectos.logging.Logger logger)
GitEngine instances).
logger - the logger instance
public final <V> Computation<V> submit(GitCommand<V> command)
submit in interface GitExecutorV - the type of the command resultcommand - the command to be executed
GitComputation representing the possibly ongoing
execution of the command
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||