< prev index next >
src/java.base/share/classes/sun/nio/ch/SelectionKeyImpl.java
Print this page
rev 49242 : [mq]: selector-cleanup
*** 1,7 ****
/*
! * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,35 ****
* questions.
*/
package sun.nio.ch;
! import java.io.IOException;
! import java.nio.channels.*;
! import java.nio.channels.spi.*;
/**
* An implementation of SelectionKey for Solaris.
*/
--- 23,37 ----
* questions.
*/
package sun.nio.ch;
! import java.nio.channels.CancelledKeyException;
! import java.nio.channels.SelectableChannel;
! import java.nio.channels.SelectionKey;
! import java.nio.channels.Selector;
! import java.nio.channels.spi.AbstractSelectionKey;
/**
* An implementation of SelectionKey for Solaris.
*/
*** 43,53 ****
// Index for a pollfd array in Selector that this key is registered with
private int index;
private volatile int interestOps;
! private int readyOps;
SelectionKeyImpl(SelChImpl ch, SelectorImpl sel) {
channel = ch;
selector = sel;
}
--- 45,55 ----
// Index for a pollfd array in Selector that this key is registered with
private int index;
private volatile int interestOps;
! private volatile int readyOps;
SelectionKeyImpl(SelChImpl ch, SelectorImpl sel) {
channel = ch;
selector = sel;
}
*** 109,114 ****
--- 111,134 ----
public int nioInterestOps() {
return interestOps;
}
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("channel=")
+ .append(channel)
+ .append(", selector=")
+ .append(selector);
+ if (isValid()) {
+ sb.append(", interestOps=")
+ .append(interestOps)
+ .append(", readyOps=")
+ .append(readyOps);
+ } else {
+ sb.append(", invalid");
+ }
+ return sb.toString();
+ }
+
}
< prev index next >