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


Java ExceptionClass.UNAUTHORIZED属性代码示例

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


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

示例1: SnowFlake

/**
 * Constructor SnowFlake
 * @return new SnowFlake Object
 * @throws Exception
 */
private  SnowFlake () throws Exception {
  
  this.machineId = this.getMachineId();
  
  if (this.machineId > this.maxMachineId || this.machineId < 0) {

    throw new CodeException(
      81,
      2,
      "machineId > maxMachineId (maximum number of allowed instances is ["
      + this.maxMachineId
      + "] )",
      ExceptionClass.UNAUTHORIZED);
  }
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:20,代码来源:SnowFlake.java

示例2: getNewId

/**
 * getNewId
 * @return new SnowFlake 64-bits ID
 * @throws Exception
 */
public synchronized long getNewId () throws Exception {
  
  long timestamp = System.currentTimeMillis();
  
  if (timestamp < this.lastTimestamp) {
    
    throw new CodeException(
      81,
      3,
      "Clock moved backwards. Can't generate an out of sequence ID for "
      + "time stamp ["
      + (this.lastTimestamp - timestamp)
      + "milliseconds] "
      + "double check that instances is in sync with its NTP time server",
      ExceptionClass.UNAUTHORIZED);
  }
  
  if (this.lastTimestamp == timestamp) {
  
    this.sequence = (this.sequence + 1) % this.sequenceMax;
    
    if (this.sequence == 0) {
    
      timestamp = this.tilNextMillis(this.lastTimestamp);
    }
  } else {
    
    this.sequence = 0;
  }
  
  this.lastTimestamp = timestamp;
  
  Long id = ((timestamp - this.customEpoch) << this.timeStampLeftShift) |
            (this.machineId << this.machineIdShift) | this.sequence;
  
  return id;
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:42,代码来源:SnowFlake.java

示例3: fromJsonString

@Override
@JsonIgnore
final protected RequestJsonBody fromJsonString (
  String json) throws Exception {
  
  throw new CodeException(
    151,
    9,
    "this is a POST request method called for what should be a GET request",
    ExceptionClass.UNAUTHORIZED);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:11,代码来源:RequestJsonBodyGet.java

示例4: fromQueryString

@Override
@JsonIgnore
final protected RequestJsonBody fromQueryString (
  Map<String, String[]> query) throws Exception {
  
  throw new CodeException(
    151,
    11,
    "this is a GET request method called for what should be a POST request",
    ExceptionClass.UNAUTHORIZED);
}
 
开发者ID:vangav,项目名称:vos_backend,代码行数:11,代码来源:RequestJsonBodyPost.java


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