View Javadoc
1   // NAME
2   //      $RCSfile: SnmpContextPoolItem.java,v $
3   // DESCRIPTION
4   //      [given below in javadoc format]
5   // DELTA
6   //      $Revision: 3.4 $
7   // CREATED
8   //      $Date: 2006/01/17 17:33:04 $
9   // COPYRIGHT
10  //      Westhawk Ltd
11  // TO DO
12  //
13  
14  /*
15   * Copyright (C) 2002 - 2006 by Westhawk Ltd
16   * <a href="www.westhawk.co.uk">www.westhawk.co.uk</a>
17   *
18   * Permission to use, copy, modify, and distribute this software
19   * for any purpose and without fee is hereby granted, provided
20   * that the above copyright notices appear in all copies and that
21   * both the copyright notice and this permission notice appear in
22   * supporting documentation.
23   * This software is provided "as is" without express or implied
24   * warranty.
25   * author <a href="mailto:snmp@westhawk.co.uk">Tim Panton</a>
26   */
27  
28  package uk.co.westhawk.snmp.stack;
29  
30  /*-
31   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
32   * SNMP Java Client
33   * ჻჻჻჻჻჻
34   * Copyright 2023 MetricsHub, Westhawk
35   * ჻჻჻჻჻჻
36   * This program is free software: you can redistribute it and/or modify
37   * it under the terms of the GNU Lesser General Public License as
38   * published by the Free Software Foundation, either version 3 of the
39   * License, or (at your option) any later version.
40   *
41   * This program is distributed in the hope that it will be useful,
42   * but WITHOUT ANY WARRANTY; without even the implied warranty of
43   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44   * GNU General Lesser Public License for more details.
45   *
46   * You should have received a copy of the GNU General Lesser Public
47   * License along with this program.  If not, see
48   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
49   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
50   */
51  
52  import java.util.*;
53  import uk.co.westhawk.snmp.event.*;
54  
55  /**
56   * This class contains one context and one reference counter.
57   * The reference counter
58   * maintains how many objects reference this context. 
59   * It is a helper class for the context pools, to improve the
60   * synchronisation. 
61   *
62   * @see SnmpContextPool
63   * @see SnmpContextv2cPool
64   * @see SnmpContextv3Pool
65   * @since 4_12
66   *
67   * @author <a href="mailto:snmp@westhawk.co.uk">Birgit Arkesteijn</a>
68   * @version $Revision: 3.4 $ $Date: 2006/01/17 17:33:04 $
69   */
70  class SnmpContextPoolItem {
71      private static final String version_id = "@(#)$Id: SnmpContextPoolItem.java,v 3.4 2006/01/17 17:33:04 birgit Exp $ Copyright Westhawk Ltd";
72  
73      private SnmpContextBasisFace context = null;
74      private int counter = 0;
75  
76      /**
77       * Constructor.
78       *
79       * @param con The context
80       */
81      SnmpContextPoolItem(SnmpContextBasisFace con) {
82          context = con;
83          counter = 0;
84      }
85  
86      SnmpContextBasisFace getContext() {
87          return context;
88      }
89  
90      int getCounter() {
91          return counter;
92      }
93  
94      void setCounter(int i) {
95          counter = i;
96      }
97  
98      /**
99       * Returns a string representation of the object.
100      * 
101      * @return The string
102      */
103     public String toString() {
104         StringBuffer buffer = new StringBuffer("SnmpContextPoolItem[");
105         buffer.append("context=").append(context.toString());
106         buffer.append(", counter=").append(counter);
107         buffer.append("]");
108         return buffer.toString();
109     }
110 
111 }