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


Java ResultSet.getAvailableWithoutFetching方法代码示例

本文整理汇总了Java中com.datastax.driver.core.ResultSet.getAvailableWithoutFetching方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.getAvailableWithoutFetching方法的具体用法?Java ResultSet.getAvailableWithoutFetching怎么用?Java ResultSet.getAvailableWithoutFetching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.ResultSet的用法示例。


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

示例1: getPage

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
private TimelinePageVM getPage(Select select, String page, int limit) {
    //If we have a 'next' page set we deserialise it and add it to the select
    //statement
    if (page != null) {
        select.setPagingState(PagingState.fromString(page));
    }

    //Execute the query
    ResultSet resultSet = session.execute(select);

    //Get the next paging state
    PagingState newPagingState = resultSet.getExecutionInfo().getPagingState();
    //The number of rows that can be read without fetching
    int remaining = resultSet.getAvailableWithoutFetching();

    List<XmTimeline> timelines = new ArrayList<>(limit);

    for (Row row : resultSet) {
        XmTimeline timeline = TimelineMapper.createTimeline(row);

        timelines.add(timeline);

        //If we can't move to the next row without fetching we break
        if (--remaining == 0) {
            break;
        }
    }

    //Serialise the next paging state
    String serializedNewPagingState = newPagingState != null
        ? newPagingState.toString() :
        null;

    //Return an object with a list of timelines and the next paging state
    return new TimelinePageVM(timelines, serializedNewPagingState);
}
 
开发者ID:xm-online,项目名称:xm-ms-timeline,代码行数:37,代码来源:TimelineRepository.java

示例2: executeUpdate

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
/**
 * 描述: 数据操作(Insert|Update|Delete)
 * 时间: 2017年11月15日 上午11:27:52
 * @author yi.zhang
 * @param cql	cql语句
 * @param params	参数
 * @return	返回值
 */
public int executeUpdate(String cql, Object... params) {
	try {
		if(session!=null){
			init(servers, keyspace, username, password);
		}
		ResultSet rs = session.execute(cql, params);
		return rs.getAvailableWithoutFetching();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return -1;
}
 
开发者ID:dev-share,项目名称:database-transform-tool,代码行数:22,代码来源:CassandraFactory.java

示例3: process

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void process(CycleLog cycleLog) throws Exception {
  
  // get cycle's planned start calendar
  Calendar plannedStartCalendar =
    CalendarAndDateOperationsInl.getCalendarFromUnixTime(
      cycleLog.getPlannedStartTime() );
  
  // -1 hour -- this cycle should check for the jobs from the past hour
  plannedStartCalendar.set(Calendar.HOUR_OF_DAY, -1);
  
  // query all jobs within cycle's hour
  ResultSet resultSet =
    HourlyCurrentJobs.i().executeSyncSelect(
      CalendarFormatterInl.concatCalendarFields(
        plannedStartCalendar,
        Calendar.YEAR,
        Calendar.MONTH,
        Calendar.DAY_OF_MONTH,
        Calendar.HOUR_OF_DAY) );
  
  // to to fetch each job
  ResultSet currJobResultSet;
  
  String currSerializedJob;
  Job currJob;
  
  // retry executing every found job (failed to execute job)
  for (Row row : resultSet) {
    
    if (resultSet.getAvailableWithoutFetching() <=
        Constants.kCassandraPrefetchLimit &&
        resultSet.isFullyFetched() == false) {
      
      // this is asynchronous
      resultSet.fetchMoreResults();
    }
    
    // select job
    currJobResultSet =
      CurrentJobs.i().executeSyncSelect(
        row.getUUID(HourlyCurrentJobs.kJobIdColumnName) );
    
    // couldn't get job?
    if (currJobResultSet.isExhausted() == true) {
      
      // may need to log an exception here depending how how this service,
      //   the main service and the dispense work together - in terms of sync
      continue;
    }
    
    // get serialized job
    currSerializedJob =
      EncodingInl.decodeStringFromByteBuffer(
        currJobResultSet.one().getBytes(
          CurrentJobs.kJobColumnName) );
    
    // deserialize
    currJob = SerializationInl.<Job>deserializeObject(currSerializedJob);
    
    // execute job (retry)
    JobsExecutorInl.executeJobsAsync(currJob);
  }
}
 
开发者ID:vangav,项目名称:vos_instagram_jobs,代码行数:65,代码来源:RestJobs.java


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