public void createService() throws Exception { if (this.partition == null) { throw new IllegalStateException("HAPartition property must be set before creating DistributedReplicantManager service"); } this.log.debug("registerRPCHandler"); this.partition.registerRPCHandler(SERVICE_NAME, this); this.log.debug("subscribeToStateTransferEvents"); this.partition.subscribeToStateTransferEvents(SERVICE_NAME, this); this.log.debug("registerMembershipListener"); this.partition.registerMembershipListener(this); }
@Override protected void startService() throws Exception { if (this.partition == null) { this.partition = HAPartitionLocator.getHAPartitionLocator().getHAPartition(this.partitionName, null); } // Register as a listener of cluster membership changes this.partition.registerMembershipListener(this); this.log.info("Registered as MembershipListener"); try { this.hostname = InetAddress.getLocalHost().getHostName(); } catch (IOException e) { this.log.warn("Failed to lookup local hostname", e); this.hostname = "<unknown>"; } }