|
| 1 | +/* |
| 2 | + * Copyright 1999-2018 Alibaba Group Holding Ltd. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.alibaba.csp.sentinel.cluster; |
| 17 | + |
| 18 | +import java.util.Map; |
| 19 | + |
| 20 | +/** |
| 21 | + * Result entity of acquiring cluster flow token. |
| 22 | + * |
| 23 | + * @author Eric Zhao |
| 24 | + * @since 1.4.0 |
| 25 | + */ |
| 26 | +public class TokenResult { |
| 27 | + |
| 28 | + private Integer status; |
| 29 | + |
| 30 | + private int remaining; |
| 31 | + private int waitInMs; |
| 32 | + |
| 33 | + private Map<String, String> attachments; |
| 34 | + |
| 35 | + public TokenResult() {} |
| 36 | + |
| 37 | + public TokenResult(Integer status) { |
| 38 | + this.status = status; |
| 39 | + } |
| 40 | + |
| 41 | + public Integer getStatus() { |
| 42 | + return status; |
| 43 | + } |
| 44 | + |
| 45 | + public TokenResult setStatus(Integer status) { |
| 46 | + this.status = status; |
| 47 | + return this; |
| 48 | + } |
| 49 | + |
| 50 | + public int getRemaining() { |
| 51 | + return remaining; |
| 52 | + } |
| 53 | + |
| 54 | + public TokenResult setRemaining(int remaining) { |
| 55 | + this.remaining = remaining; |
| 56 | + return this; |
| 57 | + } |
| 58 | + |
| 59 | + public int getWaitInMs() { |
| 60 | + return waitInMs; |
| 61 | + } |
| 62 | + |
| 63 | + public TokenResult setWaitInMs(int waitInMs) { |
| 64 | + this.waitInMs = waitInMs; |
| 65 | + return this; |
| 66 | + } |
| 67 | + |
| 68 | + public Map<String, String> getAttachments() { |
| 69 | + return attachments; |
| 70 | + } |
| 71 | + |
| 72 | + public TokenResult setAttachments(Map<String, String> attachments) { |
| 73 | + this.attachments = attachments; |
| 74 | + return this; |
| 75 | + } |
| 76 | + |
| 77 | + @Override |
| 78 | + public String toString() { |
| 79 | + return "TokenResult{" + |
| 80 | + "status=" + status + |
| 81 | + ", remaining=" + remaining + |
| 82 | + ", waitInMs=" + waitInMs + |
| 83 | + ", attachments=" + attachments + |
| 84 | + '}'; |
| 85 | + } |
| 86 | +} |
0 commit comments