h2-1.4.197.jar
登录
|
com.h2database:h2:1.4.197
META-INF
org
h2
jdbc
message
expression
engine
upgrade
Driver.java
security
fulltext
api
compress
index
table
constraint
store
util
ValueHashMap.java
AbbaLockingDetector.java
DateTimeFunctions.java
DoneFuture.java
ColumnNamer.java
SourceCompiler.java
ToChar.java
ToDateParser.java
Tool.java
Task.java
Permutations.java
AbbaDetector.java
LazyFuture.java
SmallLRUCache.java
OsgiDataSourceFactory.java
ColumnNamerConfiguration.java
CacheHead.java
CacheSecondLevel.java
CloseWatcher.java
MergedResultSet.java
CacheWriter.java
NetUtils.java
IOUtils.java
SoftHashMap.java
DbDriverActivator.java
CacheObject.java
CacheTQ.java
Bits.java
BitField.java
DateTimeUtils.java
SortedProperties.java
LocalDateTimeUtils.java
Utils.java
Profiler.java
StringUtils.java
MathUtils.java
IntIntHashMap.java
IntArray.java
ParserUtil.java
StatementBuilder.java
DebuggingThreadLocal.java
SmallMap.java
HashBase.java
CacheLRU.java
ThreadDeadlockDetector.java
JdbcUtils.java
Cache.java
New.java
ToDateTokenizer.java
SynchronizedVerifier.java
ScriptReader.java
TempFileDeleter.java
bnf
command
tools
server
mode
jdbcx
result
JdbcDriverBackwardsCompat.java
jmx
value
schema
mvstore
SynchronizedVerifier.java
清空
类结构
/* * Copyright 2004-2018 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.util; import java.util.
Collections
; import java.util.
HashMap
; import java.util.
IdentityHashMap
; import java.util.
Map
; import java.util.concurrent.atomic.
AtomicBoolean
; /** * A utility class that allows to verify access to a resource is synchronized. */ public class
SynchronizedVerifier
{ private static volatile boolean
enabled
; private static final
Map
<
Class
<?>,
AtomicBoolean
>
DETECT
=
Collections
.
synchronizedMap
(new
HashMap
<
Class
<?>,
AtomicBoolean
>()); private static final
Map
<
Object
,
Object
>
CURRENT
=
Collections
.
synchronizedMap
(new
IdentityHashMap
<>()); /** * Enable or disable detection for a given class. * * @param clazz the class * @param value the new value (true means detection is enabled) */ public static void
setDetect
(
Class
<?>
clazz
, boolean
value
) { if (
value
) {
DETECT
.
put
(
clazz
, new
AtomicBoolean
()); } else {
AtomicBoolean
b
=
DETECT
.
remove
(
clazz
); if (
b
== null) { throw new
AssertionError
("Detection was not enabled"); } else if (!
b
.
get
()) { throw new
AssertionError
("No object of this class was tested"); } }
enabled
=
DETECT
.
size
() > 0; } /** * Verify the object is not accessed concurrently. * * @param o the object */ public static void
check
(
Object
o
) { if (
enabled
) {
detectConcurrentAccess
(
o
); } } private static void
detectConcurrentAccess
(
Object
o
) {
AtomicBoolean
value
=
DETECT
.
get
(
o
.
getClass
()); if (
value
!= null) {
value
.
set
(true); if (
CURRENT
.
remove
(
o
) != null) { throw new
AssertionError
("Concurrent access"); }
CURRENT
.
put
(
o
,
o
); try {
Thread
.
sleep
(1); } catch (
InterruptedException
e
) { // ignore }
Object
old
=
CURRENT
.
remove
(
o
); if (
old
== null) { throw new
AssertionError
("Concurrent access"); } } } }
查找资源
Jre/Lib
输入类名或文件名
类结构窗口