本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}