Package org.apache.helix.participant

Examples of org.apache.helix.participant.AbstractParticipantService


      ParticipantId participantId = ParticipantId.from(cliParser.getOptionValue("participantId"));
      String participantClass = cliParser.getOptionValue("participantClass");
      @SuppressWarnings("unchecked")
      Class<? extends AbstractParticipantService> clazz =
          (Class<? extends AbstractParticipantService>) Class.forName(participantClass);
      final AbstractParticipantService containerParticipant =
          clazz.getConstructor(HelixConnection.class, ClusterId.class, ParticipantId.class)
              .newInstance(connection, clusterId, participantId);
      containerParticipant.startAsync();
      containerParticipant.awaitRunning(60, TimeUnit.SECONDS);
      containerParticipant
          .getParticipant()
          .getMessagingService()
          .registerMessageHandlerFactory(MessageType.SHUTDOWN.toString(),
              new ShutdownMessageHandlerFactory(containerParticipant, connection));
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
          LOG.info("Received a shutdown signal. Stopping participant");
          containerParticipant.stopAsync();
          containerParticipant.awaitTerminated();
          connection.disconnect();
        }
      }) {

      });
View Full Code Here

TOP

Related Classes of org.apache.helix.participant.AbstractParticipantService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.