io.atomix.primitive.service.PrimitiveService Java Examples

The following examples show how to use io.atomix.primitive.service.PrimitiveService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestProtocolService.java    From atomix with Apache License 2.0 6 votes vote down vote up
TestProtocolService(
    PartitionId partition,
    String name,
    PrimitiveType primitiveType,
    ServiceConfig config,
    PrimitiveService service,
    TestProtocolServiceRegistry registry,
    ThreadContext context) {
  this.partition = partition;
  this.name = name;
  this.primitiveType = primitiveType;
  this.config = config;
  this.service = service;
  this.registry = registry;
  this.context = context;
  this.clock = context.schedule(Duration.ofMillis(100), Duration.ofMillis(100), this::tick);
  open();
}
 
Example #2
Source File: RaftServiceContext.java    From atomix with Apache License 2.0 6 votes vote down vote up
public RaftServiceContext(
    PrimitiveId primitiveId,
    String serviceName,
    PrimitiveType primitiveType,
    ServiceConfig config,
    PrimitiveService service,
    RaftContext raft,
    ThreadContextFactory threadContextFactory) {
  this.primitiveId = checkNotNull(primitiveId);
  this.serviceName = checkNotNull(serviceName);
  this.primitiveType = checkNotNull(primitiveType);
  this.config = checkNotNull(config);
  this.service = checkNotNull(service);
  this.raft = checkNotNull(raft);
  this.sessions = raft.getSessions();
  this.threadContextFactory = threadContextFactory;
  this.log = ContextualLoggerFactory.getLogger(getClass(), LoggerContext.builder(PrimitiveService.class)
      .addValue(primitiveId)
      .add("type", primitiveType)
      .add("name", serviceName)
      .build());
  service.init(this);
}
 
Example #3
Source File: DefaultServiceExecutor.java    From atomix with Apache License 2.0 5 votes vote down vote up
public DefaultServiceExecutor(ServiceContext context, Serializer serializer) {
  this.serializer = checkNotNull(serializer);
  this.context = checkNotNull(context);
  this.log = ContextualLoggerFactory.getLogger(getClass(), LoggerContext.builder(PrimitiveService.class)
      .addValue(context.serviceId())
      .add("type", context.serviceType())
      .add("name", context.serviceName())
      .build());
}
 
Example #4
Source File: PrimaryBackupServiceContext.java    From atomix with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public PrimaryBackupServiceContext(
    String serverName,
    PrimitiveId primitiveId,
    PrimitiveType primitiveType,
    PrimitiveDescriptor descriptor,
    ThreadContext threadContext,
    ClusterMembershipService clusterMembershipService,
    MemberGroupService memberGroupService,
    PrimaryBackupServerProtocol protocol,
    PrimaryElection primaryElection) {
  this.localMemberId = clusterMembershipService.getLocalMember().id();
  this.serverName = checkNotNull(serverName);
  this.primitiveId = checkNotNull(primitiveId);
  this.primitiveType = checkNotNull(primitiveType);
  this.serviceConfig = Serializer.using(primitiveType.namespace()).decode(descriptor.config());
  this.descriptor = checkNotNull(descriptor);
  this.service = primitiveType.newService(serviceConfig);
  this.threadContext = checkNotNull(threadContext);
  this.clusterMembershipService = checkNotNull(clusterMembershipService);
  this.memberGroupService = checkNotNull(memberGroupService);
  this.protocol = checkNotNull(protocol);
  this.primaryElection = checkNotNull(primaryElection);
  this.log = ContextualLoggerFactory.getLogger(getClass(), LoggerContext.builder(PrimitiveService.class)
      .addValue(serverName)
      .add("type", descriptor.type())
      .add("name", descriptor.name())
      .build());
  clusterMembershipService.addListener(membershipEventListener);
  primaryElection.addListener(primaryElectionListener);
}
 
Example #5
Source File: DistributedSetType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedSetService<>();
}
 
Example #6
Source File: AtomicDocumentTreeType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDocumentTreeService();
}
 
Example #7
Source File: DistributedSortedSetType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedNavigableSetService<>();
}
 
Example #8
Source File: DistributedNavigableSetType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedNavigableSetService<>();
}
 
Example #9
Source File: DistributedListType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedListService();
}
 
Example #10
Source File: DistributedValueType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedValueService();
}
 
Example #11
Source File: AtomicValueType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicValueService();
}
 
Example #12
Source File: DistributedCyclicBarrierType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedCyclicBarrierService();
}
 
Example #13
Source File: DistributedLogType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  throw new UnsupportedOperationException();
}
 
Example #14
Source File: LeaderElectorType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultLeaderElectorService();
}
 
Example #15
Source File: LeaderElectionType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultLeaderElectionService();
}
 
Example #16
Source File: DistributedLockType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedLockService();
}
 
Example #17
Source File: AtomicLockType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicLockService();
}
 
Example #18
Source File: AtomicCounterType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicCounterService();
}
 
Example #19
Source File: DistributedCounterType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicCounterService();
}
 
Example #20
Source File: AtomicSemaphoreType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicSemaphoreService((AtomicSemaphoreServiceConfig) config);
}
 
Example #21
Source File: DistributedSemaphoreType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedSemaphoreService((AtomicSemaphoreServiceConfig) config);
}
 
Example #22
Source File: DistributedQueueType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedQueueService();
}
 
Example #23
Source File: DistributedCollectionType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  throw new UnsupportedOperationException();
}
 
Example #24
Source File: DistributedMultisetType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedMultisetService();
}
 
Example #25
Source File: WorkQueueType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultWorkQueueService();
}
 
Example #26
Source File: AtomicMultimapType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultAtomicMultimapService();
}
 
Example #27
Source File: DistributedMultimapType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new DefaultDistributedMultimapService();
}
 
Example #28
Source File: RaftPerformanceTest.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new PerformanceService();
}
 
Example #29
Source File: ClusterPrimitiveType.java    From zeppelin with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new ClusterStateMachine();
}
 
Example #30
Source File: SessionIdGeneratorType.java    From atomix with Apache License 2.0 4 votes vote down vote up
@Override
public PrimitiveService newService(ServiceConfig config) {
  return new SessionIdGeneratorService();
}