KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > store > raw > data > D_BaseContainerHandle


1 /*
2
3    Derby - Class org.apache.derby.impl.store.raw.data.D_BaseContainerHandle
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    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, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.store.raw.data;
23
24 import org.apache.derby.iapi.services.diag.Diagnosticable;
25 import org.apache.derby.iapi.services.diag.DiagnosticableGeneric;
26 import org.apache.derby.iapi.services.diag.DiagnosticUtil;
27 import org.apache.derby.iapi.services.monitor.ModuleControl;
28
29 import org.apache.derby.iapi.error.StandardException;
30
31 import org.apache.derby.iapi.store.raw.RowLock;
32 import org.apache.derby.iapi.store.raw.ContainerKey;
33
34 import java.util.Properties JavaDoc;
35
36 /**
37
38 The D_BaseContainerHandle class provides diagnostic information about the
39 BaseContainerHandle class. Currently this info is a single string of the form
40     TABLE(conglomerate_id, container_id)
41 **/

42
43 public class D_BaseContainerHandle extends DiagnosticableGeneric
44 {
45
46     /**
47      * Return string identifying the underlying container.
48      * <p>
49      *
50      * @return A string of the form TABLE(conglomerate_id, container_id).
51      * @exception StandardException Standard Cloudscape Error
52      **/

53     public String JavaDoc diag()
54         throws StandardException
55     {
56         BaseContainerHandle ch = (BaseContainerHandle) diag_object;
57         String JavaDoc str = null;
58
59         /*
60         String str =
61             "BaseContainerHandle:(" +
62             DiagnosticUtil.toDiagString(ch.identity) +
63             ")";
64         */

65
66         long container_id = ch.identity.getContainerId();
67
68         long conglom_id =
69             D_DiagnosticUtil.diag_containerid_to_conglomid(
70                     ch.xact.getDataFactory(),
71                     container_id);
72
73         if (conglom_id != Long.MIN_VALUE)
74         {
75             str = "TABLE(" + conglom_id + "," + container_id + ")";
76         }
77         else
78         {
79             str = "TABLE(Booting..., " + container_id + ")";
80         }
81
82         // RESOLVE (mikem) - during boot we can't ask acces to give us the
83
// containerid info, since access hasn't booted yet. For now just
84
// assume that is why we got a bad containerid number and don't print
85
// the containerid so that we can diff the output.
86
/*
87         else
88         {
89             str = "TABLE(?, " + container_id + ")";
90
91             Thread.dumpStack();
92         }
93         */

94
95         return(str);
96     }
97
98     /**
99      * Return a set of properties describing the the key used to lock container.
100      * <p>
101      * Used by debugging code to print the lock table on demand.
102      *
103      * @exception StandardException Standard exception policy.
104      **/

105     public void diag_detail(Properties JavaDoc prop)
106         throws StandardException
107     {
108         BaseContainerHandle ch = (BaseContainerHandle) diag_object;
109         ContainerKey key = ch.getId();
110
111         prop.put(RowLock.DIAG_CONTAINERID, Long.toString(key.getContainerId()));
112
113         prop.put(RowLock.DIAG_SEGMENTID, Long.toString(key.getSegmentId()));
114
115         // The following 2 don't make sense for container locks, just set
116
// them to 0 to make it easier for now to tree container locks and
117
// row locks similarly.
118
prop.put(RowLock.DIAG_PAGENUM, Integer.toString(0));
119         prop.put(RowLock.DIAG_RECID, Integer.toString(0));
120
121         return;
122     }
123 }
124
Popular Tags