MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Wrapper.java
1
/*
2
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
/*
18
* Wrapper.java
19
*/
20
21
package
com.mysql.jtie;
22
49
public
class
Wrapper
{
50
51
/*
52
* A native function called during static initialization of this class
53
* for preloaded caching of field/method Ids.
54
*
55
* Caution, this leads easily to circular dependencies: If the underlying
56
* native library has not been loaded when this function is called, the
57
* result is in a non-descriptive UnsatisfiedLinkError.
58
*
59
* For this, and since preloading cannot be expected to provide a large
60
* performance gain, this feature is not implemented at this time.
61
*
62
* static private native void initIds();
63
* static {
64
* initIds();
65
* }
66
*/
67
71
// comments: this field
72
// - is allowed to be private, for access from JNI is always possible;
73
// - is private for better security and consistency assurances;
74
// - must not be final if it is to be nullified when deleting the
75
// native delegate object through this instance from JNI;
76
// - is not required to be final under the hashcode() and equals()
77
// consistency requirement;
78
// - XXX consider (and benchmark) declaring this field volatile
79
// - a write then happens-before every subsequent read of that field
80
// - writes and reads of volatile longs and doubles are always atomic
81
private
volatile
long
cdelegate;
82
86
// comments:
87
// - field access from JNI is fast, hence no initialization of this
88
// cdelegate field in a c'tor;
89
protected
Wrapper
() {
90
//System.out.println("<-> jtie.Wrapper()");
91
};
92
96
protected
Wrapper
(
Wrapper
o) {
97
//System.out.println("<-> jtie.Wrapper(Wrapper)");
98
cdelegate = o.cdelegate;
99
};
100
106
// all equals() requirements are met due to pure delegation semantics
107
public
final
boolean
equals
(Object obj) {
108
if
(
this
== obj)
109
return
true
;
110
if
(!(obj instanceof
Wrapper
))
111
return
false
;
112
final
Wrapper wo = (
Wrapper
)obj;
113
return
(cdelegate == wo.cdelegate);
114
}
115
120
// all hashCode() requirements are met due to pure delegation semantics
121
public
final
int
hashCode
() {
122
return
(
int
)cdelegate;
// precision loss ok, for only a hash
123
}
124
129
// overrides inherited toString() for full precision of cdelegate
130
public
String
toString
() {
131
return
(getClass().getName() +
'@'
+ Long.toHexString(cdelegate));
132
}
133
}
storage
ndb
src
ndbjtie
jtie
com
mysql
jtie
Wrapper.java
Generated on Sat Nov 9 2013 01:28:11 for MySQL 5.6.14 Source Code Document by
1.8.1.2