KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > appserver > debugger > applet > io > Snapshot


1 /*-----------------------------------------------------------------------------
2  * Enhydra Java Application Server
3  * Copyright 1997-2000 Lutris Technologies, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the distribution.
14  * 3. All advertising materials mentioning features or use of this software
15  * must display the following acknowledgement:
16  * This product includes Enhydra software developed by Lutris
17  * Technologies, Inc. and its contributors.
18  * 4. Neither the name of Lutris Technologies nor the names of its contributors
19  * may be used to endorse or promote products derived from this software
20  * without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY LUTRIS TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL LUTRIS TECHNOLOGIES OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *-----------------------------------------------------------------------------
34  * $Id: Snapshot.java,v 1.1 2004/04/06 15:24:32 rale Exp $
35  *-----------------------------------------------------------------------------
36  */

37
38
39
40
41
42 package com.lutris.appserver.debugger.applet.io;
43
44 import java.io.Serializable JavaDoc;
45
46
47 public class Snapshot implements Serializable JavaDoc {
48
49     public long stateId;
50     public ServletDescription[] servlets;
51     public TransactionDescription[] transactions;
52
53     public Snapshot() {
54         stateId = -1;
55         servlets = new ServletDescription[0];
56         transactions = new TransactionDescription[0];
57   
58     }
59
60     public String JavaDoc toString() {
61         String JavaDoc s = "Snapshot id=" + stateId + " servlets = {";
62         if (servlets.length > 0)
63             s += servlets[0];
64         for (int i=1; i<servlets.length; i++)
65             s += ", " + servlets[i];
66         s += "} " + transactions.length + " transactions";
67         if (transactions.length > 0) {
68             int min = transactions[0].id;
69             int max = min;
70             for (int i=0; i<transactions.length; i++) {
71                 if (transactions[i].id > max)
72                     max = transactions[i].id;
73                 if (transactions[i].id < min)
74                     min = transactions[i].id;
75             }
76             s += " minId=" + min + ", maxId=" + max;
77         }
78         return s;
79     }
80             
81 }
82
Popular Tags