View Javadoc

1   package de.mxro.service;
2   
3   import de.mxro.concurrency.Concurrency;
4   import de.mxro.service.internal.OperationCounterImpl;
5   import de.mxro.service.internal.ServiceRegistryImpl;
6   import de.mxro.service.internal.ShutdownHelperImpl;
7   import de.mxro.service.utils.OperationCounter;
8   import de.mxro.service.utils.ShutdownHelper;
9   
10  public class Services {
11  
12      /**
13       * <p>
14       * A simple counter for how many operations a service is processing at any
15       * point in time.
16       * 
17       * @return A new operation counter instance.
18       */
19      public static final OperationCounter createOperationCounter(final Concurrency con) {
20          return new OperationCounterImpl(con);
21      }
22  
23      /**
24       * <p>
25       * A helper to make shutdown operations safer.
26       * 
27       * @param operationCounter
28       * @return
29       */
30      public static final ShutdownHelper createShutdownHelper(final OperationCounter operationCounter,
31              final Concurrency con) {
32          return new ShutdownHelperImpl(operationCounter, con);
33      }
34  
35      public static ServiceRegistry create() {
36          return new ServiceRegistryImpl();
37      }
38  
39  }