当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionState.LOST属性代码示例

本文整理汇总了Java中org.apache.curator.framework.state.ConnectionState.LOST属性的典型用法代码示例。如果您正苦于以下问题:Java ConnectionState.LOST属性的具体用法?Java ConnectionState.LOST怎么用?Java ConnectionState.LOST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.curator.framework.state.ConnectionState的用法示例。


在下文中一共展示了ConnectionState.LOST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
    if (newState == ConnectionState.CONNECTED) {
        isConnected.set(true);
        if (!isFirstConnection.get()) {
            for (ConnectionStateListener listener : listenerStateProxy.getListeners()) {
                listener.stateChanged(client, ConnectionState.RECONNECTED);
            }
        }
        return;
    }

    if (newState == ConnectionState.LOST) {
        isConnected.set(false);
        isFirstConnection.set(false);
        retryConnection();
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:18,代码来源:RedirectorCuratorFramework.java

示例2: stateChanged

@Override
public void stateChanged(final CuratorFramework client, final ConnectionState newState) {
    JobScheduleController jobScheduleController = JobRegistry.getInstance().getJobScheduleController(jobName);
    if (ConnectionState.LOST == newState) {
        jobScheduleController.pauseJob();
    } else if (ConnectionState.RECONNECTED == newState) {
        if (!leaderElectionService.hasLeader()) {
            leaderElectionService.leaderElection();
        }
        serverService.persistServerOnline();
        executionService.clearRunningInfo(shardingService.getLocalHostShardingItems());
        if (!serverService.isJobPausedManually()) {
            jobScheduleController.resumeJob();
        }
    }
}
 
开发者ID:artoderk,项目名称:elastic-jobx,代码行数:16,代码来源:JobOperationListenerManager.java

示例3: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
  mIsLeader.set(false);

  if ((newState == ConnectionState.LOST) || (newState == ConnectionState.SUSPENDED)) {
    if (mCurrentMasterThread != null) {
      mCurrentMasterThread.interrupt();
    }
  } else {
    try {
      LOG.info("The current leader is " + LEADER_SELECTOR.getLeader().getId());
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
    }
  }
}
 
开发者ID:mtunique,项目名称:tachyon-rdma,代码行数:16,代码来源:LeaderSelectorClient.java

示例4: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
    if (newState == ConnectionState.SUSPENDED || newState == ConnectionState.LOST) {
        this.isLeader = false;
        leaderExecutor.shutdownNow();
        throw new CancelLeadershipException();
    }
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:8,代码来源:DistributedSequenceHandler.java

示例5: stateChanged

@Override
public void stateChanged(CuratorFramework framework, ConnectionState newState) {
    if (newState == ConnectionState.SUSPENDED || newState == ConnectionState.LOST) {
        this.isLeader = false;
        leaderExecutor.shutdownNow();
        throw new CancelLeadershipException();
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:8,代码来源:DistributedSequenceHandler.java

示例6: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
  if (newState == ConnectionState.LOST) {
    LOG.error("Aborting due to new connection state received from ZooKeeper: {}", newState);
    abort(AbortReason.LOST_ZK_CONNECTION, Optional.<Throwable>absent());
  }
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:7,代码来源:SingularityAbort.java

示例7: KafkaConsumerCache

/**
 * Creates a KafkaConsumerCache object. Before it is used, you must call
 * startCache()
 * 
 * @param apiId
 * @param s
 * @param metrics
 */
public KafkaConsumerCache(String apiId,  MetricsSet metrics) {

	if (apiId == null) {
		throw new IllegalArgumentException("API Node ID must be specified.");
	}

	fApiId = apiId;
//	fSettings = s;
	fMetrics = metrics;
	String strkSetting_ZkBasePath= AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,kSetting_ZkBasePath);
	if(null==strkSetting_ZkBasePath)strkSetting_ZkBasePath = kDefault_ZkBasePath;
	fBaseZkPath = strkSetting_ZkBasePath;

	fConsumers = new ConcurrentHashMap<String, KafkaConsumer>();
	fSweepScheduler = Executors.newScheduledThreadPool(1);

	curatorConsumerCache = null;

	status = Status.NOT_STARTED;

	listener = new ConnectionStateListener() {
		public void stateChanged(CuratorFramework client, ConnectionState newState) {
			if (newState == ConnectionState.LOST) {
				log.info("ZooKeeper connection expired");
				handleConnectionLoss();
			} else if (newState == ConnectionState.READ_ONLY) {
				log.warn("ZooKeeper connection set to read only mode.");
			} else if (newState == ConnectionState.RECONNECTED) {
				log.info("ZooKeeper connection re-established");
				handleReconnection();
			} else if (newState == ConnectionState.SUSPENDED) {
				log.warn("ZooKeeper connection has been suspended.");
				handleConnectionSuspended();
			}
		}
	};
}
 
开发者ID:att,项目名称:dmaap-framework,代码行数:45,代码来源:KafkaConsumerCache.java

示例8: stateChanged

@Override
public void stateChanged(final CuratorFramework client, final ConnectionState state) {
  if (state == ConnectionState.LOST || state == ConnectionState.SUSPENDED) {
    log.warn("connection state changed, now");
    isStop.set(true);
  }
}
 
开发者ID:Yirendai,项目名称:cicada,代码行数:7,代码来源:ClusterLeaderManager.java

示例9: stateChanged

@Override
public void stateChanged(final CuratorFramework client, final ConnectionState newState) {
    if (ConnectionState.LOST == newState) {
        log.info("Connection lost from zookeeper :server=" + serverLists + ", namespace=" + namespace);
    }

    if (ConnectionState.RECONNECTED == newState) {
        log.info("Reconnection from zookeeper :server=" + serverLists + ", namespace=" + namespace);
    }
}
 
开发者ID:artoderk,项目名称:elastic-jobx,代码行数:10,代码来源:ConsoleRegistryCenter.java

示例10: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
    if ((newState == ConnectionState.SUSPENDED) || (newState == ConnectionState.LOST)) {
        try {
            shutdown();
        } catch (SchedulerException e) {
            throw new RuntimeException("failed to shutdown scheduler", e);
        }
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:10,代码来源:DistributedScheduler.java

示例11: stateChanged

@Override
public void stateChanged(CuratorFramework curatorFramework, ConnectionState newState)
{
    if ( (newState == ConnectionState.LOST) || (newState == ConnectionState.SUSPENDED) )
    {
        if ( ourThread != null )
        {
            ourThread.interrupt();
        }
    }
}
 
开发者ID:apache,项目名称:curator,代码行数:11,代码来源:TestLeaderSelectorWithExecutor.java

示例12: stateChanged

@Override
  public void stateChanged(CuratorFramework client, ConnectionState newState) {
      if (newState == ConnectionState.CONNECTED) {
          if (registration == null) {
              registration = bundleContext.registerService(CuratorFramework.class, curator, null);
          }
      }
      for (ConnectionStateListener listener : connectionStateListeners) {
          listener.stateChanged(client, newState);
      }
      if (newState == ConnectionState.LOST) {
          run();
      }
}
 
开发者ID:tdiesler,项目名称:fabric8poc,代码行数:14,代码来源:ManagedCuratorFramework.java

示例13: stateChanged

@Override
public void stateChanged(CuratorFramework curatorFramework, ConnectionState newState) {
    if (newState == ConnectionState.LOST || newState == ConnectionState.SUSPENDED) {
        LOG.debug("Lost leadership due to ZK state change to {}: {}", newState, getId());
        closeLeaderLatch();
    }
}
 
开发者ID:bazaarvoice,项目名称:curator-extensions,代码行数:7,代码来源:LeaderService.java

示例14: stateChanged

public void stateChanged(CuratorFramework curatorFramework, ConnectionState connectionState) {
    log.info("Connection to Zookeeper toggled to state " + connectionState.toString());
    connected = connectionState == ConnectionState.CONNECTED || connectionState == ConnectionState.RECONNECTED;
    if (connectionState == ConnectionState.LOST) {
        log.error("Connection to Zookeeper toggled to state " + connectionState.toString());
        this.handleZookeeperConnectionFailed();
    } else if (connectionState == ConnectionState.RECONNECTED) {
        log.info("Reconnected to zookeeper, forcing lock scavenge");
        forceLockScavenge();
    } else {
        log.info("Connection to Zookeeper toggled to state " + connectionState.toString());
    }
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:13,代码来源:ZKShardLockManager.java

示例15: stateChanged

@Override
public void stateChanged(CuratorFramework client, ConnectionState newState) {
	if (newState == ConnectionState.SUSPENDED || newState == ConnectionState.LOST) {
		lastState = newState;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:ZooKeeperCheckpointIDCounter.java


注:本文中的org.apache.curator.framework.state.ConnectionState.LOST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。