Source Code Cross Referenced for EventTrace.java in  » JMX » je » com » sleepycat » je » utilint » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » je » com.sleepycat.je.utilint 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2002,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: EventTrace.java,v 1.11.2.2 2008/01/07 15:14:18 cwl Exp $
007:         */
008:
009:        package com.sleepycat.je.utilint;
010:
011:        /**
012:         * Internal class used for transient event tracing.  Subclass this with
013:         * specific events.  Subclasses should have toString methods for display and
014:         * events should be added by calling EventTrace.addEvent();
015:         */
016:        public class EventTrace {
017:            static private int MAX_EVENTS = 100;
018:
019:            static public final boolean TRACE_EVENTS = false;
020:
021:            static int currentEvent = 0;
022:
023:            static final EventTrace[] events = new EventTrace[MAX_EVENTS];
024:            static final int[] threadIdHashes = new int[MAX_EVENTS];
025:            static boolean disableEvents = false;
026:
027:            protected String comment;
028:
029:            public EventTrace(String comment) {
030:                this .comment = comment;
031:            }
032:
033:            public EventTrace() {
034:                comment = null;
035:            }
036:
037:            public String toString() {
038:                return comment;
039:            }
040:
041:            static public void addEvent(EventTrace event) {
042:                if (disableEvents) {
043:                    return;
044:                }
045:                int nextEventIdx = currentEvent++ % MAX_EVENTS;
046:                events[nextEventIdx] = event;
047:                threadIdHashes[nextEventIdx] = System.identityHashCode(Thread
048:                        .currentThread());
049:            }
050:
051:            static public void addEvent(String comment) {
052:                if (disableEvents) {
053:                    return;
054:                }
055:                addEvent(new EventTrace(comment));
056:            }
057:
058:            static public void dumpEvents() {
059:                if (disableEvents) {
060:                    return;
061:                }
062:                System.out.println("----- Event Dump -----");
063:                EventTrace[] oldEvents = events;
064:                int[] oldThreadIdHashes = threadIdHashes;
065:                disableEvents = true;
066:
067:                int j = 0;
068:                for (int i = currentEvent; j < MAX_EVENTS; i++) {
069:                    EventTrace ev = oldEvents[i % MAX_EVENTS];
070:                    if (ev != null) {
071:                        int this EventIdx = i % MAX_EVENTS;
072:                        System.out.print(oldThreadIdHashes[this EventIdx] + " ");
073:                        System.out.println(j + "(" + this EventIdx + "): " + ev);
074:                    }
075:                    j++;
076:                }
077:            }
078:
079:            static public class ExceptionEventTrace extends EventTrace {
080:                private Exception event;
081:
082:                public ExceptionEventTrace() {
083:                    event = new Exception();
084:                }
085:
086:                public String toString() {
087:                    return Tracer.getStackTrace(event);
088:                }
089:            }
090:        }
091:
092:        /*
093:        static public class EvictEvent extends EventTrace {
094:        long nodeId;
095:        int addr;
096:
097:        public EvictEvent(String comment, long nodeId, int addr) {
098:            super(comment);
099:            this.nodeId = nodeId;
100:            this.addr = addr;
101:        }
102:
103:        static public void addEvent(String comment, IN node) {
104:            long nodeId = node.getNodeId();
105:            int addr = System.identityHashCode(node);
106:            EventTrace.addEvent(new EvictEvent(comment, nodeId, addr));
107:        }
108:
109:        public String toString() {
110:            StringBuffer sb = new StringBuffer(comment);
111:            sb.append(" IN: ").append(nodeId);
112:            sb.append(" sIH ").append(addr);
113:            return sb.toString();
114:        }
115:        }
116:
117:        static public class CursorTrace extends EventTrace {
118:        long nodeId;
119:        int index;
120:
121:        public CursorTrace(String comment, long nodeId, int index) {
122:            super(comment);
123:            this.nodeId = nodeId;
124:            this.index = index;
125:        }
126:
127:        static public void addEvent(String comment, CursorImpl cursor) {
128:            long nodeId =
129:        	(cursor.getBIN() == null) ? -1 : cursor.getBIN().getNodeId();
130:            EventTrace.addEvent
131:        	(new CursorTrace(comment, nodeId, cursor.getIndex()));
132:        }
133:
134:        public String toString() {
135:            StringBuffer sb = new StringBuffer(comment);
136:            sb.append(" BIN: ").append(nodeId);
137:            sb.append(" idx: ").append(index);
138:            return sb.toString();
139:        }
140:        }
141:         */
142:
143:        /*
144:         class CursorEventTrace extends EventTrace {
145:         private String comment;
146:         private Node node1;
147:         private Node node2;
148:
149:         CursorEventTrace(String comment, Node node1, Node node2) {
150:         this.comment = comment;
151:         this.node1 = node1;
152:         this.node2 = node2;
153:         }
154:
155:         public String toString() {
156:         StringBuffer sb = new StringBuffer(comment);
157:         if (node1 != null) {
158:         sb.append(" ");
159:         sb.append(node1.getNodeId());
160:         }
161:         if (node2 != null) {
162:         sb.append(" ");
163:         sb.append(node2.getNodeId());
164:         }
165:         return sb.toString();
166:         }
167:         }
168:
169:         */
170:        /*
171:
172:         static class UndoEventTrace extends EventTrace {
173:         private String comment;
174:         private boolean success;
175:         private Node node;
176:         private DbLsn logLsn;
177:         private Node parent;
178:         private boolean found;
179:         private boolean replaced;
180:         private boolean inserted;
181:         private DbLsn replacedLsn;
182:         private DbLsn abortLsn;
183:         private int index;
184:
185:         UndoEventTrace(String comment) {
186:         this.comment = comment;
187:         }
188:
189:         UndoEventTrace(boolean success,
190:         Node node,
191:         DbLsn logLsn,
192:         Node parent,
193:         boolean found,
194:         boolean replaced,
195:         boolean inserted,
196:         DbLsn replacedLsn,
197:         DbLsn abortLsn,
198:         int index) {
199:         this.comment = null;
200:         this.success = success;
201:         this.node = node;
202:         this.logLsn = logLsn;
203:         this.parent = parent;
204:         this.found = found;
205:         this.replaced = replaced;
206:         this.inserted = inserted;
207:         this.replacedLsn = replacedLsn;
208:         this.abortLsn = abortLsn;
209:         this.index = index;
210:         }
211:
212:         public String toString() {
213:         if (comment != null) {
214:         return comment;
215:         }
216:         StringBuffer sb = new StringBuffer();
217:         sb.append(" success=").append(success);
218:         sb.append(" node=");
219:         sb.append(node.getNodeId());
220:         sb.append(" logLsn=");
221:         sb.append(logLsn.getNoFormatString());
222:         if (parent != null) {
223:         sb.append(" parent=").append(parent.getNodeId());
224:         }
225:         sb.append(" found=");
226:         sb.append(found);
227:         sb.append(" replaced=");
228:         sb.append(replaced);
229:         sb.append(" inserted=");
230:         sb.append(inserted);
231:         if (replacedLsn != null) {
232:         sb.append(" replacedLsn=");
233:         sb.append(replacedLsn.getNoFormatString());
234:         }
235:         if (abortLsn != null) {
236:         sb.append(" abortLsn=");
237:         sb.append(abortLsn.getNoFormatString());
238:         }
239:         sb.append(" index=").append(index);
240:         return sb.toString();
241:         }
242:         }
243:         */
244:        /*
245:         class CursorAdjustEventTrace extends EventTrace {
246:         private int insertIndex;
247:         private int cursorIndex;
248:         private long nodeid;
249:
250:         CursorAdjustEventTrace(int insertIndex, int cursorIndex) {
251:         this.insertIndex = insertIndex;
252:         this.cursorIndex = cursorIndex;
253:         this.nodeid = getNodeId();
254:         }
255:
256:         public String toString() {
257:         StringBuffer sb = new StringBuffer("cursor adjust ");
258:         sb.append(insertIndex).append(" ");
259:         sb.append(cursorIndex).append(" ");
260:         sb.append(nodeid);
261:         return sb.toString();
262:         }
263:         }
264:
265:         */
266:        /*
267:         class CompressEventTrace extends EventTrace {
268:         private int entryIndex;
269:         private long nodeid;
270:
271:         CompressEventTrace(int entryIndex) {
272:         this.entryIndex = entryIndex;
273:         this.nodeid = getNodeId();
274:         }
275:
276:         public String toString() {
277:         StringBuffer sb = new StringBuffer("bin compress ");
278:         sb.append(entryIndex).append(" ");
279:         sb.append(nodeid);
280:         return sb.toString();
281:         }
282:         }
283:
284:         */
285:        /*
286:         class TreeEventTrace extends EventTrace {
287:         private String comment;
288:         private Node node1;
289:         private Node node2;
290:
291:         TreeEventTrace(String comment, Node node1, Node node2) {
292:         this.comment = comment;
293:         this.node1 = node1;
294:         this.node2 = node2;
295:         }
296:
297:         public String toString() {
298:         StringBuffer sb = new StringBuffer(comment);
299:         if (node1 != null) {
300:         sb.append(" ");
301:         sb.append(node1.getNodeId());
302:         }
303:         if (node2 != null) {
304:         sb.append(" ");
305:         sb.append(node2.getNodeId());
306:         }
307:         return sb.toString();
308:         }
309:         }
310:
311:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.