View Javadoc
1   package org.metricshub.ipmi.core.connection.queue;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * IPMI Java Client
6    * ჻჻჻჻჻჻
7    * Copyright 2023 Verax Systems, MetricsHub
8    * ჻჻჻჻჻჻
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23   */
24  
25  import org.metricshub.ipmi.core.coding.PayloadCoder;
26  import org.metricshub.ipmi.core.coding.commands.ResponseData;
27  
28  import java.util.Date;
29  
30  public class QueueElement {
31      private int id;
32      /**
33       * @deprecated retries on message level are deprecated
34       */
35      @Deprecated
36      private int retries;
37      private boolean timedOut;
38  
39      private PayloadCoder request;
40      private ResponseData response;
41      private Date timestamp;
42  
43      public QueueElement(int id, PayloadCoder request) {
44          this.id = id;
45          this.request = request;
46          timestamp = new Date();
47          retries = 0;
48          this.timedOut = false;
49      }
50  
51      public int getId() {
52          return id;
53      }
54  
55      public void setId(int id) {
56          this.id = id;
57      }
58  
59      /**
60       * @deprecated retries on message level are deprecated
61       */
62      @Deprecated
63      public int getRetries() {
64          return retries;
65      }
66  
67      /**
68       * @deprecated retries on message level are deprecated
69       */
70      @Deprecated
71      public void setRetries(int retries) {
72          this.retries = retries;
73      }
74  
75      public PayloadCoder getRequest() {
76          return request;
77      }
78  
79      public void setRequest(PayloadCoder request) {
80          this.request = request;
81      }
82  
83      public ResponseData getResponse() {
84          return response;
85      }
86  
87      public void setResponse(ResponseData response) {
88          this.response = response;
89      }
90  
91      public Date getTimestamp() {
92          return timestamp;
93      }
94  
95      public void refreshTimestamp() {
96          timestamp = new Date();
97      }
98  
99      public boolean isTimedOut() {
100         return timedOut;
101     }
102 
103     public void makeTimedOut() {
104         this.timedOut = true;
105     }
106 }