%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jcs.auxiliary.disk.jdbc.TableState |
|
|
1 | package org.apache.jcs.auxiliary.disk.jdbc; |
|
2 | ||
3 | /* |
|
4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
5 | * or more contributor license agreements. See the NOTICE file |
|
6 | * distributed with this work for additional information |
|
7 | * regarding copyright ownership. The ASF licenses this file |
|
8 | * to you under the Apache License, Version 2.0 (the |
|
9 | * "License"); you may not use this file except in compliance |
|
10 | * with the License. You may obtain a copy of the License at |
|
11 | * |
|
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
13 | * |
|
14 | * Unless required by applicable law or agreed to in writing, |
|
15 | * software distributed under the License is distributed on an |
|
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
17 | * KIND, either express or implied. See the License for the |
|
18 | * specific language governing permissions and limitations |
|
19 | * under the License. |
|
20 | */ |
|
21 | ||
22 | import java.io.Serializable; |
|
23 | ||
24 | /** |
|
25 | * This is used by various elemetns of the JDBC disk cache to indicate the |
|
26 | * status of a table. The MySQL disk cache, for instance, marks the status as |
|
27 | * optimizing when a scheduled optimizatio is taking place. This allows the |
|
28 | * cache to balk rather than block during long running optimizations. |
|
29 | * <p> |
|
30 | * @author Aaron Smuts |
|
31 | */ |
|
32 | public class TableState |
|
33 | implements Serializable |
|
34 | { |
|
35 | /** Don't change. */ |
|
36 | private static final long serialVersionUID = -6625081552084964885L; |
|
37 | ||
38 | /** Name of the table whose state this reflects. */ |
|
39 | private String tableName; |
|
40 | ||
41 | /** |
|
42 | * The table is free. It can be accessed and no potentially table locking |
|
43 | * jobs are running. |
|
44 | */ |
|
45 | public static final int FREE = 0; |
|
46 | ||
47 | /** A potentially table locking deletion is running */ |
|
48 | public static final int DELETE_RUNNING = 1; |
|
49 | ||
50 | /** A table locking optimization is running. */ |
|
51 | public static final int OPTIMIZATION_RUNNING = 2; |
|
52 | ||
53 | /** we might want to add error */ |
|
54 | 49 | private int state = FREE; |
55 | ||
56 | /** |
|
57 | * Construct a usable table state. |
|
58 | * <p> |
|
59 | * @param tableName |
|
60 | */ |
|
61 | public TableState( String tableName ) |
|
62 | 49 | { |
63 | 49 | this.setTableName( tableName ); |
64 | 49 | } |
65 | ||
66 | /** |
|
67 | * @param tableName |
|
68 | * The tableName to set. |
|
69 | */ |
|
70 | public void setTableName( String tableName ) |
|
71 | { |
|
72 | 49 | this.tableName = tableName; |
73 | 49 | } |
74 | ||
75 | /** |
|
76 | * @return Returns the tableName. |
|
77 | */ |
|
78 | public String getTableName() |
|
79 | { |
|
80 | 0 | return tableName; |
81 | } |
|
82 | ||
83 | /** |
|
84 | * @param state |
|
85 | * The state to set. |
|
86 | */ |
|
87 | public void setState( int state ) |
|
88 | { |
|
89 | 59 | this.state = state; |
90 | 59 | } |
91 | ||
92 | /** |
|
93 | * @return Returns the state. |
|
94 | */ |
|
95 | public int getState() |
|
96 | { |
|
97 | 224 | return state; |
98 | } |
|
99 | ||
100 | /** |
|
101 | * Write out the values for debugging purposes. |
|
102 | * <p> |
|
103 | * @return String |
|
104 | */ |
|
105 | public String toString() |
|
106 | { |
|
107 | 0 | StringBuffer str = new StringBuffer(); |
108 | 0 | str.append( "TableState " ); |
109 | 0 | str.append( "\n TableName = " + getTableName() ); |
110 | 0 | str.append( "\n State = " + getState() ); |
111 | 0 | return str.toString(); |
112 | } |
|
113 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |