Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
51b76b36
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
51b76b36
编写于
7月 24, 2008
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6726309: Compiler warnings in nio code
Reviewed-by: sherman, iris
上级
ef0b0d2b
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
64 addition
and
55 deletion
+64
-55
src/share/classes/java/nio/channels/spi/AbstractSelector.java
...share/classes/java/nio/channels/spi/AbstractSelector.java
+1
-1
src/share/classes/java/nio/charset/Charset-X-Coder.java
src/share/classes/java/nio/charset/Charset-X-Coder.java
+4
-4
src/share/classes/java/nio/charset/Charset.java
src/share/classes/java/nio/charset/Charset.java
+5
-5
src/share/classes/java/nio/charset/CoderResult.java
src/share/classes/java/nio/charset/CoderResult.java
+6
-6
src/share/classes/sun/nio/ch/SelectorImpl.java
src/share/classes/sun/nio/ch/SelectorImpl.java
+8
-8
src/share/classes/sun/nio/ch/Util.java
src/share/classes/sun/nio/ch/Util.java
+6
-2
src/share/native/java/nio/Bits.c
src/share/native/java/nio/Bits.c
+6
-6
src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
+5
-6
src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
+5
-6
src/solaris/native/java/nio/MappedByteBuffer.c
src/solaris/native/java/nio/MappedByteBuffer.c
+5
-1
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+1
-1
src/solaris/native/sun/nio/ch/InheritedChannel.c
src/solaris/native/sun/nio/ch/InheritedChannel.c
+2
-1
src/solaris/native/sun/nio/ch/Net.c
src/solaris/native/sun/nio/ch/Net.c
+2
-2
src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
+3
-2
src/solaris/native/sun/nio/ch/SocketChannelImpl.c
src/solaris/native/sun/nio/ch/SocketChannelImpl.c
+1
-1
src/windows/classes/sun/nio/ch/PipeImpl.java
src/windows/classes/sun/nio/ch/PipeImpl.java
+2
-2
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
+2
-1
未找到文件。
src/share/classes/java/nio/channels/spi/AbstractSelector.java
浏览文件 @
51b76b36
...
@@ -82,7 +82,7 @@ public abstract class AbstractSelector
...
@@ -82,7 +82,7 @@ public abstract class AbstractSelector
this
.
provider
=
provider
;
this
.
provider
=
provider
;
}
}
private
final
Set
cancelledKeys
=
new
HashSet
();
private
final
Set
<
SelectionKey
>
cancelledKeys
=
new
HashSet
<
SelectionKey
>
();
void
cancel
(
SelectionKey
k
)
{
// package-private
void
cancel
(
SelectionKey
k
)
{
// package-private
synchronized
(
cancelledKeys
)
{
synchronized
(
cancelledKeys
)
{
...
...
src/share/classes/java/nio/charset/Charset-X-Coder.java
浏览文件 @
51b76b36
...
@@ -303,7 +303,7 @@ public abstract class Charset$Coder$ {
...
@@ -303,7 +303,7 @@ public abstract class Charset$Coder$ {
#
if
[
encoder
]
#
if
[
encoder
]
private
WeakReference
cachedDecoder
=
null
;
private
WeakReference
<
CharsetDecoder
>
cachedDecoder
=
null
;
/**
/**
* Tells whether or not the given byte array is a legal replacement value
* Tells whether or not the given byte array is a legal replacement value
...
@@ -322,13 +322,13 @@ public abstract class Charset$Coder$ {
...
@@ -322,13 +322,13 @@ public abstract class Charset$Coder$ {
* is a legal replacement value for this encoder
* is a legal replacement value for this encoder
*/
*/
public
boolean
isLegalReplacement
(
byte
[]
repl
)
{
public
boolean
isLegalReplacement
(
byte
[]
repl
)
{
WeakReference
wr
=
cachedDecoder
;
WeakReference
<
CharsetDecoder
>
wr
=
cachedDecoder
;
CharsetDecoder
dec
=
null
;
CharsetDecoder
dec
=
null
;
if
((
wr
==
null
)
||
((
dec
=
(
CharsetDecoder
)
wr
.
get
())
==
null
))
{
if
((
wr
==
null
)
||
((
dec
=
wr
.
get
())
==
null
))
{
dec
=
charset
().
newDecoder
();
dec
=
charset
().
newDecoder
();
dec
.
onMalformedInput
(
CodingErrorAction
.
REPORT
);
dec
.
onMalformedInput
(
CodingErrorAction
.
REPORT
);
dec
.
onUnmappableCharacter
(
CodingErrorAction
.
REPORT
);
dec
.
onUnmappableCharacter
(
CodingErrorAction
.
REPORT
);
cachedDecoder
=
new
WeakReference
(
dec
);
cachedDecoder
=
new
WeakReference
<
CharsetDecoder
>
(
dec
);
}
else
{
}
else
{
dec
.
reset
();
dec
.
reset
();
}
}
...
...
src/share/classes/java/nio/charset/Charset.java
浏览文件 @
51b76b36
...
@@ -379,7 +379,7 @@ public abstract class Charset
...
@@ -379,7 +379,7 @@ public abstract class Charset
}
}
// Thread-local gate to prevent recursive provider lookups
// Thread-local gate to prevent recursive provider lookups
private
static
ThreadLocal
gate
=
new
ThreadLocal
();
private
static
ThreadLocal
<
ThreadLocal
>
gate
=
new
ThreadLocal
<
ThreadLocal
>
();
private
static
Charset
lookupViaProviders
(
final
String
charsetName
)
{
private
static
Charset
lookupViaProviders
(
final
String
charsetName
)
{
...
@@ -539,9 +539,9 @@ public abstract class Charset
...
@@ -539,9 +539,9 @@ public abstract class Charset
// Fold charsets from the given iterator into the given map, ignoring
// Fold charsets from the given iterator into the given map, ignoring
// charsets whose names already have entries in the map.
// charsets whose names already have entries in the map.
//
//
private
static
void
put
(
Iterator
i
,
Map
m
)
{
private
static
void
put
(
Iterator
<
Charset
>
i
,
Map
<
String
,
Charset
>
m
)
{
while
(
i
.
hasNext
())
{
while
(
i
.
hasNext
())
{
Charset
cs
=
(
Charset
)
i
.
next
();
Charset
cs
=
i
.
next
();
if
(!
m
.
containsKey
(
cs
.
name
()))
if
(!
m
.
containsKey
(
cs
.
name
()))
m
.
put
(
cs
.
name
(),
cs
);
m
.
put
(
cs
.
name
(),
cs
);
}
}
...
@@ -623,7 +623,7 @@ public abstract class Charset
...
@@ -623,7 +623,7 @@ public abstract class Charset
private
final
String
name
;
// tickles a bug in oldjavac
private
final
String
name
;
// tickles a bug in oldjavac
private
final
String
[]
aliases
;
// tickles a bug in oldjavac
private
final
String
[]
aliases
;
// tickles a bug in oldjavac
private
Set
aliasSet
=
null
;
private
Set
<
String
>
aliasSet
=
null
;
/**
/**
* Initializes a new charset with the given canonical name and alias
* Initializes a new charset with the given canonical name and alias
...
@@ -665,7 +665,7 @@ public abstract class Charset
...
@@ -665,7 +665,7 @@ public abstract class Charset
if
(
aliasSet
!=
null
)
if
(
aliasSet
!=
null
)
return
aliasSet
;
return
aliasSet
;
int
n
=
aliases
.
length
;
int
n
=
aliases
.
length
;
HashSet
hs
=
new
HashSet
(
n
);
HashSet
<
String
>
hs
=
new
HashSet
<
String
>
(
n
);
for
(
int
i
=
0
;
i
<
n
;
i
++)
for
(
int
i
=
0
;
i
<
n
;
i
++)
hs
.
add
(
aliases
[
i
]);
hs
.
add
(
aliases
[
i
]);
aliasSet
=
Collections
.
unmodifiableSet
(
hs
);
aliasSet
=
Collections
.
unmodifiableSet
(
hs
);
...
...
src/share/classes/java/nio/charset/CoderResult.java
浏览文件 @
51b76b36
...
@@ -194,7 +194,7 @@ public class CoderResult {
...
@@ -194,7 +194,7 @@ public class CoderResult {
private
static
abstract
class
Cache
{
private
static
abstract
class
Cache
{
private
Map
cache
=
null
;
private
Map
<
Integer
,
WeakReference
<
CoderResult
>>
cache
=
null
;
protected
abstract
CoderResult
create
(
int
len
);
protected
abstract
CoderResult
create
(
int
len
);
...
@@ -202,16 +202,16 @@ public class CoderResult {
...
@@ -202,16 +202,16 @@ public class CoderResult {
if
(
len
<=
0
)
if
(
len
<=
0
)
throw
new
IllegalArgumentException
(
"Non-positive length"
);
throw
new
IllegalArgumentException
(
"Non-positive length"
);
Integer
k
=
new
Integer
(
len
);
Integer
k
=
new
Integer
(
len
);
WeakReference
w
;
WeakReference
<
CoderResult
>
w
;
CoderResult
e
=
null
;
CoderResult
e
=
null
;
if
(
cache
==
null
)
{
if
(
cache
==
null
)
{
cache
=
new
HashMap
();
cache
=
new
HashMap
<
Integer
,
WeakReference
<
CoderResult
>>
();
}
else
if
((
w
=
(
WeakReference
)
cache
.
get
(
k
))
!=
null
)
{
}
else
if
((
w
=
cache
.
get
(
k
))
!=
null
)
{
e
=
(
CoderResult
)
w
.
get
();
e
=
w
.
get
();
}
}
if
(
e
==
null
)
{
if
(
e
==
null
)
{
e
=
create
(
len
);
e
=
create
(
len
);
cache
.
put
(
k
,
new
WeakReference
(
e
));
cache
.
put
(
k
,
new
WeakReference
<
CoderResult
>
(
e
));
}
}
return
e
;
return
e
;
}
}
...
...
src/share/classes/sun/nio/ch/SelectorImpl.java
浏览文件 @
51b76b36
...
@@ -42,19 +42,19 @@ abstract class SelectorImpl
...
@@ -42,19 +42,19 @@ abstract class SelectorImpl
{
{
// The set of keys with data ready for an operation
// The set of keys with data ready for an operation
protected
Set
selectedKeys
;
protected
Set
<
SelectionKey
>
selectedKeys
;
// The set of keys registered with this Selector
// The set of keys registered with this Selector
protected
HashSet
keys
;
protected
HashSet
<
SelectionKey
>
keys
;
// Public views of the key sets
// Public views of the key sets
private
Set
publicKeys
;
// Immutable
private
Set
<
SelectionKey
>
publicKeys
;
// Immutable
private
Set
publicSelectedKeys
;
// Removal allowed, but not addition
private
Set
<
SelectionKey
>
publicSelectedKeys
;
// Removal allowed, but not addition
protected
SelectorImpl
(
SelectorProvider
sp
)
{
protected
SelectorImpl
(
SelectorProvider
sp
)
{
super
(
sp
);
super
(
sp
);
keys
=
new
HashSet
();
keys
=
new
HashSet
<
SelectionKey
>
();
selectedKeys
=
new
HashSet
();
selectedKeys
=
new
HashSet
<
SelectionKey
>
();
if
(
Util
.
atBugLevel
(
"1.4"
))
{
if
(
Util
.
atBugLevel
(
"1.4"
))
{
publicKeys
=
keys
;
publicKeys
=
keys
;
publicSelectedKeys
=
selectedKeys
;
publicSelectedKeys
=
selectedKeys
;
...
@@ -64,13 +64,13 @@ abstract class SelectorImpl
...
@@ -64,13 +64,13 @@ abstract class SelectorImpl
}
}
}
}
public
Set
keys
()
{
public
Set
<
SelectionKey
>
keys
()
{
if
(!
isOpen
()
&&
!
Util
.
atBugLevel
(
"1.4"
))
if
(!
isOpen
()
&&
!
Util
.
atBugLevel
(
"1.4"
))
throw
new
ClosedSelectorException
();
throw
new
ClosedSelectorException
();
return
publicKeys
;
return
publicKeys
;
}
}
public
Set
selectedKeys
()
{
public
Set
<
SelectionKey
>
selectedKeys
()
{
if
(!
isOpen
()
&&
!
Util
.
atBugLevel
(
"1.4"
))
if
(!
isOpen
()
&&
!
Util
.
atBugLevel
(
"1.4"
))
throw
new
ClosedSelectorException
();
throw
new
ClosedSelectorException
();
return
publicSelectedKeys
;
return
publicSelectedKeys
;
...
...
src/share/classes/sun/nio/ch/Util.java
浏览文件 @
51b76b36
...
@@ -51,9 +51,13 @@ class Util {
...
@@ -51,9 +51,13 @@ class Util {
// Per-thread soft cache of the last temporary direct buffer
// Per-thread soft cache of the last temporary direct buffer
private
static
ThreadLocal
<
SoftReference
<
ByteBuffer
>>[]
bufferPool
;
private
static
ThreadLocal
<
SoftReference
<
ByteBuffer
>>[]
bufferPool
;
@SuppressWarnings
(
"unchecked"
)
static
ThreadLocal
<
SoftReference
<
ByteBuffer
>>[]
createThreadLocalBufferPool
()
{
return
new
ThreadLocal
[
TEMP_BUF_POOL_SIZE
];
}
static
{
static
{
bufferPool
=
(
ThreadLocal
<
SoftReference
<
ByteBuffer
>>[])
bufferPool
=
createThreadLocalBufferPool
();
new
ThreadLocal
[
TEMP_BUF_POOL_SIZE
];
for
(
int
i
=
0
;
i
<
TEMP_BUF_POOL_SIZE
;
i
++)
for
(
int
i
=
0
;
i
<
TEMP_BUF_POOL_SIZE
;
i
++)
bufferPool
[
i
]
=
new
ThreadLocal
<
SoftReference
<
ByteBuffer
>>();
bufferPool
[
i
]
=
new
ThreadLocal
<
SoftReference
<
ByteBuffer
>>();
}
}
...
...
src/share/native/java/nio/Bits.c
浏览文件 @
51b76b36
...
@@ -116,7 +116,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src,
...
@@ -116,7 +116,7 @@ Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jobject this, jobject src,
jshort
*
srcShort
,
*
dstShort
,
*
endShort
;
jshort
*
srcShort
,
*
dstShort
,
*
endShort
;
jshort
tmpShort
;
jshort
tmpShort
;
dstShort
=
(
jshort
*
)
dstAddr
;
dstShort
=
(
jshort
*
)
jlong_to_ptr
(
dstAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this if-else statement, see WARNING above */
/* do not change this if-else statement, see WARNING above */
...
@@ -151,7 +151,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr,
...
@@ -151,7 +151,7 @@ Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jobject this, jlong srcAddr,
jshort
*
srcShort
,
*
dstShort
,
*
endShort
;
jshort
*
srcShort
,
*
dstShort
,
*
endShort
;
jshort
tmpShort
;
jshort
tmpShort
;
srcShort
=
(
jshort
*
)
srcAddr
;
srcShort
=
(
jshort
*
)
jlong_to_ptr
(
srcAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this if-else statement, see WARNING above */
/* do not change this if-else statement, see WARNING above */
...
@@ -186,7 +186,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src,
...
@@ -186,7 +186,7 @@ Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jobject this, jobject src,
jint
*
srcInt
,
*
dstInt
,
*
endInt
;
jint
*
srcInt
,
*
dstInt
,
*
endInt
;
jint
tmpInt
;
jint
tmpInt
;
dstInt
=
(
jint
*
)
dstAddr
;
dstInt
=
(
jint
*
)
jlong_to_ptr
(
dstAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this code, see WARNING above */
/* do not change this code, see WARNING above */
...
@@ -221,7 +221,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr,
...
@@ -221,7 +221,7 @@ Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jobject this, jlong srcAddr,
jint
*
srcInt
,
*
dstInt
,
*
endInt
;
jint
*
srcInt
,
*
dstInt
,
*
endInt
;
jint
tmpInt
;
jint
tmpInt
;
srcInt
=
(
jint
*
)
srcAddr
;
srcInt
=
(
jint
*
)
jlong_to_ptr
(
srcAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this code, see WARNING above */
/* do not change this code, see WARNING above */
...
@@ -256,7 +256,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src,
...
@@ -256,7 +256,7 @@ Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jobject this, jobject src,
jlong
*
srcLong
,
*
dstLong
,
*
endLong
;
jlong
*
srcLong
,
*
dstLong
,
*
endLong
;
jlong
tmpLong
;
jlong
tmpLong
;
dstLong
=
(
jlong
*
)
dstAddr
;
dstLong
=
(
jlong
*
)
jlong_to_ptr
(
dstAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this code, see WARNING above */
/* do not change this code, see WARNING above */
...
@@ -291,7 +291,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
...
@@ -291,7 +291,7 @@ Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jobject this, jlong srcAddr,
jlong
*
srcLong
,
*
dstLong
,
*
endLong
;
jlong
*
srcLong
,
*
dstLong
,
*
endLong
;
jlong
tmpLong
;
jlong
tmpLong
;
srcLong
=
(
jlong
*
)
srcAddr
;
srcLong
=
(
jlong
*
)
jlong_to_ptr
(
srcAddr
)
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
/* do not change this code, see WARNING above */
/* do not change this code, see WARNING above */
...
...
src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java
浏览文件 @
51b76b36
...
@@ -50,7 +50,7 @@ class DevPollSelectorImpl
...
@@ -50,7 +50,7 @@ class DevPollSelectorImpl
private
int
totalChannels
;
private
int
totalChannels
;
// Maps from file descriptors to keys
// Maps from file descriptors to keys
private
HashMap
fdToKey
;
private
Map
<
Integer
,
SelectionKeyImpl
>
fdToKey
;
// True if this Selector has been closed
// True if this Selector has been closed
private
boolean
closed
=
false
;
private
boolean
closed
=
false
;
...
@@ -71,7 +71,7 @@ class DevPollSelectorImpl
...
@@ -71,7 +71,7 @@ class DevPollSelectorImpl
fd1
=
fdes
[
1
];
fd1
=
fdes
[
1
];
pollWrapper
=
new
DevPollArrayWrapper
();
pollWrapper
=
new
DevPollArrayWrapper
();
pollWrapper
.
initInterrupt
(
fd0
,
fd1
);
pollWrapper
.
initInterrupt
(
fd0
,
fd1
);
fdToKey
=
new
HashMap
();
fdToKey
=
new
HashMap
<
Integer
,
SelectionKeyImpl
>
();
totalChannels
=
1
;
totalChannels
=
1
;
}
}
...
@@ -110,8 +110,7 @@ class DevPollSelectorImpl
...
@@ -110,8 +110,7 @@ class DevPollSelectorImpl
int
numKeysUpdated
=
0
;
int
numKeysUpdated
=
0
;
for
(
int
i
=
0
;
i
<
entries
;
i
++)
{
for
(
int
i
=
0
;
i
<
entries
;
i
++)
{
int
nextFD
=
pollWrapper
.
getDescriptor
(
i
);
int
nextFD
=
pollWrapper
.
getDescriptor
(
i
);
SelectionKeyImpl
ski
=
(
SelectionKeyImpl
)
fdToKey
.
get
(
SelectionKeyImpl
ski
=
fdToKey
.
get
(
Integer
.
valueOf
(
nextFD
));
new
Integer
(
nextFD
));
// ski is null in the case of an interrupt
// ski is null in the case of an interrupt
if
(
ski
!=
null
)
{
if
(
ski
!=
null
)
{
int
rOps
=
pollWrapper
.
getReventOps
(
i
);
int
rOps
=
pollWrapper
.
getReventOps
(
i
);
...
@@ -169,7 +168,7 @@ class DevPollSelectorImpl
...
@@ -169,7 +168,7 @@ class DevPollSelectorImpl
protected
void
implRegister
(
SelectionKeyImpl
ski
)
{
protected
void
implRegister
(
SelectionKeyImpl
ski
)
{
int
fd
=
IOUtil
.
fdVal
(
ski
.
channel
.
getFD
());
int
fd
=
IOUtil
.
fdVal
(
ski
.
channel
.
getFD
());
fdToKey
.
put
(
new
Integer
(
fd
),
ski
);
fdToKey
.
put
(
Integer
.
valueOf
(
fd
),
ski
);
totalChannels
++;
totalChannels
++;
keys
.
add
(
ski
);
keys
.
add
(
ski
);
}
}
...
@@ -178,7 +177,7 @@ class DevPollSelectorImpl
...
@@ -178,7 +177,7 @@ class DevPollSelectorImpl
int
i
=
ski
.
getIndex
();
int
i
=
ski
.
getIndex
();
assert
(
i
>=
0
);
assert
(
i
>=
0
);
int
fd
=
ski
.
channel
.
getFDVal
();
int
fd
=
ski
.
channel
.
getFDVal
();
fdToKey
.
remove
(
new
Integer
(
fd
));
fdToKey
.
remove
(
Integer
.
valueOf
(
fd
));
pollWrapper
.
release
(
fd
);
pollWrapper
.
release
(
fd
);
totalChannels
--;
totalChannels
--;
ski
.
setIndex
(-
1
);
ski
.
setIndex
(-
1
);
...
...
src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java
浏览文件 @
51b76b36
...
@@ -48,7 +48,7 @@ class EPollSelectorImpl
...
@@ -48,7 +48,7 @@ class EPollSelectorImpl
EPollArrayWrapper
pollWrapper
;
EPollArrayWrapper
pollWrapper
;
// Maps from file descriptors to keys
// Maps from file descriptors to keys
private
HashMap
fdToKey
;
private
Map
<
Integer
,
SelectionKeyImpl
>
fdToKey
;
// True if this Selector has been closed
// True if this Selector has been closed
private
boolean
closed
=
false
;
private
boolean
closed
=
false
;
...
@@ -69,7 +69,7 @@ class EPollSelectorImpl
...
@@ -69,7 +69,7 @@ class EPollSelectorImpl
fd1
=
fdes
[
1
];
fd1
=
fdes
[
1
];
pollWrapper
=
new
EPollArrayWrapper
();
pollWrapper
=
new
EPollArrayWrapper
();
pollWrapper
.
initInterrupt
(
fd0
,
fd1
);
pollWrapper
.
initInterrupt
(
fd0
,
fd1
);
fdToKey
=
new
HashMap
();
fdToKey
=
new
HashMap
<
Integer
,
SelectionKeyImpl
>
();
}
}
protected
int
doSelect
(
long
timeout
)
protected
int
doSelect
(
long
timeout
)
...
@@ -107,8 +107,7 @@ class EPollSelectorImpl
...
@@ -107,8 +107,7 @@ class EPollSelectorImpl
int
numKeysUpdated
=
0
;
int
numKeysUpdated
=
0
;
for
(
int
i
=
0
;
i
<
entries
;
i
++)
{
for
(
int
i
=
0
;
i
<
entries
;
i
++)
{
int
nextFD
=
pollWrapper
.
getDescriptor
(
i
);
int
nextFD
=
pollWrapper
.
getDescriptor
(
i
);
SelectionKeyImpl
ski
=
(
SelectionKeyImpl
)
fdToKey
.
get
(
SelectionKeyImpl
ski
=
fdToKey
.
get
(
Integer
.
valueOf
(
nextFD
));
new
Integer
(
nextFD
));
// ski is null in the case of an interrupt
// ski is null in the case of an interrupt
if
(
ski
!=
null
)
{
if
(
ski
!=
null
)
{
int
rOps
=
pollWrapper
.
getEventOps
(
i
);
int
rOps
=
pollWrapper
.
getEventOps
(
i
);
...
@@ -164,7 +163,7 @@ class EPollSelectorImpl
...
@@ -164,7 +163,7 @@ class EPollSelectorImpl
protected
void
implRegister
(
SelectionKeyImpl
ski
)
{
protected
void
implRegister
(
SelectionKeyImpl
ski
)
{
int
fd
=
IOUtil
.
fdVal
(
ski
.
channel
.
getFD
());
int
fd
=
IOUtil
.
fdVal
(
ski
.
channel
.
getFD
());
fdToKey
.
put
(
new
Integer
(
fd
),
ski
);
fdToKey
.
put
(
Integer
.
valueOf
(
fd
),
ski
);
pollWrapper
.
add
(
fd
);
pollWrapper
.
add
(
fd
);
keys
.
add
(
ski
);
keys
.
add
(
ski
);
}
}
...
@@ -172,7 +171,7 @@ class EPollSelectorImpl
...
@@ -172,7 +171,7 @@ class EPollSelectorImpl
protected
void
implDereg
(
SelectionKeyImpl
ski
)
throws
IOException
{
protected
void
implDereg
(
SelectionKeyImpl
ski
)
throws
IOException
{
assert
(
ski
.
getIndex
()
>=
0
);
assert
(
ski
.
getIndex
()
>=
0
);
int
fd
=
ski
.
channel
.
getFDVal
();
int
fd
=
ski
.
channel
.
getFDVal
();
fdToKey
.
remove
(
new
Integer
(
fd
));
fdToKey
.
remove
(
Integer
.
valueOf
(
fd
));
pollWrapper
.
release
(
fd
);
pollWrapper
.
release
(
fd
);
ski
.
setIndex
(-
1
);
ski
.
setIndex
(-
1
);
keys
.
remove
(
ski
);
keys
.
remove
(
ski
);
...
...
src/solaris/native/java/nio/MappedByteBuffer.c
浏览文件 @
51b76b36
...
@@ -43,7 +43,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
...
@@ -43,7 +43,11 @@ Java_java_nio_MappedByteBuffer_isLoaded0(JNIEnv *env, jobject obj,
int
result
=
0
;
int
result
=
0
;
int
i
=
0
;
int
i
=
0
;
void
*
a
=
(
void
*
)
jlong_to_ptr
(
address
);
void
*
a
=
(
void
*
)
jlong_to_ptr
(
address
);
char
*
vec
=
(
char
*
)
malloc
(
numPages
*
sizeof
(
char
));
#ifdef __linux__
unsigned
char
*
vec
=
(
unsigned
char
*
)
malloc
(
numPages
*
sizeof
(
char
));
#else
char
*
vec
=
(
char
*
)
malloc
(
numPages
*
sizeof
(
char
));
#endif
if
(
vec
==
NULL
)
{
if
(
vec
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
...
...
src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
浏览文件 @
51b76b36
...
@@ -123,7 +123,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
...
@@ -123,7 +123,7 @@ Java_sun_nio_ch_DatagramChannelImpl_receive0(JNIEnv *env, jobject this,
jint
fd
=
fdval
(
env
,
fdo
);
jint
fd
=
fdval
(
env
,
fdo
);
void
*
buf
=
(
void
*
)
jlong_to_ptr
(
address
);
void
*
buf
=
(
void
*
)
jlong_to_ptr
(
address
);
SOCKADDR
sa
;
SOCKADDR
sa
;
in
t
sa_len
=
SOCKADDR_LEN
;
socklen_
t
sa_len
=
SOCKADDR_LEN
;
jboolean
retry
=
JNI_FALSE
;
jboolean
retry
=
JNI_FALSE
;
jint
n
=
0
;
jint
n
=
0
;
jobject
senderAddr
;
jobject
senderAddr
;
...
...
src/solaris/native/sun/nio/ch/InheritedChannel.c
浏览文件 @
51b76b36
...
@@ -88,7 +88,8 @@ Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
...
@@ -88,7 +88,8 @@ Java_sun_nio_ch_InheritedChannel_peerPort0(JNIEnv *env, jclass cla, jint fd)
JNIEXPORT
jint
JNICALL
JNIEXPORT
jint
JNICALL
Java_sun_nio_ch_InheritedChannel_soType0
(
JNIEnv
*
env
,
jclass
cla
,
jint
fd
)
Java_sun_nio_ch_InheritedChannel_soType0
(
JNIEnv
*
env
,
jclass
cla
,
jint
fd
)
{
{
int
sotype
,
arglen
=
sizeof
(
sotype
);
int
sotype
;
socklen_t
arglen
=
sizeof
(
sotype
);
if
(
getsockopt
(
fd
,
SOL_SOCKET
,
SO_TYPE
,
(
void
*
)
&
sotype
,
&
arglen
)
==
0
)
{
if
(
getsockopt
(
fd
,
SOL_SOCKET
,
SO_TYPE
,
(
void
*
)
&
sotype
,
&
arglen
)
==
0
)
{
if
(
sotype
==
SOCK_STREAM
)
if
(
sotype
==
SOCK_STREAM
)
return
sun_nio_ch_InheritedChannel_SOCK_STREAM
;
return
sun_nio_ch_InheritedChannel_SOCK_STREAM
;
...
...
src/solaris/native/sun/nio/ch/Net.c
浏览文件 @
51b76b36
...
@@ -138,7 +138,7 @@ JNIEXPORT jint JNICALL
...
@@ -138,7 +138,7 @@ JNIEXPORT jint JNICALL
Java_sun_nio_ch_Net_localPort
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
fdo
)
Java_sun_nio_ch_Net_localPort
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
fdo
)
{
{
SOCKADDR
sa
;
SOCKADDR
sa
;
in
t
sa_len
=
SOCKADDR_LEN
;
socklen_
t
sa_len
=
SOCKADDR_LEN
;
if
(
getsockname
(
fdval
(
env
,
fdo
),
(
struct
sockaddr
*
)
&
sa
,
&
sa_len
)
<
0
)
{
if
(
getsockname
(
fdval
(
env
,
fdo
),
(
struct
sockaddr
*
)
&
sa
,
&
sa_len
)
<
0
)
{
handleSocketError
(
env
,
errno
);
handleSocketError
(
env
,
errno
);
return
-
1
;
return
-
1
;
...
@@ -150,7 +150,7 @@ JNIEXPORT jobject JNICALL
...
@@ -150,7 +150,7 @@ JNIEXPORT jobject JNICALL
Java_sun_nio_ch_Net_localInetAddress
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
fdo
)
Java_sun_nio_ch_Net_localInetAddress
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
fdo
)
{
{
SOCKADDR
sa
;
SOCKADDR
sa
;
in
t
sa_len
=
SOCKADDR_LEN
;
socklen_
t
sa_len
=
SOCKADDR_LEN
;
int
port
;
int
port
;
if
(
getsockname
(
fdval
(
env
,
fdo
),
(
struct
sockaddr
*
)
&
sa
,
&
sa_len
)
<
0
)
{
if
(
getsockname
(
fdval
(
env
,
fdo
),
(
struct
sockaddr
*
)
&
sa
,
&
sa_len
)
<
0
)
{
handleSocketError
(
env
,
errno
);
handleSocketError
(
env
,
errno
);
...
...
src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
浏览文件 @
51b76b36
...
@@ -81,12 +81,12 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
...
@@ -81,12 +81,12 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
jint
ssfd
=
(
*
env
)
->
GetIntField
(
env
,
ssfdo
,
fd_fdID
);
jint
ssfd
=
(
*
env
)
->
GetIntField
(
env
,
ssfdo
,
fd_fdID
);
jint
newfd
;
jint
newfd
;
struct
sockaddr
*
sa
;
struct
sockaddr
*
sa
;
int
sa
_len
;
int
alloc
_len
;
jobject
remote_ia
=
0
;
jobject
remote_ia
=
0
;
jobject
isa
;
jobject
isa
;
jint
remote_port
;
jint
remote_port
;
NET_AllocSockaddr
(
&
sa
,
&
sa
_len
);
NET_AllocSockaddr
(
&
sa
,
&
alloc
_len
);
/*
/*
* accept connection but ignore ECONNABORTED indicating that
* accept connection but ignore ECONNABORTED indicating that
...
@@ -94,6 +94,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
...
@@ -94,6 +94,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
* accept() was called.
* accept() was called.
*/
*/
for
(;;)
{
for
(;;)
{
socklen_t
sa_len
=
alloc_len
;
newfd
=
accept
(
ssfd
,
sa
,
&
sa_len
);
newfd
=
accept
(
ssfd
,
sa
,
&
sa_len
);
if
(
newfd
>=
0
)
{
if
(
newfd
>=
0
)
{
break
;
break
;
...
...
src/solaris/native/sun/nio/ch/SocketChannelImpl.c
浏览文件 @
51b76b36
...
@@ -55,7 +55,7 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
...
@@ -55,7 +55,7 @@ Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
jboolean
ready
)
jboolean
ready
)
{
{
int
error
=
0
;
int
error
=
0
;
in
t
n
=
sizeof
(
int
);
socklen_
t
n
=
sizeof
(
int
);
jint
fd
=
fdval
(
env
,
fdo
);
jint
fd
=
fdval
(
env
,
fdo
);
int
result
=
0
;
int
result
=
0
;
struct
pollfd
poller
;
struct
pollfd
poller
;
...
...
src/windows/classes/sun/nio/ch/PipeImpl.java
浏览文件 @
51b76b36
...
@@ -67,7 +67,7 @@ class PipeImpl
...
@@ -67,7 +67,7 @@ class PipeImpl
}
}
private
class
Initializer
private
class
Initializer
implements
PrivilegedExceptionAction
implements
PrivilegedExceptionAction
<
Void
>
{
{
private
final
SelectorProvider
sp
;
private
final
SelectorProvider
sp
;
...
@@ -76,7 +76,7 @@ class PipeImpl
...
@@ -76,7 +76,7 @@ class PipeImpl
this
.
sp
=
sp
;
this
.
sp
=
sp
;
}
}
public
Object
run
()
throws
IOException
{
public
Void
run
()
throws
IOException
{
ServerSocketChannel
ssc
=
null
;
ServerSocketChannel
ssc
=
null
;
SocketChannel
sc1
=
null
;
SocketChannel
sc1
=
null
;
SocketChannel
sc2
=
null
;
SocketChannel
sc2
=
null
;
...
...
src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java
浏览文件 @
51b76b36
...
@@ -72,7 +72,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
...
@@ -72,7 +72,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
private
int
threadsCount
=
0
;
private
int
threadsCount
=
0
;
// A list of helper threads for select.
// A list of helper threads for select.
private
final
List
threads
=
new
ArrayList
();
private
final
List
<
Thread
>
threads
=
new
ArrayList
<
Thread
>
();
//Pipe used as a wakeup object.
//Pipe used as a wakeup object.
private
final
Pipe
wakeupPipe
;
private
final
Pipe
wakeupPipe
;
...
@@ -82,6 +82,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
...
@@ -82,6 +82,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
// Maps file descriptors to their indices in pollArray
// Maps file descriptors to their indices in pollArray
private
final
static
class
FdMap
extends
HashMap
<
Integer
,
MapEntry
>
{
private
final
static
class
FdMap
extends
HashMap
<
Integer
,
MapEntry
>
{
static
final
long
serialVersionUID
=
0L
;
private
MapEntry
get
(
int
desc
)
{
private
MapEntry
get
(
int
desc
)
{
return
get
(
new
Integer
(
desc
));
return
get
(
new
Integer
(
desc
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录