You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2006/07/11 22:14:09 UTC

svn commit: r420975 - /jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java

Author: asmuts
Date: Tue Jul 11 13:14:09 2006
New Revision: 420975

URL: http://svn.apache.org/viewvc?rev=420975&view=rev
Log:
I also changed the get to use toString rather than assume that the key is a string.

Added:
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java

Added: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java?rev=420975&view=auto
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java (added)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/TableState.java Tue Jul 11 13:14:09 2006
@@ -0,0 +1,105 @@
+package org.apache.jcs.auxiliary.disk.jdbc;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache
+ * License, Version 2.0 (the "License") you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+import java.io.Serializable;
+
+/**
+ * This is used by various elemetns of the JDBC disk cache to indicate the
+ * status of a table. The MySQL disk cache, for instance, marks the status as
+ * optimizing when a scheduled optimizatio is taking place. This allows the
+ * cache to balk rather than block during long running optimizations.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class TableState
+    implements Serializable
+{
+    private static final long serialVersionUID = -6625081552084964885L;
+
+    private String tableName;
+
+    /**
+     * The table is free. It can be accessed and no potentially table locking
+     * jobs are running.
+     */
+    public static final int FREE = 0;
+
+    /** A potentially table locking deletion is running */
+    public static final int DELETE_RUNNING = 1;
+
+    /** A table locking optimization is running. */
+    public static final int OPTIMIZATION_RUNNING = 2;
+
+    // we might want to add error
+
+    private int state = FREE;
+
+    /**
+     * Construct a usable table state.
+     * <p>
+     * @param tableName
+     */
+    public TableState( String tableName )
+    {
+        this.setTableName( tableName );
+    }
+
+    /**
+     * @param tableName
+     *            The tableName to set.
+     */
+    public void setTableName( String tableName )
+    {
+        this.tableName = tableName;
+    }
+
+    /**
+     * @return Returns the tableName.
+     */
+    public String getTableName()
+    {
+        return tableName;
+    }
+
+    /**
+     * @param state
+     *            The state to set.
+     */
+    public void setState( int state )
+    {
+        this.state = state;
+    }
+
+    /**
+     * @return Returns the state.
+     */
+    public int getState()
+    {
+        return state;
+    }
+
+    /**
+     * Write out the values for debugging purposes.
+     * <p>
+     * @return String
+     */
+    public String toString()
+    {
+        StringBuffer str = new StringBuffer();
+        str.append( "TableState " );
+        str.append( "\n TableName = " + getTableName() );
+        str.append( "\n State = " + getState() );
+        return str.toString();
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-dev-help@jakarta.apache.org